diff options
author | Eric Christopher <echristo@gmail.com> | 2014-10-08 01:58:01 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2014-10-08 01:58:01 +0000 |
commit | 896044822e2b10ea83af2b40db81b5924398e768 (patch) | |
tree | f37008fdd6f9088d1ede3337713f923e98c3356d /llvm/lib/CodeGen | |
parent | 8d07f44560460f6a5ccc1306de5020ae05a16aa0 (diff) | |
download | bcm5719-llvm-896044822e2b10ea83af2b40db81b5924398e768.tar.gz bcm5719-llvm-896044822e2b10ea83af2b40db81b5924398e768.zip |
Reset the target options and optimization level as the first
thing we do inside selection dag. This code needs to be
migrated to queries on the function rather than global
data, but this organizes things before we start grabbing
the subtarget.
llvm-svn: 219271
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 860a85e59fe..4a9f4c9391e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -411,23 +411,28 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) { "-fast-isel-abort requires -fast-isel"); const Function &Fn = *mf.getFunction(); - const TargetInstrInfo &TII = *TM.getSubtargetImpl()->getInstrInfo(); - const TargetRegisterInfo &TRI = *TM.getSubtargetImpl()->getRegisterInfo(); - MF = &mf; - RegInfo = &MF->getRegInfo(); - AA = &getAnalysis<AliasAnalysis>(); - LibInfo = &getAnalysis<TargetLibraryInfo>(); - GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr; + // Reset the target options before resetting the optimization + // level below. + // FIXME: This is a horrible hack and should be processed via + // codegen looking at the optimization level explicitly when + // it wants to look at it. TM.resetTargetOptions(Fn); - // Reset OptLevel to None for optnone functions. CodeGenOpt::Level NewOptLevel = OptLevel; if (Fn.hasFnAttribute(Attribute::OptimizeNone)) NewOptLevel = CodeGenOpt::None; OptLevelChanger OLC(*this, NewOptLevel); + const TargetInstrInfo &TII = *TM.getSubtargetImpl()->getInstrInfo(); + const TargetRegisterInfo &TRI = *TM.getSubtargetImpl()->getRegisterInfo(); + + RegInfo = &MF->getRegInfo(); + AA = &getAnalysis<AliasAnalysis>(); + LibInfo = &getAnalysis<TargetLibraryInfo>(); + GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr; + DEBUG(dbgs() << "\n\n\n=== " << Fn.getName() << "\n"); SplitCriticalSideEffectEdges(const_cast<Function&>(Fn), this); |