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