llvm.org GIT mirror llvm / dad0df6
MachineFunction: Store more specific reference to LLVMTargetMachine; NFC MachineFunction can only be used in code using lib/CodeGen, hence we can keep a more specific reference to LLVMTargetMachine rather than just TargetMachine around. Do the same for references in ScheduleDAG and RegUsageInfoCollector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346183 91177308-0d34-0410-b5e6-96231b3b80d8 Matthias Braun 11 months ago
7 changed file(s) with 15 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
5757 class DILocation;
5858 class Function;
5959 class GlobalValue;
60 class LLVMTargetMachine;
6061 class MachineConstantPool;
6162 class MachineFrameInfo;
6263 class MachineFunction;
6970 class PseudoSourceValueManager;
7071 class raw_ostream;
7172 class SlotIndexes;
72 class TargetMachine;
7373 class TargetRegisterClass;
7474 class TargetSubtargetInfo;
7575 struct WasmEHFuncInfo;
224224
225225 class MachineFunction {
226226 const Function &F;
227 const TargetMachine &Target;
227 const LLVMTargetMachine &Target;
228228 const TargetSubtargetInfo *STI;
229229 MCContext &Ctx;
230230 MachineModuleInfo &MMI;
387387 using VariableDbgInfoMapTy = SmallVector;
388388 VariableDbgInfoMapTy VariableDbgInfos;
389389
390 MachineFunction(const Function &F, const TargetMachine &Target,
390 MachineFunction(const Function &F, const LLVMTargetMachine &Target,
391391 const TargetSubtargetInfo &STI, unsigned FunctionNum,
392392 MachineModuleInfo &MMI);
393393 MachineFunction(const MachineFunction &) = delete;
435435 unsigned getFunctionNumber() const { return FunctionNumber; }
436436
437437 /// getTarget - Return the target machine this machine code is compiled with
438 const TargetMachine &getTarget() const { return Target; }
438 const LLVMTargetMachine &getTarget() const { return Target; }
439439
440440 /// getSubtarget - Return the subtarget for which this machine code is being
441441 /// compiled.
2828 namespace llvm {
2929
3030 class Function;
31 class TargetMachine;
31 class LLVMTargetMachine;
3232
3333 class PhysicalRegisterUsageInfo : public ImmutablePass {
3434 public:
4040 }
4141
4242 /// Set TargetMachine which is used to print analysis.
43 void setTargetMachine(const TargetMachine &TM);
43 void setTargetMachine(const LLVMTargetMachine &TM);
4444
4545 bool doInitialization(Module &M) override;
4646
6262 /// and 1 means content of register will be preserved around function call.
6363 DenseMap> RegMasks;
6464
65 const TargetMachine *TM;
65 const LLVMTargetMachine *TM;
6666 };
6767
6868 } // end namespace llvm
3232 namespace llvm {
3333
3434 template class GraphWriter;
35 class LLVMTargetMachine;
3536 class MachineFunction;
3637 class MachineRegisterInfo;
3738 class MCInstrDesc;
3839 struct MCSchedClassDesc;
39 class ScheduleDAG;
4040 class SDNode;
4141 class SUnit;
42 class ScheduleDAG;
4243 class TargetInstrInfo;
43 class TargetMachine;
4444 class TargetRegisterClass;
4545 class TargetRegisterInfo;
4646
557557
558558 class ScheduleDAG {
559559 public:
560 const TargetMachine &TM; ///< Target processor
560 const LLVMTargetMachine &TM; ///< Target processor
561561 const TargetInstrInfo *TII; ///< Target instruction information
562562 const TargetRegisterInfo *TRI; ///< Target processor register info
563563 MachineFunction &MF; ///< Machine function
129129 return STI->getFrameLowering()->getStackAlignment();
130130 }
131131
132 MachineFunction::MachineFunction(const Function &F, const TargetMachine &Target,
132 MachineFunction::MachineFunction(const Function &F,
133 const LLVMTargetMachine &Target,
133134 const TargetSubtargetInfo &STI,
134135 unsigned FunctionNum, MachineModuleInfo &mmi)
135136 : F(F), Target(Target), STI(&STI), Ctx(mmi.getContext()), MMI(mmi) {
8080 bool RegUsageInfoCollector::runOnMachineFunction(MachineFunction &MF) {
8181 MachineRegisterInfo *MRI = &MF.getRegInfo();
8282 const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
83 const TargetMachine &TM = MF.getTarget();
83 const LLVMTargetMachine &TM = MF.getTarget();
8484
8585 LLVM_DEBUG(dbgs() << " -------------------- " << getPassName()
8686 << " -------------------- \n");
3939
4040 char PhysicalRegisterUsageInfo::ID = 0;
4141
42 void PhysicalRegisterUsageInfo::setTargetMachine(const TargetMachine &TM) {
42 void PhysicalRegisterUsageInfo::setTargetMachine(const LLVMTargetMachine &TM) {
4343 this->TM = &TM;
4444 }
4545
199199
200200 void NVPTXAsmPrinter::lowerImageHandleSymbol(unsigned Index, MCOperand &MCOp) {
201201 // Ewwww
202 TargetMachine &TM = const_cast<TargetMachine&>(MF->getTarget());
202 LLVMTargetMachine &TM = const_castTargetMachine&>(MF->getTarget());
203203 NVPTXTargetMachine &nvTM = static_cast(TM);
204204 const NVPTXMachineFunctionInfo *MFI = MF->getInfo();
205205 const char *Sym = MFI->getImageHandleSymbol(Index);