From fc6de428c8ab10330e1b00c6541503cfd98a9cca Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 5 Aug 2014 02:39:49 +0000 Subject: Have MachineFunction cache a pointer to the subtarget to make lookups shorter/easier and have the DAG use that to do the same lookup. This can be used in the future for TargetMachine based caching lookups from the MachineFunction easily. Update the MIPS subtarget switching machinery to update this pointer at the same time it runs. llvm-svn: 214838 --- llvm/lib/CodeGen/IfConversion.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'llvm/lib/CodeGen/IfConversion.cpp') diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index 5b6702befab..79eb0fc6fe8 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -269,9 +269,9 @@ INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo) INITIALIZE_PASS_END(IfConverter, "if-converter", "If Converter", false, false) bool IfConverter::runOnMachineFunction(MachineFunction &MF) { - TLI = MF.getTarget().getSubtargetImpl()->getTargetLowering(); - TII = MF.getTarget().getSubtargetImpl()->getInstrInfo(); - TRI = MF.getTarget().getSubtargetImpl()->getRegisterInfo(); + TLI = MF.getSubtarget().getTargetLowering(); + TII = MF.getSubtarget().getInstrInfo(); + TRI = MF.getSubtarget().getRegisterInfo(); MBPI = &getAnalysis(); MRI = &MF.getRegInfo(); @@ -287,9 +287,8 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) { if (!PreRegAlloc) { // Tail merge tend to expose more if-conversion opportunities. BranchFolder BF(true, false); - BFChange = BF.OptimizeFunction( - MF, TII, MF.getTarget().getSubtargetImpl()->getRegisterInfo(), - getAnalysisIfAvailable()); + BFChange = BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(), + getAnalysisIfAvailable()); } DEBUG(dbgs() << "\nIfcvt: function (" << ++FnNum << ") \'" @@ -421,8 +420,7 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) { if (MadeChange && IfCvtBranchFold) { BranchFolder BF(false, false); - BF.OptimizeFunction(MF, TII, - MF.getTarget().getSubtargetImpl()->getRegisterInfo(), + BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(), getAnalysisIfAvailable()); } -- cgit v1.2.3