diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-06-19 20:51:24 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-06-19 20:51:24 +0000 |
commit | ea44281d5da5096de50ce1cb358ff0c6f20e1a2a (patch) | |
tree | e5921b602a2747efb334a9b13b94d5f090c779fb /lib/CodeGen/StackProtector.cpp | |
parent | 2e1dc2d2650c64f8fa57d12eb194dcf57e85ebb7 (diff) | |
download | llvm-ea44281d5da5096de50ce1cb358ff0c6f20e1a2a.tar.gz llvm-ea44281d5da5096de50ce1cb358ff0c6f20e1a2a.tar.bz2 llvm-ea44281d5da5096de50ce1cb358ff0c6f20e1a2a.tar.xz |
Access the TargetLoweringInfo from the TargetMachine object instead of caching it. The TLI may change between functions. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | lib/CodeGen/StackProtector.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index 389793ebc1..1f673ab037 100644 --- a/lib/CodeGen/StackProtector.cpp +++ b/lib/CodeGen/StackProtector.cpp @@ -41,9 +41,11 @@ STATISTIC(NumAddrTaken, "Number of local variables that have their address" namespace { class StackProtector : public FunctionPass { + const TargetMachine *TM; + /// TLI - Keep a pointer of a TargetLowering to consult for determining /// target type sizes. - const TargetLoweringBase *const TLI; + const TargetLoweringBase *TLI; const Triple Trip; Function *F; @@ -83,12 +85,11 @@ namespace { bool RequiresStackProtector(); public: static char ID; // Pass identification, replacement for typeid. - StackProtector() : FunctionPass(ID), TLI(0) { + StackProtector() : FunctionPass(ID), TM(0), TLI(0) { initializeStackProtectorPass(*PassRegistry::getPassRegistry()); } - StackProtector(const TargetLoweringBase *tli) - : FunctionPass(ID), TLI(tli), - Trip(tli->getTargetMachine().getTargetTriple()) { + StackProtector(const TargetMachine *TM) + : FunctionPass(ID), TM(TM), TLI(0), Trip(TM->getTargetTriple()) { initializeStackProtectorPass(*PassRegistry::getPassRegistry()); } @@ -104,14 +105,15 @@ char StackProtector::ID = 0; INITIALIZE_PASS(StackProtector, "stack-protector", "Insert stack protectors", false, false) -FunctionPass *llvm::createStackProtectorPass(const TargetLoweringBase *tli) { - return new StackProtector(tli); +FunctionPass *llvm::createStackProtectorPass(const TargetMachine *TM) { + return new StackProtector(TM); } bool StackProtector::runOnFunction(Function &Fn) { F = &Fn; M = F->getParent(); DT = getAnalysisIfAvailable<DominatorTree>(); + TLI = TM->getTargetLowering(); if (!RequiresStackProtector()) return false; |