You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CIR][CIRGen] Add complex type and its CIRGen support (#513)
This PR adds `!cir.complex` type to model the `_Complex` type in C. It
also contains support for its CIRGen.
In detail, this patch adds the following CIR types, ops, and attributes:
- The `!cir.complex` type is added to model the `_Complex` type in C.
This type is parameterized with the type of the components of the
complex number, which must be either an integer type or a floating-point
type.
- ~The `#cir.complex` attribute is added to represent a literal value of
`_Complex` type. It is a struct-like attribute that provides the real
and imaginary part of the literal `_Complex` value.~
- ~The `#cir.imag` attribute is added to represent a purely imaginary
number.~
- The `cir.complex.create` op is added to create a complex value from
its real and imaginary parts.
- ~The `cir.complex.real` and `cir.complex.imag` op is added to extract
the real and imaginary part of a value of `!cir.complex` type,
respectively.~
- The `cir.complex.real_ptr` and `cir.complex.imag_ptr` op is added to
derive a pointer to the real and imaginary part of a value of
`!cir.complex` type, respectively.
CIRGen support for some of the fundamental complex number operations is
also included. ~Note the implementation diverges from the original clang
CodeGen, where expressions of complex types are handled differently from
scalars and aggregates. Instead, this patch treats expressions of
complex types as scalars, as such expressions can be simply lowered to a
CIR value of `!cir.complex` type.~
This PR addresses #445 .
0 commit comments