Use cached subtarget rather than looking it up on the

TargetMachine again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-10-08 07:51:41 +00:00
parent b7cd35b171
commit c720405b2a

View File

@ -57,7 +57,7 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
GCModuleInfo *gmi)
: Fn(F), Target(TM), STI(TM.getSubtargetImpl()), Ctx(mmi.getContext()),
MMI(mmi), GMI(gmi) {
if (TM.getSubtargetImpl()->getRegisterInfo())
if (STI->getRegisterInfo())
RegInfo = new (Allocator) MachineRegisterInfo(this);
else
RegInfo = nullptr;
@ -72,15 +72,13 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
getStackAlignment(AttributeSet::FunctionIndex));
ConstantPool = new (Allocator) MachineConstantPool(TM);
Alignment =
TM.getSubtargetImpl()->getTargetLowering()->getMinFunctionAlignment();
Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
// FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
if (!Fn->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
Attribute::OptimizeForSize))
Alignment = std::max(
Alignment,
TM.getSubtargetImpl()->getTargetLowering()->getPrefFunctionAlignment());
Alignment = std::max(Alignment,
STI->getTargetLowering()->getPrefFunctionAlignment());
FunctionNumber = FunctionNum;
JumpTableInfo = nullptr;