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.
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>
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.
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.
The 'cache' construct is an interesting one, in that it doesn't take any
clauses, and is exclusively a collection of variables. Lowering wise,
these just get added to the associated acc.loop. This did require
some work to ensure that the cache doesn't have 'vars' that aren't
inside of the loop, but Sema is taking care of that with a warning.
Otherwise this is just a fairly simple amount of lowering, where each
'var' in the list creates an acc.cache, which is added to the acc.loop.
This PR adds support for loading bit-field members from structs using
the `get_bitfield` operation.
It enables retrieving the address of the bitfield-packed member but does
**not** yet support volatile bitfields this will be addressed in a
future PR.
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.
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.
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.
PR #143720 adds a requirement to the ACC dialect that every acc.loop
must have a seq, independent, or auto attribute for the 'default'
device_type. The standard has rules for how this can be intuited:
orphan/parallel/parallel loop: independent
kernels/kernels loop: auto
serial/serial loop: seq, unless there is a gang/worker/vector, at which
point it should be 'auto'.
This patch implements all of this rule as a 'cleanup' step on the IR
generation for combined/loop operations. Note that the test impact is
much less since I inadvertently have my 'operation' terminating curley
matching the end curley from 'attribute' instead of the front of the
line, so I've added sufficient tests to ensure I captured the above.
This patch adds all bits required to implement builtin function calls to
ClangIR. It doesn't actually implement any of the builtins except those
that fold to a constant ahead of CodeGen
(`__builtin_is_constant_evaluated()` being one example).
This change adds support for calling C++ constructors. The support for
actually defining a constructor is still missing and will be added in a
later change.
Although support for declaring enums and using values whose type was an
enum was previously upstreamed, we didn't have support for referencing
the constant values declared in the enum. This change adds that support.
This patch adds visitors for BinLAnd, BinLOr and
AbstractConditionalOperator. Note that this patch still lacks visitation
of OpaqueValueExpr which is needed for the GNU ?: operator.
---------
Co-authored-by: Erich Keane <ekeane@nvidia.com>
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.
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.
Having the whole clause emission be in a header file ended up being
pragmatic, but ended up being a sizable negative for a variety of
reasons. This patch moves it to its own .cpp file and makes
CIRGenFunction instead call into the visitor via a template instead.
This is possible because the valid list of construct kinds is quite
finite, and easy to enumerate.
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.
Combined constructs are emitted a little oddly, in that they are the
first ones where there are two operations for a single construct. First,
the compute variant is emitted with 'combined(loop)', then the loop
operation is emitted with 'combined(<variant>)'. Each gets its own
normal terminator.
This patch does not yet implement clauses at all, since that is going to
require special attention to make sure we get the emitting of them
correct, since certain clauses go to different locations, and need their
insertion-points set correctly. So this patch sets it up so that we will
emit the 'not implemented' diagnostic for all clauses.
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++.
This introduces initial support for the switchOP, with caseOP of the
Equal kind. Support for additional case kinds such as AnyOf, Range, and
Default will be included in a future patch. Similarly, lowering to LLVM
IR and flattening of the switch are deferred and will be addressed in
subsequent updates.
This construct has a couple of 'intexprs' which are lowered the same way
as clauses, plus has a pair of simple clauses that needed lowering.
This patch does all of that.
This PR introduces support for calling functions with a scalar return
type to the upstream. This PR also includes an initial version of
`CIRGenTargetInfo` and related definitions which are essential for the
CIRGen of call ops.
Related to #132487 .
The calleeDecl var will be used in the near future, so I left it. At
least for clang, the [[maybe_unused]] attribute takes care of the
warnings related to that variable. The other warning was a simple lack
of return after errorNYI.
This patch adds `VisitBinAssign` and `VisitBinComma` to the ClangIR
`ScalarExprEmitter` to enable assignments and the comma operator.
---------
Co-authored-by: Morris Hafner <mhafner@nvidia.com>