[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread David Olsen via 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 &getContext() { return *mlirCont

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-22 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: I like the idea of changing the assembly format for function types from `!cir.func` to `!cir.func<(!argType) -> !returnType>`. That is 1. Easier to parse. 2. Consistent with function types in other MLIR dialects. 3. Consistent with the assembly format for function definition

[clang] [CIR] Upstream type `bool` (PR #128601)

2025-02-24 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/128601 Support the type `bool` and the literals `true` and `false`. Add the type `cir::BoolType` and the attribute `cir::BoolAttr` to ClangIR. Add code in all the necessary places in ClangIR CodeGen to handle and

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-24 Thread David Olsen via cfe-commits
@@ -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, -

[clang] [CIR] Upstream simple function bodies (PR #127674)

2025-02-19 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/127674 >From c0f10395ec6bff05bdb9eb04ed2c1f349c647d50 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Tue, 18 Feb 2025 09:41:35 -0800 Subject: [PATCH 1/2] [CIR] Upstream simple function bodies Enable ClangIR gene

[clang] [CIR] Upstream simple function bodies (PR #127674)

2025-02-19 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed 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

[clang] [CIR] Function type return type improvements (PR #128787)

2025-02-26 Thread David Olsen via cfe-commits
@@ -424,6 +424,10 @@ LogicalResult cir::FuncOp::verifyType() { if (!isa(type)) return emitOpError("requires '" + getFunctionTypeAttrName().str() + "' attribute of function type"); + if (auto rt = type.getReturnTypes(); dkolsen-pgi

[clang] [CIR] Function type return type improvements (PR #128787)

2025-02-26 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/128787 >From 3e396ab2f69d0dcf98605179f69411f04da68f49 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Tue, 25 Feb 2025 15:21:30 -0800 Subject: [PATCH 1/2] [CIR] Function type return type improvements When a C or

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-26 Thread David Olsen via cfe-commits
@@ -0,0 +1,82 @@ +//===--===// +// +// 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

[clang] [CIR] Function type return type improvements (PR #128787)

2025-02-26 Thread David Olsen via cfe-commits
@@ -424,6 +424,10 @@ LogicalResult cir::FuncOp::verifyType() { if (!isa(type)) return emitOpError("requires '" + getFunctionTypeAttrName().str() + "' attribute of function type"); + if (auto rt = type.getReturnTypes(); dkolsen-pgi

[clang] [CIR] Function type return type improvements (PR #128787)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/128787 When a C or C++ function has a return type of `void`, the function type is now represented in MLIR as having no return type rather than having a return type of `!cir.void`. This avoids breaking MLIR invari

[clang] [CIR] Function type return type improvements (PR #128787)

2025-02-25 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: This combines https://github.com/llvm/clangir/pull/1249 (fix handling of void return) and https://github.com/llvm/clangir/pull/1391(trailing return type) into a single upstream PR. https://github.com/llvm/llvm-project/pull/128787

[clang] [CIR] React to breaking change to DataLayoutTypeInterface (PR #128772)

2025-02-25 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: I am merging this now because it fixes a build breakage. If I messed up, it is easy enough to undo. https://github.com/llvm/llvm-project/pull/128772 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [CIR] React to breaking change to DataLayoutTypeInterface (PR #128772)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/128772 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] React to breaking change to DataLayoutTypeInterface (PR #128772)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/128772 In #128754, `DataLayoutTypeInterface` was changed to give `getPreferredAlignment` a default implemention. As a result, table-gen no longer declared `getPreferredAlignment` when defining a class that contai

[clang] [CIR] React to breaking change to DataLayoutTypeInterface (PR #128772)

2025-02-25 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: @bcardosolopes @lanza You will run into this same problem with the next incubator rebase. The fix should be the same, though there will be more `getPreferredAlignment` functions to delete. https://github.com/llvm/llvm-project/pull/128772 __

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed 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

[clang] [CIR] Upstream type `bool` (PR #128601)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/128601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-25 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: Abandoning this PR. I will redo it soon with the new assembly format for function types. https://github.com/llvm/llvm-project/pull/128089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [CIR] Upstream type `bool` (PR #128601)

2025-02-25 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/128601 >From bbadebdf7444ed453721f064e4e30ac2917c5fe9 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Mon, 24 Feb 2025 15:50:19 -0800 Subject: [PATCH 1/2] [CIR] Upstream type `bool` Support the type `bool` and th

[clang] [CIR] Upstream type `bool` (PR #128601)

2025-02-25 Thread David Olsen via cfe-commits
@@ -266,6 +266,22 @@ def CIR_PointerType : CIR_Type<"Pointer", "ptr", }]; } +//===--===// +// BoolType +//===--===// + +def CIR_BoolType :

<    1   2