Eliminate several more unnecessary intptr_t casts.
authorDan Gohman <gohman@apple.com>
Wed, 18 Feb 2009 05:09:16 +0000 (05:09 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 18 Feb 2009 05:09:16 +0000 (05:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64888 91177308-0d34-0410-b5e6-96231b3b80d8

16 files changed:
docs/WritingAnLLVMPass.html
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/LoopVR.h
include/llvm/CodeGen/MachineLoopInfo.h
include/llvm/PassManagers.h
include/llvm/Target/TargetData.h
lib/CodeGen/GCMetadata.cpp
lib/CodeGen/GCStrategy.cpp
lib/CodeGen/MachineDominators.cpp
lib/Transforms/Scalar/DCE.cpp
lib/VMCore/PrintModulePass.cpp
tools/bugpoint/TestPasses.cpp
tools/opt/AnalysisWrappers.cpp
tools/opt/GraphPrinters.cpp
tools/opt/PrintSCC.cpp
tools/opt/opt.cpp

index 04bd9266118bbb01b29c46c2610e881708f9f658..9eb97e1d66f7df1a59e1d8585a629c5fd6f5d8d3 100644 (file)
@@ -265,7 +265,7 @@ time.</p>
 
 <div class="doc_code"><pre>
      static char ID;
-     Hello() : FunctionPass((intptr_t)&amp;ID) {}
+     Hello() : FunctionPass(&amp;ID) {}
 </pre></div><p>
 
 <p> This declares pass identifier used by LLVM to identify pass. This allows LLVM to
@@ -319,7 +319,7 @@ is supplied as fourth argument. </p>
   <b>struct Hello</b> : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
     
     static char ID;
-    Hello() : FunctionPass((intptr_t)&amp;ID) {}
+    Hello() : FunctionPass(&amp;ID) {}
 
     <b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
       llvm::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
index b2268a2d74f50583af254bf8140d0640445f6689..3961675980eb02c107c7ffa5bbf54578df0f6f02 100644 (file)
@@ -937,7 +937,7 @@ class LoopInfo : public FunctionPass {
 public:
   static char ID; // Pass identification, replacement for typeid
 
-  LoopInfo() : FunctionPass(intptr_t(&ID)) {
+  LoopInfo() : FunctionPass(&ID) {
     LI = new LoopInfoBase<BasicBlock>();
   }
   
index db260c435073ba5f8967c682b8000b0d86aeb9ad..1d806f83aa92da16c12203e409db4830a60af562 100644 (file)
@@ -30,7 +30,7 @@ class LoopVR : public FunctionPass {
 public:
   static char ID; // Class identification, replacement for typeinfo
 
-  LoopVR() : FunctionPass(intptr_t(&ID)) {}
+  LoopVR() : FunctionPass(&ID) {}
 
   bool runOnFunction(Function &F);
   virtual void print(std::ostream &os, const Module *) const;
index dc5350722ed7775b51cc623a898fd5ef5448d493..8c96308ac91a7602c6a553702c9821b0503bab9a 100644 (file)
@@ -77,7 +77,7 @@ class MachineLoopInfo : public MachineFunctionPass {
 public:
   static char ID; // Pass identification, replacement for typeid
 
-  MachineLoopInfo() : MachineFunctionPass(intptr_t(&ID)) {
+  MachineLoopInfo() : MachineFunctionPass(&ID) {
     LI = new LoopInfoBase<MachineBasicBlock>();
   }
   
index 22d5062b6b1676e2e1a1b645945858ab14379c3f..2d68239e2aad5b50e76bcfa2a1ffb204e0a0404b 100644 (file)
@@ -384,7 +384,7 @@ class FPPassManager : public ModulePass, public PMDataManager {
 public:
   static char ID;
   explicit FPPassManager(int Depth) 
-  : ModulePass(intptr_t(&ID)), PMDataManager(Depth) { }
+  : ModulePass(&ID), PMDataManager(Depth) { }
   
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
index 92feebf01ad12b3be721c7948898767c2678751c..7e7785bb403bfcd7a68cd461f289f7374d16c8cc 100644 (file)
@@ -109,7 +109,7 @@ public:
   ///
   /// @note This has to exist, because this is a pass, but it should never be
   /// used.
-  TargetData() : ImmutablePass(intptr_t(&ID)) {
+  TargetData() : ImmutablePass(&ID) {
     assert(0 && "ERROR: Bad TargetData ctor used.  "
            "Tool did not specify a TargetData to use?");
     abort();
@@ -117,7 +117,7 @@ public:
 
   /// Constructs a TargetData from a specification string. See init().
   explicit TargetData(const std::string &TargetDescription)
-    : ImmutablePass(intptr_t(&ID)) {
+    : ImmutablePass(&ID) {
     init(TargetDescription);
   }
 
@@ -125,7 +125,7 @@ public:
   explicit TargetData(const Module *M);
 
   TargetData(const TargetData &TD) :
-    ImmutablePass(intptr_t(&ID)),
+    ImmutablePass(&ID),
     LittleEndian(TD.isLittleEndian()),
     PointerMemSize(TD.PointerMemSize),
     PointerABIAlign(TD.PointerABIAlign),
index 4742ad8bbbb9f45c5edfef2e8ac9380f3dea2968..cf2ebb39ad8235078827f0dc61d452c810472150 100644 (file)
@@ -129,7 +129,7 @@ FunctionPass *llvm::createGCInfoPrinter(std::ostream &OS) {
 }
 
 Printer::Printer(std::ostream &OS)
-  : FunctionPass(intptr_t(&ID)), OS(OS) {}
+  : FunctionPass(&ID), OS(OS) {}
 
 const char *Printer::getPassName() const {
   return "Print Garbage Collector Information";
@@ -189,7 +189,7 @@ FunctionPass *llvm::createGCInfoDeleter() {
   return new Deleter();
 }
 
-Deleter::Deleter() : FunctionPass(intptr_t(&ID)) {}
+Deleter::Deleter() : FunctionPass(&ID) {}
 
 const char *Deleter::getPassName() const {
   return "Delete Garbage Collector Information";
index 3ec368fe73c8dd3733c6758acf2fd27a047830f9..ad7421abc2117c9ceef4129974efd0a2162e4a6e 100644 (file)
@@ -313,7 +313,7 @@ FunctionPass *llvm::createGCMachineCodeAnalysisPass() {
 char MachineCodeAnalysis::ID = 0;
 
 MachineCodeAnalysis::MachineCodeAnalysis()
-  : MachineFunctionPass(intptr_t(&ID)) {}
+  : MachineFunctionPass(&ID) {}
 
 const char *MachineCodeAnalysis::getPassName() const {
   return "Analyze Machine Code For Garbage Collection";
index f7820484376c0eb3c6855bf17375e0b3d5f7821b..37c86019d4a22182a629d34c7144b748dbe64361 100644 (file)
@@ -39,7 +39,7 @@ bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
 }
 
 MachineDominatorTree::MachineDominatorTree()
-    : MachineFunctionPass(intptr_t(&ID)) {
+    : MachineFunctionPass(&ID) {
   DT = new DominatorTreeBase<MachineBasicBlock>(false);
 }
 
index a5990ee79e89d863b79eafba4e40f1687b2351d3..8bb504c09c6e3ca483f74d8c5d0bfbe1c7838f68 100644 (file)
@@ -36,7 +36,7 @@ namespace {
   //
   struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass {
     static char ID; // Pass identification, replacement for typeid
-    DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
+    DeadInstElimination() : BasicBlockPass(&ID) {}
     virtual bool runOnBasicBlock(BasicBlock &BB) {
       bool Changed = false;
       for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
index 61e5889bb78dd0d1cfefa54adedf89029dea6744..7cb009a7d3c52c54ffcf57f55d356563c86f012d 100644 (file)
@@ -27,10 +27,10 @@ namespace {
     bool DeleteStream;      // Delete the ostream in our dtor?
   public:
     static char ID;
-    PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&errs()), 
+    PrintModulePass() : ModulePass(&ID), Out(&errs()), 
       DeleteStream(false) {}
     PrintModulePass(raw_ostream *o, bool DS)
-      : ModulePass(intptr_t(&ID)), Out(o), DeleteStream(DS) {}
+      : ModulePass(&ID), Out(o), DeleteStream(DS) {}
     
     ~PrintModulePass() {
       if (DeleteStream) delete Out;
@@ -53,10 +53,10 @@ namespace {
     bool DeleteStream;      // Delete the ostream in our dtor?
   public:
     static char ID;
-    PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&errs()), 
+    PrintFunctionPass() : FunctionPass(&ID), Banner(""), Out(&errs()), 
                           DeleteStream(false) {}
     PrintFunctionPass(const std::string &B, raw_ostream *o, bool DS)
-      : FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(DS) {}
+      : FunctionPass(&ID), Banner(B), Out(o), DeleteStream(DS) {}
     
     inline ~PrintFunctionPass() {
       if (DeleteStream) delete Out;
index db7544b57a627b98796d2aacbe97217578649151..900bf632a83bb1552d527469c1b3cb27bf8d6d39 100644 (file)
@@ -27,7 +27,7 @@ namespace {
   class CrashOnCalls : public BasicBlockPass {
   public:
     static char ID; // Pass ID, replacement for typeid
-    CrashOnCalls() : BasicBlockPass((intptr_t)&ID) {}
+    CrashOnCalls() : BasicBlockPass(&ID) {}
   private:
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -54,7 +54,7 @@ namespace {
   class DeleteCalls : public BasicBlockPass {
   public:
     static char ID; // Pass ID, replacement for typeid
-    DeleteCalls() : BasicBlockPass((intptr_t)&ID) {}
+    DeleteCalls() : BasicBlockPass(&ID) {}
   private:
     bool runOnBasicBlock(BasicBlock &BB) {
       for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
index 94cca50d63d1f310c10b6ae95ad9c4ac2299bbd0..631a0ddbfb1949c11219a1ae22f0053ad03c5c5e 100644 (file)
@@ -31,7 +31,7 @@ namespace {
   /// or handle in alias analyses.
   struct ExternalFunctionsPassedConstants : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    ExternalFunctionsPassedConstants() : ModulePass((intptr_t)&ID) {}
+    ExternalFunctionsPassedConstants() : ModulePass(&ID) {}
     virtual bool runOnModule(Module &M) {
       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
         if (I->isDeclaration()) {
@@ -70,7 +70,7 @@ namespace {
 
   struct CallGraphPrinter : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
+    CallGraphPrinter() : ModulePass(&ID) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
index 31515c89931633d13937ffe29f4298eb2e539c02..a52baf7dae3c818a05c7c1df131491d26d7043ff 100644 (file)
@@ -62,7 +62,7 @@ namespace llvm {
 namespace {
   struct CallGraphPrinter : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
+    CallGraphPrinter() : ModulePass(&ID) {}
 
     virtual bool runOnModule(Module &M) {
       WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>());
@@ -91,7 +91,7 @@ namespace {
   class DomInfoPrinter : public FunctionPass {
   public:
     static char ID; // Pass identification, replacement for typeid
-    DomInfoPrinter() : FunctionPass((intptr_t)&ID) {}
+    DomInfoPrinter() : FunctionPass(&ID) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
index f314baaba937c086f9b09a06205e3fcef07c50f1..be652644a6b5e349044da3eb1bd065a3c53a4104 100644 (file)
@@ -36,7 +36,7 @@ using namespace llvm;
 namespace {
   struct CFGSCC : public FunctionPass {
     static char ID;  // Pass identification, replacement for typeid
-    CFGSCC() : FunctionPass((intptr_t)&ID) {}
+    CFGSCC() : FunctionPass(&ID) {}
     bool runOnFunction(Function& func);
 
     void print(std::ostream &O, const Module* = 0) const { }
@@ -48,7 +48,7 @@ namespace {
 
   struct CallGraphSCC : public ModulePass {
     static char ID;  // Pass identification, replacement for typeid
-    CallGraphSCC() : ModulePass((intptr_t)&ID) {}
+    CallGraphSCC() : ModulePass(&ID) {}
 
     // run - Print out SCCs in the call graph for the specified module.
     bool runOnModule(Module &M);
index b46f7c9188c0e1f56211d16072cd849ec5aa74c3..680353ad235291c6974e5db6a9c4ce7da87c611a 100644 (file)
@@ -122,7 +122,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
   static char ID;
   const PassInfo *PassToPrint;
   CallGraphSCCPassPrinter(const PassInfo *PI) : 
-    CallGraphSCCPass((intptr_t)&ID), PassToPrint(PI) {}
+    CallGraphSCCPass(&ID), PassToPrint(PI) {}
 
   virtual bool runOnSCC(const std::vector<CallGraphNode *>&SCC) {
     if (!Quiet) {
@@ -151,7 +151,7 @@ char CallGraphSCCPassPrinter::ID = 0;
 struct ModulePassPrinter : public ModulePass {
   static char ID;
   const PassInfo *PassToPrint;
-  ModulePassPrinter(const PassInfo *PI) : ModulePass((intptr_t)&ID),
+  ModulePassPrinter(const PassInfo *PI) : ModulePass(&ID),
                                           PassToPrint(PI) {}
 
   virtual bool runOnModule(Module &M) {
@@ -176,7 +176,7 @@ char ModulePassPrinter::ID = 0;
 struct FunctionPassPrinter : public FunctionPass {
   const PassInfo *PassToPrint;
   static char ID;
-  FunctionPassPrinter(const PassInfo *PI) : FunctionPass((intptr_t)&ID),
+  FunctionPassPrinter(const PassInfo *PI) : FunctionPass(&ID),
                                             PassToPrint(PI) {}
 
   virtual bool runOnFunction(Function &F) {
@@ -203,7 +203,7 @@ struct LoopPassPrinter : public LoopPass {
   static char ID;
   const PassInfo *PassToPrint;
   LoopPassPrinter(const PassInfo *PI) : 
-    LoopPass((intptr_t)&ID), PassToPrint(PI) {}
+    LoopPass(&ID), PassToPrint(PI) {}
 
   virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
     if (!Quiet) {
@@ -229,7 +229,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
   const PassInfo *PassToPrint;
   static char ID;
   BasicBlockPassPrinter(const PassInfo *PI) 
-    : BasicBlockPass((intptr_t)&ID), PassToPrint(PI) {}
+    : BasicBlockPass(&ID), PassToPrint(PI) {}
 
   virtual bool runOnBasicBlock(BasicBlock &BB) {
     if (!Quiet) {