[clang] [CIR] Add .clang-tidy files for ClangIR specific coding style rules (PR #111417)

2024-10-07 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi approved this pull request. I am not familiar with how clang-tidy works. (I expect that will have to change and I should start using it.) So I can't meaningfully review this. https://github.com/llvm/llvm-project/pull/111417 _

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-04 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-04 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-05 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/113483 >From fd38921f9899e3e5ae538a94f123433119919731 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 23 Oct 2024 11:01:40 -0700 Subject: [PATCH 1/5] [CIR] Call code gen; create empty cir.func op Finish hook

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-05 Thread David Olsen via cfe-commits
@@ -52,10 +62,33 @@ class CIRGenModule : public CIRGenTypeCache { /// A "module" matches a c/cpp source file: containing a list of functions. mlir::ModuleOp theModule; + clang::DiagnosticsEngine &diags; + const clang::TargetInfo ⌖ public: + mlir::ModuleOp getModule

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/113483 >From fd38921f9899e3e5ae538a94f123433119919731 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 23 Oct 2024 11:01:40 -0700 Subject: [PATCH 1/2] [CIR] Call code gen; create empty cir.func op Finish hook

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -0,0 +1,38 @@ +//===- CIRAttrs.cpp - MLIR CIR 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: Apa

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/113483 >From fd38921f9899e3e5ae538a94f123433119919731 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 23 Oct 2024 11:01:40 -0700 Subject: [PATCH 1/2] [CIR] Call code gen; create empty cir.func op Finish hook

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi ready_for_review https://github.com/llvm/llvm-project/pull/113483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: > Is it at all possible to write a test to exercise the new functionality, Yes, The change that I just committed includes updating the existing test to verify that a `cir.func` op is generated correctly. https://github.com/llvm/llvm-project/pull/113483 _

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -53,6 +53,7 @@ class CIRGenerator : public clang::ASTConsumer { ~CIRGenerator() override; void Initialize(clang::ASTContext &astCtx) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; + mlir::ModuleOp getModule(); dkolsen-pgi wrote

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -52,10 +62,33 @@ class CIRGenModule : public CIRGenTypeCache { /// A "module" matches a c/cpp source file: containing a list of functions. mlir::ModuleOp theModule; + clang::DiagnosticsEngine &diags; + const clang::TargetInfo ⌖ public: + mlir::ModuleOp getModule

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -31,9 +34,14 @@ void CIRGenerator::Initialize(ASTContext &astCtx) { this->astCtx = &astCtx; - cgm = std::make_unique(*mlirCtx, astCtx, codeGenOpts, diags); + mlirCtx = std::make_unique(); + mlirCtx->getOrLoadDialect(); dkolsen-pgi wrote: Fixed. Chan

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/113483 >From fd38921f9899e3e5ae538a94f123433119919731 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 23 Oct 2024 11:01:40 -0700 Subject: [PATCH 1/4] [CIR] Call code gen; create empty cir.func op Finish hook

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -53,6 +53,7 @@ class CIRGenerator : public clang::ASTConsumer { ~CIRGenerator() override; void Initialize(clang::ASTContext &astCtx) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; + mlir::ModuleOp getModule(); dkolsen-pgi wrote

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-11-01 Thread David Olsen via cfe-commits
@@ -24,9 +27,135 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-23 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi converted_to_draft https://github.com/llvm/llvm-project/pull/113483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-28 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: > Is it at all possible to write a test to exercise the new functionality, Yes, I am planning to write a CIR code gen test as part of this PR, to verify that a `cir.func` op is created. But there is some broken or missing functionality that I need to fix first before I can

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-23 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/113483 Finish hooking up ClangIR code gen into the Clang control flow, initializing enough that basic code gen is possible. Add an almost empty `cir.func` op to the ClangIR dialect. Currently the only property o

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-23 Thread David Olsen via cfe-commits
@@ -16,4 +16,50 @@ include "clang/CIR/Dialect/IR/CIRDialect.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" +include "mlir/Interfaces/FunctionInterfaces.td" +include "mlir/Interfaces/InferTypeOpInterface.td" +include "mlir/Interfaces/LoopLikeInterface.td" +include "ml

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-23 Thread David Olsen via cfe-commits
@@ -16,4 +16,50 @@ include "clang/CIR/Dialect/IR/CIRDialect.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" +include "mlir/Interfaces/FunctionInterfaces.td" +include "mlir/Interfaces/InferTypeOpInterface.td" +include "mlir/Interfaces/LoopLikeInterface.td" +include "ml

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -10,4 +10,57 @@ // //===--===// -#include +#include "clang/CIR/Dialect/IR/CIRDialect.h" + +#include "mlir/Support/LogicalResult.h" + +#include "clang/CIR/Dialect/IR/CIROpsDialect.cpp.inc"

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -16,4 +16,87 @@ include "clang/CIR/Dialect/IR/CIRDialect.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" +include "mlir/Interfaces/FunctionInterfaces.td" +include "mlir/Interfaces/InferTypeOpInterface.td" +include "mlir/Interfaces/LoopLikeInterface.td" +include "ml

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: > Does https://mlir.llvm.org/docs/Dialects/Builtin/#fusedloc suit the situation > [of recording locations of macro expansions]? Maybe? Right now I think `FusedLoc` is used by ClangIR to represent a source range. Maybe it also could be used for macro expansion locations. I

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -10,4 +10,57 @@ // //===--===// -#include +#include "clang/CIR/Dialect/IR/CIRDialect.h" + +#include "mlir/Support/LogicalResult.h" + +#include "clang/CIR/Dialect/IR/CIROpsDialect.cpp.inc"

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/113483 >From fd38921f9899e3e5ae538a94f123433119919731 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 23 Oct 2024 11:01:40 -0700 Subject: [PATCH 1/3] [CIR] Call code gen; create empty cir.func op Finish hook

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -13,4 +13,22 @@ #ifndef LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H #define LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H +#include "mlir/IR/Builders.h" dkolsen-pgi wrote: `git clang-format` will alphabetize a block of includes that are not separated by blank lines.

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -13,4 +13,22 @@ #ifndef LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H #define LLVM_CLANG_CIR_DIALECT_IR_CIRDIALECT_H +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h"

[clang] [CIR] Call code gen; create empty cir.func op (PR #113483)

2024-10-31 Thread David Olsen via cfe-commits
@@ -24,9 +27,140 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, const clang::CodeGenOptions &cgo, DiagnosticsEngine &diags) -: astCtx(astctx), langOpts(ast

[clang] [CIR] Fix warning in CIRGenAction.cpp (PR #118389)

2024-12-02 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/118389 Fix a compiler warning in `CIRGenConsumer::HandleTranslationUnit` in `clang/lib/CIR/FrontendAction/CIRGenAction.cpp`. The warning was about a `default:` section in a switch statement that already covered a

[clang] [CIR] Fix warning in CIRGenAction.cpp (PR #118389)

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

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-04 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/118743 Add integral types to ClangIR. These are the first ClangIR types, so the change includes some infrastructure for managing ClangIR types. So that the integral types can be used somewhere, generate ClangIR f

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/118743 >From 3f911a452599d6b92218db2e12059ee8613a12bc Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 4 Dec 2024 21:32:52 -0800 Subject: [PATCH 1/2] [CIR] Integral types; simple global variables Add integral

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -0,0 +1,27 @@ +//===- CIRTypes.h - MLIR CIR Types --*- C++ -*-===// dkolsen-pgi wrote: Done. https://github.com/llvm/llvm-project/pull/118743 ___ cfe-commits mailing list cfe-commits@li

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -85,14 +115,15 @@ class CIR_Op traits = []> : def FuncOp : CIR_Op<"func"> { let summary = "Declare or define a function"; let description = [{ -... lots of text to be added later ... +THe `cir.func` operation defines a function, similar to the `mlir::FuncOp`

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/118743 >From 3f911a452599d6b92218db2e12059ee8613a12bc Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 4 Dec 2024 21:32:52 -0800 Subject: [PATCH 1/3] [CIR] Integral types; simple global variables Add integral

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -74,6 +75,32 @@ class LLVMLoweringInfo { class CIR_Op traits = []> : Op, LLVMLoweringInfo; +//===--===// +// GlobalOp +//===--===// +

[clang] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-09 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: @lanza or @bcardosolopes : Could one of you please review and (hopefully) approve this PR? Erich has delegated approval to you for this one. https://github.com/llvm/llvm-project/pull/119037 ___ cfe-commits mailing list cfe-commits@

[clang] [CIR] Upstream initial attribute support (PR #121069)

2024-12-28 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/121069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial attribute support (PR #121069)

2024-12-26 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/121069 >From f81f3d0b52ee343eb26eb00f42de97f8792e9172 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Tue, 24 Dec 2024 13:16:32 -0800 Subject: [PATCH 1/2] [CIR] Upstream initial attribute support Upstream several

[clang] [CIR] Upstream initial attribute support (PR #121069)

2024-12-26 Thread David Olsen via cfe-commits
@@ -26,6 +30,13 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { cir::PointerType getVoidPtrTy() { return getPointerTo(cir::VoidType::get(getContext())); } + + mlir::TypedAttr getConstPtrAttr(mlir::Type t, int64_t v) { dkolsen-pgi wrote: Done. I

[clang] [CIR] Upstream initial attribute support (PR #121069)

2024-12-26 Thread David Olsen via cfe-commits
@@ -21,18 +39,160 @@ using namespace cir; Attribute CIRDialect::parseAttribute(DialectAsmParser &parser, Type type) const { - // No attributes yet to parse - return Attribute{}; + llvm::SMLoc typeLoc = parser.getCurrentLocation(); + llv

[clang] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-09 Thread David Olsen via cfe-commits
@@ -0,0 +1,25 @@ +//===--===// +// +// 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] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-09 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/119037 >From adc46522a895e088b6af0d229b310d455d6d6ee7 Mon Sep 17 00:00:00 2001 From: David Olsen Date: Fri, 6 Dec 2024 13:41:44 -0800 Subject: [PATCH 1/2] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR typ

[clang] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-10 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/119037 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Cleanup: mlirContext and astContext (PR #119450)

2024-12-10 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/119450 ClangIR CodeGen code uses both `mlir::MLIRContext` and `clang::ASTContext` objects extensively. Refering to either of those as just "context" can be confusing. Change the names of all variables, parameter

[clang] [CIR] Cleanup: mlirContext and astContext (PR #119450)

2024-12-10 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/119450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/120484 Upstream ClangIR support for `void` type, floating-point types, pointer types, and function types. Floating-point support is missing the IBM double-double format, because that hasn't been implemented in th

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -129,4 +130,224 @@ def PrimitiveInt : AnyTypeOf<[UInt8, UInt16, UInt32, UInt64, SInt8, SInt16, SInt32, SInt64], "primitive int", "::cir::IntType">; +//===--===// +// FloatType +//===

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/120484 >From b76111ab93253a772156992e70acb5c78511a6bf Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 18 Dec 2024 13:52:58 -0800 Subject: [PATCH 1/2] [CIR] floating-point, pointer, and function types Upstrea

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -18,6 +21,87 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *builder.getContext(); } +/// Return true if the specified type in a function parameter or result position +/// can be converted to a CIR type at this point. This boils down to being +/// whe

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -0,0 +1,52 @@ +//===- CIRFPTypeInterface.td - CIR FP Interface Definitions -*- C++ -*-===// dkolsen-pgi wrote: Done. `CIRFPTypeInterface.cpp` had the same issue, which I fixed in a soon-to-be-commited change. I don't plan to make this change in any exi

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -129,4 +130,224 @@ def PrimitiveInt : AnyTypeOf<[UInt8, UInt16, UInt32, UInt64, SInt8, SInt16, SInt32, SInt64], "primitive int", "::cir::IntType">; +//===--===// +// FloatType +//===

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -0,0 +1,52 @@ +//===- CIRFPTypeInterface.td - CIR FP Interface Definitions -*- C++ -*-===// dkolsen-pgi wrote: You're right. The updated guidelines say that this line doesn't need to contain any useful information. I'll remove it. https://github.com/

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -18,6 +21,87 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *builder.getContext(); } +/// Return true if the specified type in a function parameter or result position +/// can be converted to a CIR type at this point. This boils down to being +/// whe

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread David Olsen via cfe-commits
@@ -133,6 +143,276 @@ IntType::verify(llvm::function_ref emitError, return mlir::success(); } +//===--===// +// Floating-point type definitions +//===

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
@@ -18,6 +21,87 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *builder.getContext(); } +/// Return true if the specified type in a function parameter or result position +/// can be converted to a CIR type at this point. This boils down to being +/// whe

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
@@ -133,6 +143,276 @@ IntType::verify(llvm::function_ref emitError, return mlir::success(); } +//===--===// +// Floating-point type definitions +//===

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
@@ -63,13 +153,71 @@ mlir::Type CIRGenTypes::convertType(QualType type) { cir::IntType::get(&getMLIRContext(), astContext.getTypeSize(ty), /*isSigned=*/false); break; + +// Floating-point types +case BuiltinType::Float16: +

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
@@ -18,6 +21,87 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *builder.getContext(); } +/// Return true if the specified type in a function parameter or result position +/// can be converted to a CIR type at this point. This boils down to being +/// whe

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/120484 >From b76111ab93253a772156992e70acb5c78511a6bf Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 18 Dec 2024 13:52:58 -0800 Subject: [PATCH 1/3] [CIR] floating-point, pointer, and function types Upstrea

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-19 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: @keryell : > Are you up-streaming the changes in commit order or are you up-streaming the > changes with the latest version of a feature? Upstreaming is happening in logical chunks, using the latest version of the feature. I am paying no attention to the order of commits in

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-20 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi updated https://github.com/llvm/llvm-project/pull/120484 >From b76111ab93253a772156992e70acb5c78511a6bf Mon Sep 17 00:00:00 2001 From: David Olsen Date: Wed, 18 Dec 2024 13:52:58 -0800 Subject: [PATCH 1/4] [CIR] floating-point, pointer, and function types Upstrea

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-20 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/120484 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-06 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/119037 Small infrastructure and background changes to ClangIR. Create class `CIRGenBuilderTy` and its base class `CIRBaseBuilderTy`. These are mostly empty for now, except for what is inherited from `mlir::OpBuild

[clang] [CIR] Infrastructure: class CIRGenBuilderTy; cache CIR types (PR #119037)

2024-12-06 Thread David Olsen via cfe-commits
@@ -9,22 +9,32 @@ using namespace clang; using namespace clang::CIRGen; CIRGenTypes::CIRGenTypes(CIRGenModule &genModule) -: cgm(genModule), context(genModule.getASTContext()) {} +: cgm(genModule), context(genModule.getASTContext()), + builder(cgm.getBuilder()) {}

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -72,9 +63,15 @@ mlir::Type CIRGenTypes::convertType(QualType type) { } case Type::BitInt: { const auto *bitIntTy = cast(type); -resultType = -cir::IntType::get(cgm.getBuilder().getContext(), bitIntTy->getNumBits(), - bitIntTy->is

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -82,6 +83,14 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd, theModule.push_back(funcOp); } +void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd, + bool isTentative) { + mlir::Type type =

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -0,0 +1,132 @@ +//===- CIRTypes.td - CIR dialect types -*- tablegen -*-===// +// +// 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

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -0,0 +1,90 @@ +#include "CIRGenTypes.h" + +#include "CIRGenModule.h" + +#include "clang/AST/ASTContext.h" +#include "clang/AST/Type.h" + +using namespace clang; +using namespace clang::CIRGen; + +CIRGenTypes::CIRGenTypes(CIRGenModule &genModule) +: cgm(genModule), context(g

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-05 Thread David Olsen via cfe-commits
@@ -0,0 +1,130 @@ +//===- CIRTypes.td - CIR dialect types -*- tablegen -*-===// +// +// 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

[clang] [CIR] Integral types; simple global variables (PR #118743)

2024-12-06 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi closed https://github.com/llvm/llvm-project/pull/118743 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial attribute support (PR #121069)

2024-12-24 Thread David Olsen via cfe-commits
https://github.com/dkolsen-pgi created https://github.com/llvm/llvm-project/pull/121069 Upstream several ClangIR-specific MLIR attributes, in particular attributes for integer, floating-point, and null pointer constants. These are the first ClangIR attributes to be upstreamed, so infrastructur

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

2025-02-19 Thread David Olsen via cfe-commits
@@ -224,3 +225,19 @@ mlir::Type CIRGenTypes::convertType(QualType type) { typeCache[ty] = resultType; return resultType; } + +mlir::Type CIRGenTypes::convertTypeForMem(clang::QualType qualType, + bool forBitField) { + assert(!qualTy

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

2025-02-19 Thread David Olsen via 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

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

2025-02-19 Thread David Olsen via 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

[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 __

  1   2   >