@@ -52,6 +54,19 @@ class ScalarExprEmitter : public
StmtVisitor {
return {};
}
+ /// Emits the address of the l-value, then loads and returns the result.
+ mlir::Value emitLoadOfLValue(const Expr *e) {
+LValue lv = cgf.emitLValue(e);
+// FIXME: add some akin t
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/128792
>From 235ef9e23a314f8946b48143294da367b80f7d14 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 25 Feb 2025 12:31:08 -0800
Subject: [PATCH 1/2] [CIR] Upstream basic alloca and load support
This change i
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/128792
This change implements basic support in ClangIR for local variables using the
cir.alloca and cir.load operations.
>From 235ef9e23a314f8946b48143294da367b80f7d14 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Da
@@ -1681,19 +1681,25 @@ for more details.
permitted to produce more precise results than performing the same
operations separately.
- The C standard permits intermediate floating-point results within an
+ The C/C++ standard permits intermediate floating-point results
@@ -1681,19 +1681,25 @@ for more details.
permitted to produce more precise results than performing the same
operations separately.
- The C standard permits intermediate floating-point results within an
+ The C/C++ standard permits intermediate floating-point results
@@ -1681,19 +1681,25 @@ for more details.
permitted to produce more precise results than performing the same
operations separately.
- The C standard permits intermediate floating-point results within an
+ The C/C++ standard permits intermediate floating-point results
@@ -78,16 +82,37 @@ class CIRGenModule : public CIRGenTypeCache {
void emitTopLevelDecl(clang::Decl *decl);
+ /// Return the address of the given function. If funcType is non-null, then
+ /// this function will use the specified type if it has to create it.
+ // TODO: th
@@ -0,0 +1,128 @@
+//===--===//
+//
+// 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,128 @@
+//===--===//
+//
+// 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,134 @@
+//===--===//
+//
+// 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,203 @@
+//===--===//
+//
+// 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,134 @@
+//===--===//
+//
+// 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
@@ -11,8 +11,8 @@
///
//===--===//
-#ifndef LLVM_CLANG_CIR_DIALECT_IR_CIROPS
-#define LLVM_CLANG_CIR_DIALECT_IR_CIROPS
+#ifndef CLANG_CIR_DIALECT_IR_CIROPS_TD
andykaylor wrote:
Why is the LL
@@ -0,0 +1,134 @@
+//===--===//
+//
+// 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,134 @@
+//===--===//
+//
+// 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,134 @@
+//===--===//
+//
+// 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,203 @@
+//===--===//
+//
+// 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,203 @@
+//===--===//
+//
+// 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,134 @@
+//===--===//
+//
+// 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/andykaylor edited
https://github.com/llvm/llvm-project/pull/127249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -61,6 +64,13 @@ class CIRGenTypes {
/// Convert a Clang type into a mlir::Type.
mlir::Type convertType(clang::QualType type);
+
+ /// Convert type T into an mlir::Type. This differs from convertType in that
+ /// it is used to convert to the memory representation for
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/127621
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,203 @@
+//===--===//
+//
+// 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,53 @@
+// Simple functions
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o - | FileCheck %s
+
+void empty() { }
+// CHECK: cir.func @empty() -> !cir.void {
andykaylor wrote:
Why aren't the function names mang
https://github.com/andykaylor commented:
This is an improvement. I have a few minor comments.
https://github.com/llvm/llvm-project/pull/127621
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/127249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/127249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
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
@@ -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 closed
https://github.com/llvm/llvm-project/pull/129293
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/129167
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/129293
The previously upstreamed lowering from ClangIR to LLVM IR diverged from the
incubator implementation, but when the incubator was updated to incorporate
these changes some issues arose which require the upst
@@ -57,3 +57,15 @@ bool boolfunc() { return true; }
// CHECK: %0 = cir.const #true
// CHECK: cir.return %0 : !cir.bool
// CHECK: }
+
+float floatfunc() { return 42.42f; }
+// CHECK: cir.func @floatfunc() -> !cir.float {
+// CHECK: %0 = cir.const #cir.fp<4.242000e+01> : !c
@@ -37,63 +37,78 @@ using namespace llvm;
namespace cir {
namespace direct {
-class CIRAttrToValue : public CirAttrVisitor {
+class CIRAttrToValue {
public:
CIRAttrToValue(mlir::Operation *parentOp,
mlir::ConversionPatternRewriter &rewriter,
@@ -218,12 +221,31 @@ mlir::LogicalResult
CIRToLLVMGlobalOpLowering::matchAndRewrite(
SmallVector attributes;
if (init.has_value()) {
-GlobalInitAttrRewriter initRewriter(llvmType, rewriter);
-init = initRewriter.rewriteInitAttr(init.value());
-// If initRewri
@@ -218,12 +221,31 @@ mlir::LogicalResult
CIRToLLVMGlobalOpLowering::matchAndRewrite(
SmallVector attributes;
if (init.has_value()) {
-GlobalInitAttrRewriter initRewriter(llvmType, rewriter);
-init = initRewriter.rewriteInitAttr(init.value());
-// If initRewri
@@ -218,12 +221,31 @@ mlir::LogicalResult
CIRToLLVMGlobalOpLowering::matchAndRewrite(
SmallVector attributes;
if (init.has_value()) {
-GlobalInitAttrRewriter initRewriter(llvmType, rewriter);
-init = initRewriter.rewriteInitAttr(init.value());
-// If initRewri
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/129293
>From bb41af68d0d0f66c5610c69d6deb8a615d644fe5 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 28 Feb 2025 10:54:09 -0800
Subject: [PATCH 1/3] [CIR] Replace CIRAttrVisitor with TypeSwitch
We previously
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/129072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,119 @@
+//===- CIROpsEnumsDialect.h - MLIR Dialect for CIR --*- C++
andykaylor wrote:
Also, the coding guidelines have changed recently, so the filename doesn't need
to be in this line.
```suggestion
//===--
@@ -176,6 +177,18 @@ void CIRGenModule::emitGlobalVarDefinition(const
clang::VarDecl *vd,
}
varOp.setInitialValueAttr(initializer);
}
+
+// Set CIR's linkage type as appropriate.
+cir::GlobalLinkageKind linkage =
+getCIRLinkageVarDefinition(vd,
https://github.com/andykaylor commented:
Can you also update `clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp` to
use the linkage? There are two places marked by
`cir::MissingFeatures::opGlobalLinkage()` that would need to be updated, plus
(hopefully) test changes.
It would also be good t
@@ -36,6 +36,10 @@ struct MissingFeatures {
static bool opGlobalConstant() { return false; }
static bool opGlobalAlignment() { return false; }
static bool opGlobalLinkage() { return false; }
andykaylor wrote:
Can this be removed now?
https://github.com/
@@ -0,0 +1,29 @@
+//===- CIROpInterfaces.h - CIR Op Interfaces *- C++
-*-===//
andykaylor wrote:
```suggestion
//===--===//
```
https://github.com/llvm/llvm-project/pull/129
@@ -0,0 +1,22 @@
+//- CIROpInterfaces.cpp - Interface to AST Attributes ---===//
+//
+// 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: Apache
@@ -0,0 +1,119 @@
+//===- CIROpsEnumsDialect.h - MLIR Dialect for CIR --*- C++
+//-*-===//
+//
+// 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-Iden
@@ -0,0 +1,63 @@
+//===- CIROpInterfaces.td - CIR Op Interface Definitions *- C++
-*-===//
+//
+// 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,322 @@
+//===--===//
+//
+// 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/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
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 created
https://github.com/llvm/llvm-project/pull/130322
GCC, unlike clang, issues a warning when one virtual function is overridden in
a derived class but one or more other virtual functions with the same name and
different signature from a base class are not ove
@@ -46,21 +52,124 @@ void CIRGenFunction::emitAutoVarAlloca(const VarDecl &d) {
address = createTempAlloca(allocaTy, alignment, loc, d.getName());
declare(address.getPointer(), &d, ty, getLoc(d.getSourceRange()), alignment);
+ emission.Addr = address;
setAddrOfLocalVar
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/130164
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
andykaylor wrote:
> Someone better equipped to review cmake should review this, but looks ok to
> me.
I'm not sure who is well-versed in the dark art of cmake. I made this same
change in the incubator, and it's working there, so I'm confident that it works
as intended.
https://github.com/llv
@@ -94,10 +203,59 @@ void CIRGenFunction::emitVarDecl(const VarDecl &d) {
assert(d.hasLocalStorage());
- assert(!cir::MissingFeatures::opAllocaVarDeclContext());
+ CIRGenFunction::VarDeclContext varDeclCtx{*this, &d};
return emitAutoVarDecl(d);
}
+void CIRGenFunctio
@@ -46,21 +52,124 @@ void CIRGenFunction::emitAutoVarAlloca(const VarDecl &d) {
address = createTempAlloca(allocaTy, alignment, loc, d.getName());
declare(address.getPointer(), &d, ty, getLoc(d.getSourceRange()), alignment);
+ emission.Addr = address;
setAddrOfLocalVar
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/129072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/130164
Local variable initialization was previously being ignored. This change adds
support for initialization of scalar variables with constant values and
introduces the constant emitter framework.
>From 69c71043
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/130164
>From 69c7104391ff9b6ae1dbcb6275a3070da4f8dd02 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 4 Mar 2025 10:21:24 -0800
Subject: [PATCH 1/2] [CIR] Emit init of local variables
Local variable initializ
@@ -33,6 +33,14 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("NYI: PPC double-double format for long double");
llvm_unreachable("Unsupported format for long double");
}
+
+ bool isSized(mlir::Type ty) {
+if (mlir::isa(ty))
+ r
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/130322
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
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
@@ -386,7 +405,7 @@ def VoidPtr : Type<
//===--===//
def CIR_AnyType : AnyTypeOf<[
- CIR_VoidType, CIR_BoolType, CIR_IntType, CIR_AnyFloat, CIR_PointerType,
+ CIR_VoidType, CIR_BoolType, CIR_ArrayType, CIR_
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o - 2>&1 | FileCheck %s
andykaylor wrote:
Will multidimensional arrays and array function arguments work at this point?
If so, can you add tests for those?
@@ -33,6 +33,14 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("NYI: PPC double-double format for long double");
llvm_unreachable("Unsupported format for long double");
}
+
+ bool isSized(mlir::Type ty) {
+if (mlir::isa(ty))
+ r
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/130648
The ClangIR CFG has to be flat before it can be lowered to LLVM IR. That is,
there can be no nested regions and all blocks in a region must belong to the
parent region. Currently only cir.scope operations vi
@@ -166,6 +166,9 @@ static LogicalResult checkConstantTypes(mlir::Operation
*op, mlir::Type opType,
return success();
}
+ if (mlir::isa(opType))
andykaylor wrote:
I don't see this in the incubator implementation of this function. Why is this
here?
h
@@ -369,6 +369,22 @@ BoolType::getABIAlignment(const ::mlir::DataLayout
&dataLayout,
return 1;
}
+//===--===//
+// Definitions
+//===--==
andykaylor wrote:
Apparently the code formatting checker won't even let me mention "undef" in a
comment.
https://github.com/llvm/llvm-project/pull/130164
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
@@ -210,6 +223,193 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl
gd,
llvm_unreachable("Invalid argument to CIRGenModule::emitGlobalDefinition");
}
+static bool shouldBeInCOMDAT(CIRGenModule &cgm, const Decl &d) {
+ assert(!cir::MissingFeatures::supportComdat
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/128792
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,29 @@
+//===- CIROpInterfaces.h - CIR Op Interfaces *- C++
-*-===//
+//
+// 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/andykaylor created
https://github.com/llvm/llvm-project/pull/129167
This change adds support for collecting function arguments and storing them in
alloca memory slots.
>From d1fa2629b5786befa8ca8f839cf948df4644d615 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 25 Fe
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/129167
>From d1fa2629b5786befa8ca8f839cf948df4644d615 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 25 Feb 2025 16:52:18 -0800
Subject: [PATCH 1/2] [CIR] Upstream func args alloca handling
This change adds
@@ -234,6 +273,29 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl
gd, cir::FuncOp fn,
return fn;
}
+clang::QualType CIRGenFunction::buildFunctionArgList(clang::GlobalDecl gd,
+ FunctionArgList &args) {
+ con
@@ -149,16 +153,49 @@ mlir::LogicalResult CIRGenFunction::declare(Address addr,
const Decl *var,
void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType,
cir::FuncOp fn, cir::FuncType funcType,
-
@@ -52,6 +52,14 @@ class Address {
elementType);
}
+ Address(mlir::Value pointer, clang::CharUnits alignment)
+ : Address(pointer,
+mlir::cast(pointer.getType()).getPointee(),
andykaylor wrote:
The thing that's being cast is
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public
StmtVisitor {
bool ira = false)
: cgf(cgf), builder(builder), ignoreResultAssign(ira) {}
+
//======//
+ //
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public
StmtVisitor {
}
mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) {
-mlir::Type type = cgf.convertType(e->getType());
+mlir::Type type = convertType(e->getType());
return builder.create(
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s
+
+unsigned char cxxstaticcast_0(unsigned int x) {
+ return static_cast(x);
+}
+
+// CHECK: cir.func @cxxstaticcast_0
+// C
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public
StmtVisitor {
bool ira = false)
: cgf(cgf), builder(builder), ignoreResultAssign(ira) {}
+
//======//
+ //
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public
StmtVisitor {
}
mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) {
-mlir::Type type = cgf.convertType(e->getType());
+mlir::Type type = convertType(e->getType());
return builder.create(
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o %t.cir
andykaylor wrote:
Can you expand this test to cover all the cast types you're adding (or remove
any that can't be supported yet)?
https://github.c
@@ -78,6 +79,67 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return create(loc, val, dst);
}
+
//======//
+ // Cast/Conversion Operators
+
//===--
@@ -13,8 +13,9 @@ void voidret() { return; }
int intfunc() { return 42; }
// CHECK: cir.func @intfunc() -> !cir.int {
-// CHECK: %0 = cir.const #cir.int<42> : !cir.int
-// CHECK: cir.return %0 : !cir.int
+// CHECK: %0 = cir.alloca !cir.int, !cir.ptr>,
["__retval"] {alig
@@ -13,8 +13,9 @@ void voidret() { return; }
int intfunc() { return 42; }
// CHECK: cir.func @intfunc() -> !cir.int {
-// CHECK: %0 = cir.const #cir.int<42> : !cir.int
-// CHECK: cir.return %0 : !cir.int
+// CHECK: %0 = cir.alloca !cir.int, !cir.ptr>,
["__retval"] {alig
@@ -195,7 +195,16 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType
returnType,
mlir::Location fnBodyBegin = getLoc(fd->getBody()->getBeginLoc());
builder.CIRBaseBuilderTy::createStore(fnBodyBegin, paramVal, addrVal);
}
+
assert(builder.getInsertionBlo
@@ -312,4 +326,12 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
}
}
+void CIRGenFunction::emitAndUpdateRetAlloca(QualType ty, mlir::Location loc,
+CharUnits alignment) {
+ if (ty->isVoidType()) {
+return;
+ }
+
--
@@ -1,7 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o %
@@ -0,0 +1,58 @@
+// RUN: cir-opt %s -cir-flatten-cfg -o - | FileCheck %s
+
+module {
+ cir.func @foo() {
+cir.scope {
+ %0 = cir.alloca !cir.int, !cir.ptr>, ["a", init]
{alignment = 4 : i64}
+ %1 = cir.const #cir.int<4> : !cir.int
+ cir.store %1, %0 : !cir.in
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/130869
>From a4e8aa13f97a6c73389822f6fdcf6f5970792462 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 11 Mar 2025 17:01:44 -0700
Subject: [PATCH 1/3] [CIR] Upstream support for emitting ignored statements
Thi
@@ -1,7 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o %
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/130648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -55,10 +55,154 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s,
if (mlir::succeeded(emitSimpleStmt(s, useCurrentScope)))
return mlir::success();
- // Only a subset of simple statements are supported at the moment. When more
- // kinds of statements ar
andykaylor wrote:
> Hello @andykaylor ,
>
> I am working on this pragma operation, with a different scenario. For
> example: https://godbolt.org/z/nTfYW64j4
>
> Is it ok to merge this patch?
As mentioned
[here](https://discourse.llvm.org/t/rfc-honor-pragmas-with-ffp-contract-fast/80797/14),
@@ -0,0 +1,58 @@
+// RUN: cir-opt %s -cir-flatten-cfg -o - | FileCheck %s
+
+module {
+ cir.func @foo() {
+cir.scope {
+ %0 = cir.alloca !cir.int, !cir.ptr>, ["a", init]
{alignment = 4 : i64}
+ %1 = cir.const #cir.int<4> : !cir.int
+ cir.store %1, %0 : !cir.in
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/130502
___
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/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
301 - 400 of 635 matches
Mail list logo