@@ -57,31 +75,90 @@ class OpenACCClauseCIREmitter final
}
}
+ mlir::acc::DeviceType decodeDeviceType(const IdentifierInfo *II) {
+
andykaylor wrote:
I've been telling people not to put a blank line here because it seemed
inconsistent with the prevaili
@@ -400,13 +400,126 @@ def VoidPtr : Type<
"cir::VoidType::get($_builder.getContext()))"> {
}
+//===--===//
+// StructType
+//
+// The base type for all RecordDecls.
+//===---
@@ -0,0 +1,9 @@
+// RUN: cir-opt %s | FileCheck %s
+
+!s32i = !cir.int
andykaylor wrote:
Oops! That was a copy-paste error.
https://github.com/llvm/llvm-project/pull/135105
___
cfe-commits mailing list
cfe-commits@list
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("Unsupported format for long double");
}
+ /// Get a CIR record kind from a AST declaration tag.
+ cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) {
+
@@ -0,0 +1,116 @@
+//===--===//
+//
+// 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
@@ -86,10 +86,80 @@ mlir::Type
CIRGenTypes::convertFunctionTypeInternal(QualType qft) {
return cir::FuncType::get(SmallVector{}, cgm.VoidTy);
}
+// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable
+// because CIR has different uniquing requiremen
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("Unsupported format for long double");
}
+ /// Get a CIR record kind from a AST declaration tag.
+ cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) {
+
@@ -400,13 +400,126 @@ def VoidPtr : Type<
"cir::VoidType::get($_builder.getContext()))"> {
}
+//===--===//
+// StructType
+//
+// The base type for all RecordDecls.
+//===---
@@ -86,10 +86,80 @@ mlir::Type
CIRGenTypes::convertFunctionTypeInternal(QualType qft) {
return cir::FuncType::get(SmallVector{}, cgm.VoidTy);
}
+// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable
+// because CIR has different uniquing requiremen
@@ -400,13 +400,126 @@ def VoidPtr : Type<
"cir::VoidType::get($_builder.getContext()))"> {
}
+//===--===//
+// StructType
+//
+// The base type for all RecordDecls.
+//===---
@@ -400,13 +400,126 @@ def VoidPtr : Type<
"cir::VoidType::get($_builder.getContext()))"> {
}
+//===--===//
+// StructType
+//
+// The base type for all RecordDecls.
+//===---
@@ -96,18 +173,21 @@ mlir::LogicalResult
CIRGenFunction::emitOpenACCOpAssociatedStmt(
template
mlir::LogicalResult
-CIRGenFunction::emitOpenACCOp(mlir::Location start,
+CIRGenFunction::emitOpenACCOp(OpenACCDirectiveKind dirKind,
+ SourceLocation
https://github.com/andykaylor approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/135102
___
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/133829
The initial upstreaming of unary operations left promoted types unhandled for
the unary plus and minus operators. This change implements support for promoted
types and performs a bit of related code cleanup.
andykaylor wrote:
@mmha
https://github.com/llvm/llvm-project/pull/133829
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
andykaylor wrote:
@mmha
https://github.com/llvm/llvm-project/pull/133815
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -327,4 +337,4 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
} // namespace cir
-#endif
+#endif
andykaylor wrote:
This indicates that you (or some tool you're using) removed the newline
character at the end of the file. It's a good practice to conf
@@ -0,0 +1,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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,274 @@
+//===--- CIRGenExprAgg.cpp - Emit CIR Code from Aggregate Expressions
-===//
+//
+// 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
https://github.com/andykaylor approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/133152
___
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/133157
>From ecaf51cd128e9045b9926ecafc918ec3e35a9908 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Mon, 24 Mar 2025 14:07:34 -0700
Subject: [PATCH 1/2] [CIR] Upstream support for while and do..while loops
This
@@ -710,6 +710,85 @@ class ScalarExprEmitter : public
StmtVisitor {
HANDLEBINOP(Xor)
HANDLEBINOP(Or)
#undef HANDLEBINOP
+
+ mlir::Value emitCmp(const BinaryOperator *e) {
+const mlir::Location loc = cgf.getLoc(e->getExprLoc());
+mlir::Value result;
+QualType l
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/133815
A previous checkin used a workaround to generate the nsw flag where needed for
unary ops. This change upstreams a subsequent change that was made in the
incubator to generate the flag correctly.
>From a96e0
@@ -12,22 +16,307 @@ void b0(int a, int b) {
x = x | b;
}
-// CHECK: %{{.+}} = cir.binop(mul, %{{.+}}, %{{.+}}) nsw : !s32i
-// CHECK: %{{.+}} = cir.binop(div, %{{.+}}, %{{.+}}) : !s32i
-// CHECK: %{{.+}} = cir.binop(rem, %{{.+}}, %{{.+}}) : !s32i
-// CHECK: %{{.+}} = cir.bi
@@ -1138,8 +1138,9 @@ mlir::Value ScalarExprEmitter::emitShl(const BinOpInfo
&ops) {
mlir::isa(ops.lhs.getType()))
cgf.cgm.errorNYI("sanitizers");
- cgf.cgm.errorNYI("shift ops");
- return {};
+ return builder.create(cgf.getLoc(ops.loc),
and
@@ -759,6 +762,46 @@ LogicalResult cir::BinOp::verify() {
return mlir::success();
}
+//===--===//
+// ShiftOp
+//===--===//
+LogicalResult
@@ -110,6 +110,10 @@ class CIRGenFunction : public CIRGenTypeCache {
public:
mlir::Value createDummyValue(mlir::Location loc, clang::QualType qt);
+ void emitAggExpr(const clang::Expr *e, AggValueSlot slot);
andykaylor wrote:
These should be moved to the p
https://github.com/andykaylor commented:
Can you also add a test for lowering to LLVM IR?
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-commi
@@ -121,29 +364,173 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr
*e) {
return ScalarExprEmitter(*this, builder).Visit(const_cast(e));
}
+[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) {
+ // If a null pointer expression's type is the C++0x nullp
@@ -568,6 +568,128 @@ mlir::LogicalResult
CIRToLLVMGlobalOpLowering::matchAndRewrite(
return mlir::success();
}
+mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite(
+cir::UnaryOp op, OpAdaptor adaptor,
+mlir::ConversionPatternRewriter &rewriter) const {
+
@@ -0,0 +1,79 @@
+// 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
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br",
}];
}
+//===--===//
+// UnaryOp
+//===--===//
+
+def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br",
}];
}
+//===--===//
+// UnaryOp
+//===--===//
+
+def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"
@@ -92,6 +92,222 @@ class ScalarExprEmitter : public
StmtVisitor {
mlir::Value VisitCastExpr(CastExpr *E);
+ // Unary Operators.
+ mlir::Value VisitUnaryPostDec(const UnaryOperator *e) {
+LValue lv = cgf.emitLValue(e->getSubExpr());
+return emitScalarPrePostIncDe
@@ -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:
It looks like floating casts are still missing. Can you add float-to-double and
double-to-float test?
https://github.com/llvm/ll
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/134889
The handling for NullStmt was going to an error saying the statement handling
wasn't implemented. It doesn't need any implementation. It is sufficient for
emitSimpleStmt to just return success for that state
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134889
>From efbec15d42a83cd2f4980418a939a88af7c7b92a Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Tue, 8 Apr 2025 10:01:21 -0700
Subject: [PATCH 1/2] [CIR] Handle NullStmt
The handling for NullStmt was going t
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,152 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,152 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/134889
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -27,7 +27,8 @@ using namespace cir;
/// Given an expression of pointer type, try to
/// derive a more accurate bound on the alignment of the pointer.
-Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr) {
+Address CIRGenFunction::emitPointerWithAlignment(cons
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs,
mlir::Location rhs) {
return mlir::FusedLoc::get(locs, metadata, &getMLIRContext());
}
+bool CIRGenFunction::containsLabel(const Stmt *s, bool ignoreCaseStmts) {
+ // Null statement, not a label
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/134317
___
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/134333
___
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/135284
___
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/135105
>From 80fa219739a4a6424ec55047fecb41f04d3cf844 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Wed, 9 Apr 2025 12:45:57 -0700
Subject: [PATCH 1/3] [CIR] Upstream minimal support for structure types
This cha
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("Unsupported format for long double");
}
+ /// Get a CIR record kind from a AST declaration tag.
+ cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) {
+
andykaylor wrote:
I'm going to make the change to rename `cir.struct` to `cir.record` separately,
since that's a bigger change and I'm still waiting for input from
@bcardosolopes. Everything else has been addressed, I think.
https://github.com/llvm/llvm-project/pull/135105
@@ -0,0 +1,116 @@
+//===--===//
+//
+// 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
@@ -86,10 +86,64 @@ mlir::Type
CIRGenTypes::convertFunctionTypeInternal(QualType qft) {
return cir::FuncType::get(SmallVector{}, cgm.VoidTy);
}
+// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable
+// because CIR has different uniquing requiremen
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/135105
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,116 @@
+//===--===//
+//
+// 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 approved this pull request.
To clarify I wasn't saying that the LLVM checks and OGCG checks needed to use
the same patterns/names (though it's nice that they do now). The important
thing was not to have the value identifiers hard-corded in the checks.
Thanks for t
@@ -0,0 +1,116 @@
+//===--===//
+//
+// 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
@@ -400,13 +400,126 @@ def VoidPtr : Type<
"cir::VoidType::get($_builder.getContext()))"> {
}
+//===--===//
+// StructType
+//
+// The base type for all RecordDecls.
+//===---
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/135105
>From 80fa219739a4a6424ec55047fecb41f04d3cf844 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Wed, 9 Apr 2025 12:45:57 -0700
Subject: [PATCH 1/5] [CIR] Upstream minimal support for structure types
This cha
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/135427
___
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/135105
>From 3b19527073c656b631a990397a00030487b3f595 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Wed, 9 Apr 2025 12:45:57 -0700
Subject: [PATCH 1/5] [CIR] Upstream minimal support for structure types
This cha
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/135105
>From 3b19527073c656b631a990397a00030487b3f595 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Wed, 9 Apr 2025 12:45:57 -0700
Subject: [PATCH 1/6] [CIR] Upstream minimal support for structure types
This cha
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs,
mlir::Location rhs) {
return mlir::FusedLoc::get(locs, metadata, &getMLIRContext());
}
+bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) {
+ // Null statement, not a label
@@ -0,0 +1,49 @@
+// RUN %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown \
+// RUN -verify -complex-range=promoted -o - | FileCheck %s
+
+// RUN %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown \
+// RUN -verify=nopromotion -complex-range=promoted -target-fe
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/133134
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -514,9 +515,17 @@ mlir::LogicalResult
CIRToLLVMCastOpLowering::matchAndRewrite(
assert(!MissingFeatures::cxxABI());
assert(!MissingFeatures::dataMemberType());
break;
- case cir::CastKind::ptr_to_bool:
-assert(!cir::MissingFeatures::opCmp());
+ case cir::C
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/134159
The ClangIR upstreaming project needs the same logic for
hasBooleanRepresentation() that is currently implemented in the standard clang
codegen. In order to share this code, this change moves the implementat
@@ -280,3 +313,77 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const
ReturnStmt &s) {
return mlir::success();
}
+
+mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) {
+ cir::ForOp forOp;
+
+ // TODO: pass in an array of attributes.
+ auto forStmt
andykaylor wrote:
@mmha
https://github.com/llvm/llvm-project/pull/134333
___
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/133815
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -193,8 +334,23 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
switch (op) {
case UO_Deref: {
-cgm.errorNYI(e->getSourceRange(), "UnaryOp dereference");
-return LValue();
+QualType t = e->getSubExpr()->getType()->getPointeeType();
+
@@ -25,6 +25,147 @@ using namespace clang;
using namespace clang::CIRGen;
using namespace cir;
+/// Given an expression of pointer type, try to
+/// derive a more accurate bound on the alignment of the pointer.
+Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/132266
This change adds support for empty for-loops. This will be the infrastructre
needed for complete for loops, but that depends on compare operations, which
have not been upstreamed yet.
>From 20c016291947451b
@@ -0,0 +1,81 @@
+//===--===//
+//
+// 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: Apac
https://github.com/andykaylor approved this pull request.
This looks ready.
https://github.com/llvm/llvm-project/pull/132974
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -110,6 +110,8 @@ class CIRGenFunction : public CIRGenTypeCache {
public:
mlir::Value createDummyValue(mlir::Location loc, clang::QualType qt);
+ void emitNullInitialization(mlir::Location loc, Address destPtr, QualType
ty);
andykaylor wrote:
The two em
@@ -1358,6 +1360,33 @@ mlir::Value
CIRGenFunction::emitScalarConversion(mlir::Value src,
.emitScalarConversion(src, srcTy, dstTy, loc);
}
+mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) {
+ // Perform vector logical not on comparison with zero ve
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/134317
This adds support for handling the address of and dereference unary operations
in ClangIR code generation. This also adds handling for nullptr and proper
initialization via the NullToPointer cast.
>From d13
andykaylor wrote:
@mmha
https://github.com/llvm/llvm-project/pull/134317
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1320,7 +1322,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr
*ce) {
"fixed point casts");
return {};
}
-cgf.getCIRGenModule().errorNYI(subExpr->getSourceRange(), "fp options");
+assert(!cir::MissingFeatures:
@@ -1358,6 +1360,33 @@ mlir::Value
CIRGenFunction::emitScalarConversion(mlir::Value src,
.emitScalarConversion(src, srcTy, dstTy, loc);
}
+mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) {
+ // Perform vector logical not on comparison with zero ve
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134181
>From 54454e4d52570f29c493c41fc9bf95cbaf9e0886 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 21 Mar 2025 09:46:27 -0700
Subject: [PATCH 1/3] [CIR] Upstream support for break and continue statements
T
andykaylor wrote:
I'm starting to be uncomfortable with the amount of alignment and
LValueBaseInfo support we've skipped over. I tried to add markers in this PR
where I wasn't adding support for those. I intend to fill in that support in a
separate PR soon.
https://github.com/llvm/llvm-projec
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134181
>From 54454e4d52570f29c493c41fc9bf95cbaf9e0886 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 21 Mar 2025 09:46:27 -0700
Subject: [PATCH 1/2] [CIR] Upstream support for break and continue statements
T
https://github.com/andykaylor approved this pull request.
Looks good. Thanks for the updates!
https://github.com/llvm/llvm-project/pull/131657
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
@@ -710,6 +710,89 @@ class ScalarExprEmitter : public
StmtVisitor {
HANDLEBINOP(Xor)
HANDLEBINOP(Or)
#undef HANDLEBINOP
+
+ mlir::Value emitCmp(const BinaryOperator *e) {
+mlir::Value result;
+QualType lhsTy = e->getLHS()->getType();
+QualType rhsTy = e->getRH
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return createCast(loc, cir::CastKind::bitcast, src, newTy);
}
+ mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind,
+ const llvm::APInt &rhs) {
+return create(
@@ -462,6 +462,58 @@ def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp",
"ScopeOp", "DoWhileOp",
let hasVerifier = 1;
}
+//===--===//
+// IfOp
+//===-
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
@@ -164,6 +165,20 @@ class CIRGenFunction : public CIRGenTypeCache {
/// that it requires no code to be generated.
bool isTrivialInitializer(const Expr *init);
+ /// If the specified expression does not fold to a constant, or if it does
but
+ /// contains a label, retur
@@ -316,6 +316,106 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) {
emitLValue(e);
}
+/// Emit an `if` on a boolean condition, filling `then` and `else` into
+/// appropriated regions.
+mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr(const Expr *cond,
+
601 - 700 of 1014 matches
Mail list logo