https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/erichkeane approved this pull request.
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/AaronBallman approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/124650
>From 41546e2d096310d8a1474539b5036152c7df3d11 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Mon, 27 Jan 2025 14:54:10 -0800
Subject: [PATCH 1/4] [CIR] Add framework for CIR to LLVM IR lowering
Create the
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
bcardosolopes wrote:
We run passes post CIRGen (LLVM lowering is one exam
@@ -55,6 +55,9 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ std::unique_ptr takeContext() {
b
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
lanza wrote:
> Could CIRGenerator own this and just share it with lowerFr
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -55,6 +56,13 @@ class EmitCIRAction : public CIRGenAction {
EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
};
+class EmitLLVMAction : public CIRGenAction {
+ virtual void anchor();
+
+public:
+ EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -55,6 +56,13 @@ class EmitCIRAction : public CIRGenAction {
EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
};
+class EmitLLVMAction : public CIRGenAction {
+ virtual void anchor();
+
+public:
+ EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
erichkeane wrote:
Could `CIRGenerator` own this and just share it with `l
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
andykaylor wrote:
Perhaps it's also relevant to note that I don't seem to
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -55,6 +55,9 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ std::shared_ptr getContext() {
Aa
@@ -7,42 +7,56 @@
//===--===//
#include "clang/CIR/FrontendAction/CIRGenAction.h"
-#include "clang/CIR/CIRGenerator.h"
-#include "clang/Frontend/CompilerInstance.h"
-
#include "mlir/IR/MLIRContext.h"
#inclu
@@ -66,6 +81,17 @@ class CIRGenConsumer : public clang::ASTConsumer {
MlirModule->print(*OutputStream, Flags);
}
break;
+case CIRGenAction::OutputType::EmitLLVM: {
+ llvm::LLVMContext LLVMCtx;
+ auto LLVMModule = lowerFromCIRToLLVMIR(CI.getFron
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -55,6 +56,13 @@ class EmitCIRAction : public CIRGenAction {
EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
};
+class EmitLLVMAction : public CIRGenAction {
+ virtual void anchor();
+
+public:
+ EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
andykaylor wrote:
Sorry, I thought shared pointer was what you were sugge
@@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer {
const clang::CodeGenOptions &codeGenOpts;
protected:
- std::unique_ptr mlirContext;
+ std::shared_ptr mlirContext;
erichkeane wrote:
Hmm... I don't think the shared pointer is the way here
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/124650
>From 41546e2d096310d8a1474539b5036152c7df3d11 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Mon, 27 Jan 2025 14:54:10 -0800
Subject: [PATCH 1/3] [CIR] Add framework for CIR to LLVM IR lowering
Create the
@@ -55,6 +55,9 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ std::unique_ptr takeContext() {
a
@@ -0,0 +1,36 @@
+//- LowerToLLVM.h- Lowering from CIR to LLVM
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -55,6 +55,9 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ std::unique_ptr takeContext() {
e
@@ -0,0 +1 @@
+add_subdirectory(DirectToLLVM)
erichkeane wrote:
newline at end of file here too, because github.
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/erichkeane commented:
I have concerns about `takeContext`, else everything else is a NIT.
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/124650
>From 41546e2d096310d8a1474539b5036152c7df3d11 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Mon, 27 Jan 2025 14:54:10 -0800
Subject: [PATCH 1/2] [CIR] Add framework for CIR to LLVM IR lowering
Create the
@@ -0,0 +1,41 @@
+//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
https://github.com/bcardosolopes approved this pull request.
Seems like there are some CI failures (format related?) but LGTM once those are
fixed
https://github.com/llvm/llvm-project/pull/124650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 3861b9db882d5637725ceeccb801c2bb837e8fc5
41546e2d096310d8a1474539b5036152c7df3d11 --e
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Andy Kaylor (andykaylor)
Changes
Create the skeleton framework for lowering from ClangIR to LLVM IR. This
initial implementation just creates an empty LLVM IR module. Actual lowering of
even minimal ClangIR is deferred to a later patch.
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/124650
Create the skeleton framework for lowering from ClangIR to LLVM IR. This
initial implementation just creates an empty LLVM IR module. Actual lowering of
even minimal ClangIR is deferred to a later patch.
>F
45 matches
Mail list logo