https://github.com/xlauko closed
https://github.com/llvm/llvm-project/pull/127207
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/xlauko created
https://github.com/llvm/llvm-project/pull/127207
None
>From 5ef56ce2cece39467d1eb8526aa23cd89be6442c Mon Sep 17 00:00:00 2001
From: xlauko
Date: Fri, 14 Feb 2025 13:58:53 +0100
Subject: [PATCH] [CIR] Fix extra `;` warning, and replace new with
emplaceBlock (N
@@ -375,11 +409,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -375,11 +409,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/128089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -375,11 +410,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -375,11 +410,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -375,11 +410,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -375,11 +410,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -331,9 +335,38 @@ FuncType FuncType::clone(TypeRange inputs, TypeRange
results) const {
return get(llvm::to_vector(inputs), results[0], isVarArg());
}
-mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p,
-llvm::SmallVector ¶ms,
-
@@ -331,9 +335,38 @@ FuncType FuncType::clone(TypeRange inputs, TypeRange
results) const {
return get(llvm::to_vector(inputs), results[0], isVarArg());
}
-mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p,
-llvm::SmallVector ¶ms,
-
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/128089
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -375,11 +409,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -375,11 +409,48 @@ void printFuncTypeArgs(mlir::AsmPrinter &p,
mlir::ArrayRef params,
p << ')';
}
+// Use a custom parser to handle the optional return and argument types without
+// an optional anchor.
+static mlir::ParseResult parseFuncType(mlir::AsmParser &p,
+
@@ -2,12 +2,12 @@
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o - | FileCheck %s
xlauko wrote:
I presume `clang` cannot load `cir` files yet? So nothing is really testing
parsers?
https://github.com/llvm/llvm-projec
@@ -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<["-"],
@@ -331,9 +335,38 @@ FuncType FuncType::clone(TypeRange inputs, TypeRange
results) const {
return get(llvm::to_vector(inputs), results[0], isVarArg());
}
-mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p,
-llvm::SmallVector ¶ms,
-
@@ -0,0 +1,32 @@
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
+get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
+
+include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
+include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+
+add_clang
@@ -0,0 +1,46 @@
+//===--===//
+//
+// 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/xlauko commented:
LGTM
https://github.com/llvm/llvm-project/pull/128254
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/128254
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -266,6 +266,22 @@ def CIR_PointerType : CIR_Type<"Pointer", "ptr",
}];
}
+//===--===//
+// BoolType
+//===--===//
+
+def CIR_BoolType :
@@ -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/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
xlauko wrote:
You don't need to write custom printer/parser for return type. As suggested
here https://github.com/llvm/clangir/pull/1413
These can be autogenerated from assembly format:
```
let assemblyFormat = [{
`<` custom($inputs, $varArg) (`->` $optionalReturnType^)?
`>`
}];
```
ht
@@ -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 {
xlauko wrote:
Ideally once there will be abi-lib:
h
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/127674
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -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
https://github.com/xlauko approved this pull request.
https://github.com/llvm/llvm-project/pull/127674
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -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
@@ -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,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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,119 @@
+//===--===//
+//-*-===//
xlauko wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/129072
___
cfe-commits mailing l
@@ -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
@@ -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
@@ -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/xlauko commented:
LGTM
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : 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
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -229,6 +236,43 @@ def CastOp : CIR_Op<"cast",
let hasFolder = 1;
}
+
+//===--===//
+// PtrStrideOp
+//===--===//
+
+def PtrStrideOp : CI
@@ -0,0 +1,277 @@
+//===--- 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,277 @@
+//===--- 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,277 @@
+//===--- 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,277 @@
+//===--- 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
xlauko wrote:
LGTM with minor nits
https://github.com/llvm/llvm-project/pull/133017
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -488,6 +364,143 @@ class CIRGenFunction : public CIRGenTypeCache {
LexicalScope *curLexScope = nullptr;
+ /// --
+ /// CIR emit functions
+ /// --
+private:
+ void emitAndUpdateRetAlloca(clang::QualType type, mlir::Location loc
@@ -488,6 +364,143 @@ class CIRGenFunction : public CIRGenTypeCache {
LexicalScope *curLexScope = nullptr;
+ /// --
+ /// CIR emit functions
+ /// --
+private:
+ void emitAndUpdateRetAlloca(clang::QualType type, mlir::Location loc
@@ -488,6 +364,143 @@ class CIRGenFunction : public CIRGenTypeCache {
LexicalScope *curLexScope = nullptr;
+ /// --
+ /// CIR emit functions
+ /// --
+private:
+ void emitAndUpdateRetAlloca(clang::QualType type, mlir::Location loc
https://github.com/xlauko approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/132996
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -826,6 +826,50 @@ def ForOp : CIR_Op<"for", [LoopOpInterface,
NoRegionArguments]> {
}];
}
+//===--===//
+// CmpOp
+//===--===//
+
+def
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond",
}];
}
+//===--===//
+// While & DoWhileOp
+//===--===//
+
+class WhileOpBase : CIR_Op
@@ -539,9 +539,29 @@ Block
*cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) {
}
//===--===//
-// ForOp
+// LoopOpInterface Methods
//===---
https://github.com/xlauko commented:
LGTM!
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
https://github.com/xlauko edited
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
@@ -449,4 +449,50 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
}
}
+void CIRGenFunction::emitNullInitialization(mlir::Location loc, Address
destPtr,
+QualType ty) {
+ // Ignore empty classes in C++.
+ if (getLangOpts().
60 matches
Mail list logo