diff options
| author | Davide Italiano <davide@freebsd.org> | 2016-07-11 17:00:31 +0000 | 
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2016-07-11 17:00:31 +0000 | 
| commit | 12a115683ba7f9e191c9b93f2b2701dd7187d443 (patch) | |
| tree | 9bd0ae853092a5017f63b5a6624022c6d8148440 /llvm/lib/Transforms | |
| parent | 9232f98279ebb63d4665a2155d85b4ab661cd046 (diff) | |
| download | bcm5719-llvm-12a115683ba7f9e191c9b93f2b2701dd7187d443.tar.gz bcm5719-llvm-12a115683ba7f9e191c9b93f2b2701dd7187d443.zip | |
[LowerTypeTests] Don't rely on doInitialization().
In preparation for porting this pass to the new PM (which has no
doInitialization()).
Differential Revision:  http://reviews.llvm.org/D22223
llvm-svn: 275074
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 39 | 
1 files changed, 16 insertions, 23 deletions
| diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index 06e66468c83..67c9b971e35 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -253,8 +253,6 @@ struct LowerTypeTests : public ModulePass {    void buildBitSetsFromDisjointSet(ArrayRef<Metadata *> TypeIds,                                     ArrayRef<GlobalObject *> Globals);    bool lower(); - -  bool doInitialization(Module &M) override;    bool runOnModule(Module &M) override;  }; @@ -266,27 +264,6 @@ char LowerTypeTests::ID = 0;  ModulePass *llvm::createLowerTypeTestsPass() { return new LowerTypeTests; } -bool LowerTypeTests::doInitialization(Module &Mod) { -  M = &Mod; -  const DataLayout &DL = Mod.getDataLayout(); - -  Triple TargetTriple(M->getTargetTriple()); -  LinkerSubsectionsViaSymbols = TargetTriple.isMacOSX(); -  Arch = TargetTriple.getArch(); -  ObjectFormat = TargetTriple.getObjectFormat(); - -  Int1Ty = Type::getInt1Ty(M->getContext()); -  Int8Ty = Type::getInt8Ty(M->getContext()); -  Int32Ty = Type::getInt32Ty(M->getContext()); -  Int32PtrTy = PointerType::getUnqual(Int32Ty); -  Int64Ty = Type::getInt64Ty(M->getContext()); -  IntPtrTy = DL.getIntPtrType(M->getContext(), 0); - -  TypeTestCallSites.clear(); - -  return false; -} -  /// Build a bit set for TypeId using the object layouts in  /// GlobalLayout.  BitSetInfo LowerTypeTests::buildBitSet( @@ -1012,5 +989,21 @@ bool LowerTypeTests::runOnModule(Module &M) {    if (skipModule(M))      return false; +  this->M = &M; +  const DataLayout &DL = M.getDataLayout(); + +  Triple TargetTriple(M.getTargetTriple()); +  LinkerSubsectionsViaSymbols = TargetTriple.isMacOSX(); +  Arch = TargetTriple.getArch(); +  ObjectFormat = TargetTriple.getObjectFormat(); + +  Int1Ty = Type::getInt1Ty(M.getContext()); +  Int8Ty = Type::getInt8Ty(M.getContext()); +  Int32Ty = Type::getInt32Ty(M.getContext()); +  Int32PtrTy = PointerType::getUnqual(Int32Ty); +  Int64Ty = Type::getInt64Ty(M.getContext()); +  IntPtrTy = DL.getIntPtrType(M.getContext(), 0); + +  TypeTestCallSites.clear();    return lower();  } | 

