Chris Lattner | f2868ce | 2002-02-03 07:54:50 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/MachineCodeForInstruction.h -----------------*- C++ -*--=// |
| 2 | // |
| 3 | // Representation of the sequence of machine instructions created |
| 4 | // for a single VM instruction. Additionally records information |
| 5 | // about hidden and implicit values used by the machine instructions: |
| 6 | // about hidden values used by the machine instructions: |
| 7 | // |
| 8 | // "Temporary values" are intermediate values used in the machine |
| 9 | // instruction sequence, but not in the VM instruction |
| 10 | // Note that such values should be treated as pure SSA values with |
| 11 | // no interpretation of their operands (i.e., as a TmpInstruction |
| 12 | // object which actually represents such a value). |
| 13 | // |
| 14 | // (2) "Implicit uses" are values used in the VM instruction but not in |
| 15 | // the machine instruction sequence |
| 16 | // |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
| 19 | #ifndef LLVM_CODEGEN_MACHINECODE_FOR_INSTRUCTION_H |
| 20 | #define LLVM_CODEGEN_MACHINECODE_FOR_INSTRUCTION_H |
| 21 | |
| 22 | #include "llvm/Annotation.h" |
| 23 | #include <vector> |
| 24 | class MachineInstr; |
| 25 | class Instruction; |
| 26 | class Value; |
| 27 | |
| 28 | class MachineCodeForInstruction |
| 29 | : public Annotation, public std::vector<MachineInstr*> { |
| 30 | std::vector<Value*> tempVec; // used by m/c instr but not VM instr |
| 31 | |
| 32 | public: |
| 33 | MachineCodeForInstruction(); |
| 34 | ~MachineCodeForInstruction(); |
| 35 | |
| 36 | static MachineCodeForInstruction &get(const Instruction *I); |
| 37 | static void destroy(const Instruction *I); |
| 38 | |
| 39 | const std::vector<Value*> &getTempValues() const { return tempVec; } |
| 40 | std::vector<Value*> &getTempValues() { return tempVec; } |
| 41 | |
| 42 | inline MachineCodeForInstruction &addTemp(Value *tmp) { |
| 43 | tempVec.push_back(tmp); |
| 44 | return *this; |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | #endif |