[llvm-commits] CVS: llvm/lib/CodeGen/Mapping/StackSlots.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Dec 28 14:44:05 PST 2002


Changes in directory llvm/lib/CodeGen/Mapping:

StackSlots.cpp updated: 1.3 -> 1.4

---
Log message:

Put class in anonymous namespace


---
Diffs of the changes:

Index: llvm/lib/CodeGen/Mapping/StackSlots.cpp
diff -u llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.3 llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.4
--- llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.3	Sun Oct 27 18:27:45 2002
+++ llvm/lib/CodeGen/Mapping/StackSlots.cpp	Sat Dec 28 14:42:56 2002
@@ -14,30 +14,32 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Pass.h"
 #include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFunctionInfo.h"
 
-class StackSlots : public FunctionPass {
-  const TargetMachine &Target;
-public:
-  StackSlots (const TargetMachine &T) : Target(T) {}
-
-  const char *getPassName() const {
-    return "Stack Slot Insertion for profiling code";
-  }
-
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.setPreservesCFG();
-  }
-
-  bool runOnFunction(Function &F) {
-    const Type *PtrInt = PointerType::get(Type::IntTy);
-    unsigned Size = Target.DataLayout.getTypeSize(PtrInt);
-
-    MachineFunction &mcInfo = MachineFunction::get(&F);
-    Value *V = Constant::getNullValue(Type::IntTy);
-    mcInfo.allocateLocalVar(Target, V, 2*Size);
-    return true;
-  }
-};
+namespace {
+  class StackSlots : public FunctionPass {
+    const TargetMachine &Target;
+  public:
+    StackSlots(const TargetMachine &T) : Target(T) {}
+    
+    const char *getPassName() const {
+      return "Stack Slot Insertion for profiling code";
+    }
+    
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.setPreservesCFG();
+    }
+    
+    bool runOnFunction(Function &F) {
+      const Type *PtrInt = PointerType::get(Type::IntTy);
+      unsigned Size = Target.getTargetData().getTypeSize(PtrInt);
+      
+      Value *V = Constant::getNullValue(Type::IntTy);
+      MachineFunction::get(&F).getInfo()->allocateLocalVar(V, 2*Size);
+      return true;
+    }
+  };
+}
 
 Pass *createStackSlotsPass(const TargetMachine &Target) {
   return new StackSlots(Target);





More information about the llvm-commits mailing list