[llvm-commits] [llvm] r71785 - /llvm/trunk/lib/CodeGen/MachineFunction.cpp

Owen Anderson resistor at mac.com
Thu May 14 12:17:43 PDT 2009


Author: resistor
Date: Thu May 14 14:17:24 2009
New Revision: 71785

URL: http://llvm.org/viewvc/llvm-project?rev=71785&view=rev
Log:
Down with static variables!

Part one of many.

Modified:
    llvm/trunk/lib/CodeGen/MachineFunction.cpp

Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=71785&r1=71784&r2=71785&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Thu May 14 14:17:24 2009
@@ -35,9 +35,6 @@
 #include <sstream>
 using namespace llvm;
 
-static AnnotationID MF_AID(
-  AnnotationManager::getID("CodeGen::MachineCodeForFunction"));
-
 bool MachineFunctionPass::runOnFunction(Function &F) {
   // Do not codegen any 'available_externally' functions at all, they have
   // definitions outside the translation unit.
@@ -115,7 +112,8 @@
 
 MachineFunction::MachineFunction(const Function *F,
                                  const TargetMachine &TM)
-  : Annotation(MF_AID), Fn(F), Target(TM) {
+  : Annotation(AnnotationManager::getID("CodeGen::MachineCodeForFunction")),
+    Fn(F), Target(TM) {
   if (TM.getRegisterInfo())
     RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
                   MachineRegisterInfo(*TM.getRegisterInfo());
@@ -365,6 +363,8 @@
 MachineFunction&
 MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
 {
+  AnnotationID MF_AID =
+                    AnnotationManager::getID("CodeGen::MachineCodeForFunction");
   assert(Fn->getAnnotation(MF_AID) == 0 &&
          "Object already exists for this function!");
   MachineFunction* mcInfo = new MachineFunction(Fn, Tar);
@@ -373,6 +373,8 @@
 }
 
 void MachineFunction::destruct(const Function *Fn) {
+  AnnotationID MF_AID =
+                    AnnotationManager::getID("CodeGen::MachineCodeForFunction");
   bool Deleted = Fn->deleteAnnotation(MF_AID);
   assert(Deleted && "Machine code did not exist for function!"); 
   Deleted = Deleted; // silence warning when no assertions.
@@ -380,6 +382,8 @@
 
 MachineFunction& MachineFunction::get(const Function *F)
 {
+  AnnotationID MF_AID =
+                    AnnotationManager::getID("CodeGen::MachineCodeForFunction");
   MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
   assert(mc && "Call construct() method first to allocate the object");
   return *mc;





More information about the llvm-commits mailing list