https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/127835
>From 02218dfb3cdc1282b474b5f0fde3c6cc8791e0a0 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 14 Feb 2025 17:30:54 -0800
Subject: [PATCH 1/7] [CIR] Initial implementation of lowering CIR to MLIR
Add s
andykaylor wrote:
We agreed at the clangir upstreaming meeting today that this PR should be put
on hold. We don't intend to keep lowering to MLIR standard dialects up-to-date
as we upstream the rest of the implementation, and it is currently missing a
lot of functionality in the incubator, so
andykaylor wrote:
I've rebased this PR to bring in recent changes, fixed a few problems that were
caused by recent changes, and generally refactored the command-line handling to
align with a similar change that was made in the incubator.
This doesn't lower the ops and types that have been adde
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/127835
>From 4f69f1700f9f982e9271157c5b870eda71e0c0f2 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 14 Feb 2025 17:30:54 -0800
Subject: [PATCH 1/6] [CIR] Initial implementation of lowering CIR to MLIR
Add s
https://github.com/erichkeane approved this pull request.
I'm happy with this as is, though note Aaron is away at WG14 in Graz this week.
But it looks like you've done everything he's asked for, so feel free to merge.
https://github.com/llvm/llvm-project/pull/127835
___
andykaylor wrote:
@AaronBallman , @erichkeane I think I've addressed the review comments. Is
there anything else you'd like changed?
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists
https://github.com/keryell approved this pull request.
Thank you!
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
LGTM once remaining comments from others are addressed.
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin
@@ -2958,8 +2958,13 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
-def emit_core_mlir : Flag<["-"]
keryell wrote:
I appreciate the parallelism for sure! :smile:
It would be nice if your team can book more time to work on the fundamental
issues related to CIR→MLIR in the incubator.
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mai
@@ -2958,8 +2958,13 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
-def emit_core_mlir : Flag<["-"]
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/127835
>From a03e9a97e90e2bb0fe22903cc15f35cbf71f94d2 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 14 Feb 2025 17:30:54 -0800
Subject: [PATCH 1/4] [CIR] Initial implementation of lowering CIR to MLIR
Add s
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -0,0 +1,201 @@
+//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR
===//
+//
+// 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: Ap
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getMLIRContext() { return *mlir
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getMLIRContext() { return *mlir
@@ -0,0 +1,79 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-emit-core-mlir %s -o %t.mlir
+// RUN: FileCheck --input-file=%t.mlir %s
+
+char c;
+// CHECK: memref.global "public" @c : memref
+
+signed char sc;
+// CHECK: memref.global "public" @sc :
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getMLIRContext() { return *mlir
@@ -90,6 +92,15 @@ class CIRGenConsumer : public clang::ASTConsumer {
MlirModule->print(*OutputStream, Flags);
}
break;
+case CIRGenAction::OutputType::EmitMLIR: {
+ auto LoweredMlirModule = lowerFromCIRToMLIR(MlirModule, MlirCtx);
@@ -0,0 +1,201 @@
+//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR
===//
+//
+// 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: Ap
@@ -0,0 +1,201 @@
+//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR
===//
+//
+// 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: Ap
@@ -0,0 +1,201 @@
+//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR
===//
+//
+// 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: Ap
@@ -0,0 +1,79 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-emit-core-mlir %s -o %t.mlir
+// RUN: FileCheck --input-file=%t.mlir %s
+
+char c;
+// CHECK: memref.global "public" @c : memref
+
+signed char sc;
+// CHECK: memref.global "public" @sc :
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/127835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getContext() { return *mlirCont
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/127835
>From a03e9a97e90e2bb0fe22903cc15f35cbf71f94d2 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 14 Feb 2025 17:30:54 -0800
Subject: [PATCH 1/2] [CIR] Initial implementation of lowering CIR to MLIR
Add s
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getContext() { return *mlirCont
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
void Initialize(clang::ASTContext &astContext) override;
bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
mlir::ModuleOp getModule() const;
+ mlir::MLIRContext &getContext() { return *mlirCont
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir",
BothFlags<[], [ClangOption, CC1Option], "">>;
def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
Group, HelpText<"Build ASTs and then lower to ClangIR">;
+def emit_cir_mlir : Flag<["-"],
llvmbot wrote:
@llvm/pr-subscribers-clangir
Author: Andy Kaylor (andykaylor)
Changes
Add support for lowering CIR to more general MLIR and emitting an MLIR text
file, including a new command-line option for emitting MLIR via ClangIR. This
does not yet support lowering to LLVM IR or other
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/127835
Add support for lowering CIR to more general MLIR and emitting an MLIR text
file, including a new command-line option for emitting MLIR via ClangIR. This
does not yet support lowering to LLVM IR or other tar
48 matches
Mail list logo