[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp ExecutionAnnotations.h Interpreter.h

Chris Lattner lattner at cs.uiuc.edu
Wed Sep 17 12:27:01 PDT 2003


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.97 -> 1.98
ExecutionAnnotations.h updated: 1.11 -> 1.12
Interpreter.h updated: 1.42 -> 1.43

---
Log message:

Change FunctionInfo from being an annotation put on Functions to be 
something which is mapped from functions.


---
Diffs of the changes:

Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.97 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.98
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.97	Fri Sep  5 13:55:03 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp	Wed Sep 17 12:26:22 2003
@@ -120,8 +120,6 @@
 
 void Interpreter::initializeExecutionEngine() {
   TheEE = this;
-  AnnotationManager::registerAnnotationFactory(FunctionInfoAID,
-                                               &FunctionInfo::Create);
   initializeSignalHandlers();
 }
 
@@ -899,7 +897,7 @@
 //                        Dispatch and Execution Code
 //===----------------------------------------------------------------------===//
 
-FunctionInfo::FunctionInfo(Function *F) : Annotation(FunctionInfoAID) {
+FunctionInfo::FunctionInfo(Function *F) {
   // Assign slot numbers to the function arguments...
   for (Function::const_aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI)
     AI->addAnnotation(new SlotNumber(getValueSlot(AI)));
@@ -959,11 +957,12 @@
   // the function.  Also calculate the number of values for each type slot
   // active.
   //
-  FunctionInfo *FuncInfo =
-    (FunctionInfo*)F->getOrCreateAnnotation(FunctionInfoAID);
-  ECStack.push_back(ExecutionContext());         // Make a new stack frame...
+  FunctionInfo *&FuncInfo = FunctionInfoMap[F];
+  if (!FuncInfo) FuncInfo = new FunctionInfo(F);
 
-  ExecutionContext &StackFrame = ECStack.back(); // Fill it in...
+  // Make a new stack frame... and fill it in.
+  ECStack.push_back(ExecutionContext());
+  ExecutionContext &StackFrame = ECStack.back();
   StackFrame.CurFunction = F;
   StackFrame.CurBB     = F->begin();
   StackFrame.CurInst   = StackFrame.CurBB->begin();


Index: llvm/lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h
diff -u llvm/lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h:1.11 llvm/lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h:1.12
--- llvm/lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h:1.11	Thu Sep  4 18:15:40 2003
+++ llvm/lib/ExecutionEngine/Interpreter/ExecutionAnnotations.h	Wed Sep 17 12:26:22 2003
@@ -15,23 +15,9 @@
 // information about the function, including the number of types present in the
 // function, and the number of values for each type.
 //
-// This annotation object is created on demand, and attaches other annotation
-// objects to the instructions in the function when it's created.
-//
-static AnnotationID FunctionInfoAID(
-	            AnnotationManager::getID("Interpreter::FunctionInfo"));
-
-struct FunctionInfo : public Annotation {
+struct FunctionInfo {
   FunctionInfo(Function *F);
   std::vector<unsigned> NumPlaneElements;
-
-  // Create - Factory function to allow FunctionInfo annotations to be
-  // created on demand.
-  //
-  static Annotation *Create(AnnotationID AID, const Annotable *O, void *) {
-    assert(AID == FunctionInfoAID);
-    return new FunctionInfo(cast<Function>((Value*)O));
-  }
 
 private:
   unsigned getValueSlot(const Value *V);


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.42 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.43
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.42	Fri Sep  5 15:08:10 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h	Wed Sep 17 12:26:22 2003
@@ -82,6 +82,8 @@
   // AtExitHandlers - List of functions to call when the program exits,
   // registered with the atexit() library function.
   std::vector<Function*> AtExitHandlers;
+
+  std::map<Function*, FunctionInfo*> FunctionInfoMap;
 public:
   Interpreter(Module *M, bool isLittleEndian, bool isLongPointer,
               bool TraceMode);





More information about the llvm-commits mailing list