| Issue |
175968
|
| Summary |
[CIR] Add target lowering passes
|
| Labels |
ClangIR
|
| Assignees |
|
| Reporter |
Lancern
|
We need a target lowering pass (or a series of passes in the transformation pipeline) that lowers CIR from a target-agnostic form into a target-specific form. This was originally proposed under #173393 .
This pass (or series of passes) applies the following transformations to CIR:
- Target-specific lowering. For example, x86_64 only support a system-wide syncscope for atomic operations. Other syncscopes should just be treated as the default one. This kind of target-specific canonicalization should be accomplished in the target lowering pass(es).
- ABI lowering. For example, convert "high-level" types such as pointer-to-member-function to their corresponding "low-level" types as specified by the target ABI.
- Calling convention lowering. This should be part of ABI lowering, but I'm listing it separately because calling convention is itself a topic complex enough that worth dedicated efforts.
The handling of calling conventions is a common problem that many LLVM frontends would encounter. It would be nice if we could share at least some part of the code with other frontends such as flang. A separate work that proposes to introduce an ABI lowering library for LLVM is on the way, see https://discourse.llvm.org/t/rfc-an-abi-lowering-library-for-llvm/84495 .
Here are some break-down tasks for now:
- [ ] Move the lowering of `dynamic_cast` from LoweringPrepare to CXXABILoweringPass.
- [ ] Introduce a new pass for the target-specific lowering part.
- [ ] Remove LoweringModule from LowerToLLVM, and move all target-specific lowering logic in LowerToLLVM to the target lowering pass(es).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs