blob: 03e02501cb9d2fcb406a02fa9203d34c88e3a7e4 [file] [log] [blame]
Chris Lattnerf2868ce2002-02-03 07:54:50 +00001//===-- 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>
24class MachineInstr;
25class Instruction;
26class Value;
27
28class MachineCodeForInstruction
29 : public Annotation, public std::vector<MachineInstr*> {
30 std::vector<Value*> tempVec; // used by m/c instr but not VM instr
31
32public:
33 MachineCodeForInstruction();
34 ~MachineCodeForInstruction();
35
36 static MachineCodeForInstruction &get(const Instruction *I);
37 static void destroy(const Instruction *I);
38
Vikram S. Advedfe412d2002-03-24 03:58:02 +000039 // dropAllReferences() - This function drops all references within
40 // temporary (hidden) instructions created in implementing the original
41 // VM intruction. This ensures there are no remaining "uses" within
42 // these hidden instructions, before the values of a method are freed.
43 //
44 void dropAllReferences();
45
Chris Lattnerf2868ce2002-02-03 07:54:50 +000046 const std::vector<Value*> &getTempValues() const { return tempVec; }
47 std::vector<Value*> &getTempValues() { return tempVec; }
48
49 inline MachineCodeForInstruction &addTemp(Value *tmp) {
50 tempVec.push_back(tmp);
51 return *this;
52 }
53};
54
55#endif