diff options
author | Matin Raayai <30674652+matinraayai@users.noreply.github.com> | 2024-11-14 21:30:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 13:30:05 -0800 |
commit | bb3f5e1fed7c6ba733b7f273e93f5d3930976185 (patch) | |
tree | af92c80fb891c44540b7a2a62dfd2859ef26bff5 /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 5d16fbc275d57b88866a2606453ead6a024ffee0 (diff) | |
download | llvm-bb3f5e1fed7c6ba733b7f273e93f5d3930976185.zip llvm-bb3f5e1fed7c6ba733b7f273e93f5d3930976185.tar.gz llvm-bb3f5e1fed7c6ba733b7f273e93f5d3930976185.tar.bz2 |
Overhaul the TargetMachine and LLVMTargetMachine Classes (#111234)
Following discussions in #110443, and the following earlier discussions
in https://lists.llvm.org/pipermail/llvm-dev/2017-October/117907.html,
https://reviews.llvm.org/D38482, https://reviews.llvm.org/D38489, this
PR attempts to overhaul the `TargetMachine` and `LLVMTargetMachine`
interface classes. More specifically:
1. Makes `TargetMachine` the only class implemented under
`TargetMachine.h` in the `Target` library.
2. `TargetMachine` contains target-specific interface functions that
relate to IR/CodeGen/MC constructs, whereas before (at least on paper)
it was supposed to have only IR/MC constructs. Any Target that doesn't
want to use the independent code generator simply does not implement
them, and returns either `false` or `nullptr`.
3. Renames `LLVMTargetMachine` to `CodeGenCommonTMImpl`. This renaming
aims to make the purpose of `LLVMTargetMachine` clearer. Its interface
was moved under the CodeGen library, to further emphasis its usage in
Targets that use CodeGen directly.
4. Makes `TargetMachine` the only interface used across LLVM and its
projects. With these changes, `CodeGenCommonTMImpl` is simply a set of
shared function implementations of `TargetMachine`, and CodeGen users
don't need to static cast to `LLVMTargetMachine` every time they need a
CodeGen-specific feature of the `TargetMachine`.
5. More importantly, does not change any requirements regarding library
linking.
cc @arsenm @aeubanks
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 18c2247..a293a77 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -160,7 +160,7 @@ static inline Align getFnStackAlignment(const TargetSubtargetInfo *STI, return STI->getFrameLowering()->getStackAlign(); } -MachineFunction::MachineFunction(Function &F, const LLVMTargetMachine &Target, +MachineFunction::MachineFunction(Function &F, const TargetMachine &Target, const TargetSubtargetInfo &STI, MCContext &Ctx, unsigned FunctionNum) : F(F), Target(Target), STI(&STI), Ctx(Ctx) { |