Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 1 | //===-- ExecutionAnnotations.h ---------------------------------*- C++ -*--===// |
| 2 | // |
| 3 | // This header file defines annotations used by the execution engine. |
| 4 | // |
| 5 | //===----------------------------------------------------------------------===// |
| 6 | |
| 7 | #ifndef LLI_EXECUTION_ANNOTATIONS_H |
| 8 | #define LLI_EXECUTION_ANNOTATIONS_H |
| 9 | |
| 10 | //===----------------------------------------------------------------------===// |
Chris Lattner | da82ed5 | 2003-05-08 16:18:31 +0000 | [diff] [blame] | 11 | // Support for FunctionInfo annotations |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 14 | // This annotation (attached only to Function objects) is used to cache useful |
| 15 | // information about the function, including the number of types present in the |
| 16 | // function, and the number of values for each type. |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 17 | // |
Chris Lattner | 63bd613 | 2003-09-17 17:26:22 +0000 | [diff] [blame^] | 18 | struct FunctionInfo { |
Chris Lattner | da82ed5 | 2003-05-08 16:18:31 +0000 | [diff] [blame] | 19 | FunctionInfo(Function *F); |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 20 | std::vector<unsigned> NumPlaneElements; |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 21 | |
| 22 | private: |
| 23 | unsigned getValueSlot(const Value *V); |
| 24 | }; |
| 25 | |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 26 | //===----------------------------------------------------------------------===// |
| 27 | // Support for the SlotNumber annotation |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
Chris Lattner | b972f95 | 2002-04-09 19:40:40 +0000 | [diff] [blame] | 30 | // This annotation (attached only to Argument & Instruction objects) is used to |
| 31 | // hold the the slot number for the value in its type plane. |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 32 | // |
| 33 | // Entities have this annotation attached to them when the containing |
Chris Lattner | da82ed5 | 2003-05-08 16:18:31 +0000 | [diff] [blame] | 34 | // function has it's FunctionInfo created (by the FunctionInfo ctor). |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 35 | // |
| 36 | static AnnotationID SlotNumberAID( |
| 37 | AnnotationManager::getID("Interpreter::SlotNumber")); |
| 38 | |
| 39 | struct SlotNumber : public Annotation { |
| 40 | unsigned SlotNum; // Ranges from 0-> |
| 41 | |
| 42 | SlotNumber(unsigned sn) : Annotation(SlotNumberAID), |
| 43 | SlotNum(sn) {} |
| 44 | }; |
| 45 | |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 46 | //===----------------------------------------------------------------------===// |
| 47 | // Support for the InstNumber annotation |
| 48 | //===----------------------------------------------------------------------===// |
| 49 | |
| 50 | // This annotation (attached only to Instruction objects) is used to hold the |
| 51 | // instruction number of the instruction, and the slot number for the value in |
| 52 | // its type plane. InstNumber's are used for user interaction, and for |
| 53 | // calculating which value slot to store the result of the instruction in. |
| 54 | // |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 55 | // Instructions have this annotation attached to them when the containing |
Chris Lattner | da82ed5 | 2003-05-08 16:18:31 +0000 | [diff] [blame] | 56 | // function has it's FunctionInfo created (by the FunctionInfo ctor). |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 57 | // |
| 58 | struct InstNumber : public SlotNumber { |
| 59 | unsigned InstNum; // Ranges from 1-> |
| 60 | |
| 61 | InstNumber(unsigned in, unsigned sn) : SlotNumber(sn), InstNum(in) {} |
| 62 | }; |
| 63 | |
Chris Lattner | 92101ac | 2001-08-23 17:05:04 +0000 | [diff] [blame] | 64 | #endif |