aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
AgeCommit message (Collapse)AuthorFilesLines
7 days[CIR] Implement static lambda invoker (#160137)Andy Kaylor1-1/+4
This adds support for handling static lambda invokers.
8 days[CIR] Add support for lambda expressions (#157751)Andy Kaylor1-1/+31
This adds support for lambda operators and lambda calls. This does not include support for static lambda invoke, which will be added in a later change.
2025-09-09[CIR] Add support for copy elision (#157713)Andy Kaylor1-2/+4
This adds basic support for eliding copy constructors. In order to make this possible, it also adds support for returning structures. This support does not include setting an NRVO flag when the class whose copy is being elided has a non-trivial destructor.
2025-09-09[CIR][NFC] Fix build warnings after #154142 (#157724)Andy Kaylor1-0/+2
A recent change introduced a new dtor kind, which caused a build warning in the CIR code where this dtor kind wasn't handled in a switch. This fixes the problem.
2025-09-03[CIR] Add support for constructors with VTT parameters (#156521)Andy Kaylor1-1/+1
This adds the support for implicit VTT arguments in constructors.
2025-08-25[clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313)Matheus Izvekov1-14/+5
This changes a bunch of places which use getAs<TagType>, including derived types, just to obtain the tag definition. This is preparation for #155028, offloading all the changes that PR used to introduce which don't depend on any new helpers.
2025-08-19[CIR] Implement Statement Expressions (#153677)Morris Hafner1-6/+2
Depends on #153625 This patch adds support for statement expressions. It also changes emitCompoundStmt and emitCompoundStmtWithoutScope to accept an Address that the optional result is written to. This allows the creation of the alloca ahead of the creation of the scope which saves us from hoisting the alloca to its parent scope.
2025-08-19[CIR] Upstream __builtin_va_start and __builtin_va_end (#153819)Morris Hafner1-0/+6
Part of #153286
2025-08-14[CIR][NFC] Add Symbol Table to CIRGenFunction (#153625)Morris Hafner1-1/+8
This patchs adds a symbol table to CIRGenFunction plus scopes and insertions to the table where we were missing them previously.
2025-08-11[CIR] Make ClangIR compatible with latest nested name specifier AST ↵Amr Hesham1-2/+2
representation (#152846) After AST representation, new modifications landed in (https://github.com/llvm/llvm-project/pull/147835). ClangIR requires some changes in how we use Clang AST to be compatible with the new changes
2025-08-10[CIR] Add support for __builtin_assume_aligned (#152152)Sirui Mu1-0/+17
This patch upstreams CIRGen and LLVM lowering support for the `__builtin_assume_aligned` builtin function.
2025-08-09[CIR] Fix build after the improved nested name specifier AST repr (91cdd35008e9)Michael Liao1-6/+5
2025-08-07[CIR] Upstream EHScopeStack memory allocator (#152215)Andy Kaylor1-4/+4
When the cleanup handling code was initially upstreamed, a SmallVector was used to simplify the handling of the stack of cleanup objects. However, that mechanism won't scale well enough for the rate at which cleanup handlers are going to be pushed and popped while compiling a large program. This change introduces the custom memory allocator which is used in classic codegen and the CIR incubator. Thiis does not otherwise change the cleanup handling implementation and many parts of the infrastructure are still missing. This is not intended to have any observable effect on the generated CIR, but it does change the internal implementation significantly, so it's not exactly an NFC change. The functionality is covered by existing tests.
2025-08-06[CIR] Plus & Minus CompoundAssignment support for ComplexType (#150759)Amr Hesham1-3/+2
This change adds support for Plus & Minus CompoundAssignment for ComplexType https://github.com/llvm/llvm-project/issues/141365
2025-08-05[CIR] Add CIRGen for cir.unreachable and cir.trap (#151363)Sirui Mu1-0/+1
2025-08-02[CIR] Use getDefiningOp<OpTy>() instead of dyn_cast<OpTy>(getDefiningOp()) ↵Henrich Lauko1-1/+3
(NFC) (#151217) This applies similar changes to llvm/llvm-project#150428
2025-08-01[CIR] Handle expression with cleanups (#151600)Andy Kaylor1-0/+6
This adds code to handle expressions with cleanup, including materializing a temporary object for the expression.
2025-07-31[CIR] Fix warnings related to unused variables in release builds (#151412)Andy Kaylor1-2/+1
This fixes a number of warnings in release builds due to variables that were only being used in asserts. Some of these variables will later be used in non-debug code, but for now they are unused in release builds.
2025-07-31[CIR] Fix fallthrough warning (#151418)Andy Kaylor1-0/+1
This fixes a warning about an unannotated fallthrough.
2025-07-28[CIR] Implement LValueBitcast for ComplexType (#150668)Amr Hesham1-0/+126
This change adds support for LValueBitcast for ComplexType https://github.com/llvm/llvm-project/issues/141365
2025-07-24[CIR] Add support for normal cleanups (#149948)Andy Kaylor1-25/+96
This change adds basic handling for normal cleanups. This is a very minimal implemention. In particular, it uses a naive substitute for the rich cleanup and EH stack handling that is present in classic codegen and the CIR incubator. This is intended as a temporary implementation to allow incremental progress. It is not expected to scale well enough to be used in a production environment. It will be replaced with the full EHScopeStack handling when such an implementation is needed.
2025-07-24[CIR] Add support for array constructors (#149142)Morris Hafner1-0/+44
This patch upstreams support for creating arrays of classes that require calling a constructor. * Adds the ArrayCtor operation * New lowering pass for lowering ArrayCtor to a loop --------- Co-authored-by: Andy Kaylor <akaylor@nvidia.com> Co-authored-by: Henrich Lauko <xlauko@mail.muni.cz>
2025-07-21[CIR] Add complete destructor handling (#149552)Andy Kaylor1-5/+6
The initial implementation for emitting destructors emitted the complete destructor body for both D1 and D2 destructors. This change updates the code to have the D1 destructor call the D2 destructor.
2025-07-19[CIR] Upstream CompoundLiteralExpr for Scalar (#148943)Amr Hesham1-0/+2
Upstream CompoundLiteralExpr for Scalar as a prerequisite for CompoundLiteralExpr for ComplexType
2025-07-14[CIR] Add Minimal Destructor Definition Support (#144719)Morris Hafner1-1/+91
This patch upstreams support for writing inline and out of line C++ destructor definitions. Calling a destructor implcitly or explicitly is left for a future patch. Because of that restriction complete destructors (D2 in Itanium mangling) do not call into the base (D1) destructors yet but simply behave like a base destructor. Deleting (D0) destructor support is not part of this patch. Destructor aliases aren't supported, either. Because of this compilation with -mno-constructor-aliases may be required to avoid running into NYI errors.
2025-06-27[CIR] Upstream support for operator assign (#145979)Andy Kaylor1-11/+13
This adds support for assignment operators, including implicit operator definitions.
2025-06-24[CIR] Add support for member initialization from constructors (#144583)Andy Kaylor1-0/+9
Upstream the code to handle member variable initialization in a constructor. At this point only simple scalar values (including members of anonymous unions) are handled.
2025-06-13[CIR] Function calls with aggregate arguments and return values (#143377)Sirui Mu1-0/+11
This patch updates cir.call operation and allows function calls with aggregate arguments and return values. It seems that C++ class support is still at a minimum now. I tried to make a call to a C++ function with an argument of aggregate type but it failed because the initialization of C++ class / struct is NYI. I also tried to inline this part of support into this patch, but the mixed patch quickly blows in size and becomes unsuitable for review. Thus, tests for calling functions with aggregate arguments are added only for C for now.
2025-06-12[CIR] Add support for delegating constructors (#143932)Andy Kaylor1-8/+2
This change adds the necessary support for handling delegating constructors in ClangIR. The implementation is kept as small as possible by not handling any other sort of initialization (members, base classes, etc.). That will be added in a future commit.
2025-06-12[CIR] Upstream support for emitting constructors (#143639)Andy Kaylor1-6/+54
This change upstreams the code to emit simple constructor defintions.
2025-06-09[CIR] Add support for accessing members of base classes (#143195)Andy Kaylor1-0/+22
This change adds the support for accessing a member of a base class from a derived class object.
2025-06-02[CIR] Support inline C++ member function definitions (#142484)Andy Kaylor1-1/+21
This change upstreams the code to support emitting inline C++ function definitions, including the ASTConsumer handler for inline definitions and the code to load the 'this' pointer. This necessitates introducing the Itanium CXXABI class. No other CXXABI subclasses are supported at this time. The Itanium CXXABI is used for AppleARM64, which will require its own handler for a few special cases (such as array cookies) later.
2025-05-30[CIR][NFC] Fix warning about unhandled type (#142059)Andy Kaylor1-4/+3
This change fixes a warning about an unhandled type in a switch statement in CIRGenFunction::getEvaluationKind. It also moves two types that were marked as NYI to the appropriate group.
2025-05-23[CIR] Add alignment support for global, store, and load ops (#141163)Andy Kaylor1-1/+1
This adds alignment support for GlobalOp, LoadOp, and StoreOp. Tests which failed because cir.store/cir.load now print alignment were updated with wildcard matches, except where the alignment was relevant to the test. Tests which check for cir.store/cir.load in cases that don't have explicit alignment were not updated. New tests for alignment are alignment.c, align-load.c, and align-store.c.
2025-05-21[CIR] Upstream support for string literals (#140796)Andy Kaylor1-0/+2
This adds the minimal support needed to handle string literals.
2025-05-20[CIR] Upstream support for iterator-based range for loops (#140636)Andy Kaylor1-0/+22
This change adds handling for C++ member operator calls, implicit no-op casts, and l-value call expressions. Together, these changes enable handling of range for loops based on iterators.
2025-05-19[CIR] Upstream support for C++ member function calls (#140290)Andy Kaylor1-2/+8
This change adds the support needed to handle a C++ member function call, including arranging the function type with an argument added for the 'this' parameter. It was necessary to introduce the class to handle the CXXABI, but at this time no target-specific subclasses have been added.
2025-05-01[CIR][NFC] Fix an unused variable warning (#138110)Amr Hesham1-1/+1
This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.
2025-04-29[CIR] Add support for compound assignment statements (#137740)Andy Kaylor1-0/+13
Compound assignment in C++ goes through a different path than the binary assignment operators that were already handled for C. This change adds the necessary handler to get this working with C++.
2025-04-22[CIR] Upstream support for accessing structure members (#136383)Andy Kaylor1-0/+2
This adds ClangIR support for accessing structure members. Access to union members is deferred to a later change.
2025-04-18[CIR] Upstream scalar support for ParenExpr (#136332)Andy Kaylor1-0/+2
This change adds support for handling ParenExpr in scalar expressions. A few more places will need to be updated after structure assignment and complex type support is in place.
2025-04-11[CIR] Upstream ArraySubscriptExpr for fixed size array (#134536)Amr Hesham1-0/+2
This change adds ArraySubscriptExpr for fixed size ArrayType Issue #130197
2025-04-08[CIR] Add if statement support (#134333)Andres-Salamanca1-0/+65
This patch adds support for if statements in the CIR dialect Additionally, multiple RUN lines were introduced to improve codegen test coverage
2025-04-03[CIR][Upstream] Local initialization for ArrayType (#132974)Amr Hesham1-0/+43
This change adds local initialization for ArrayType Issue #130197
2025-03-25[CIR] Emit allocas into the proper lexical scope (#132468)Andy Kaylor1-2/+4
Alloca operations were being emitted into the entry block of the current function unconditionally, even if the variable they represented was declared in a different scope. This change upstreams the code for handling insertion of the alloca into the proper lexcial scope. It also adds a CIR-to-CIR transformation to hoist allocas to the function entry block, which is necessary to produce the expected LLVM IR during lowering.
2025-03-25[CIR] Add binary operators (#132420)Morris Hafner1-0/+2
This patch adds upstreams support for BinOp including lvalue assignments. Note that this does not include ternary ops, BinOpOverflowOp, pointer arithmetic, ShiftOp and SelectOp which are required for logical binary operators. --------- Co-authored-by: Morris Hafner <mhafner@nvidia.com> Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-03-19[CIR] Upstream a basic version of class LexicalScope (#131945)David Olsen1-41/+178
Upstream the parts of class `CIRGenFunction::LexicalScope` that implement function return values. There is a bit of other functionality in here, such as the implicit `cir.yield` at the end of a non-function scope, but this is mostly about function returns. The parts of `LexicalScope` that handle calling destructors, switch statements, ternary expressions, and exception handling still need to be upstreamed. There is a change in the generated ClangIR (which is why many of the tests needed updating). Return values are stored in the compiler-generated variable `__retval` rather than being passed to the `cir.return` op directly. But there should be no change in the behavior of the generated code.
2025-03-17[CIR] Upstream initial support for unary op (#131369)Andy Kaylor1-0/+2
This adds support for the cir.unary plus, minus, inc, dec, and not operations for integer, floating point, and boolean types.
2025-03-04[CIR] Clean up warnings (#129604)Andy Kaylor1-7/+5
Previous CIR commits have introduced a few warnings. This change fixes those. There are still warnings present when building with GCC because GCC warns about virtual functions being hidden in the mlir::OpConversion classes. A separate discussion will be required to decide what should be done about those.
2025-02-28[CIR] Upstream func args alloca handling (#129167)Andy Kaylor1-7/+69
This change adds support for collecting function arguments and storing them in alloca memory slots.