aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SparcV9/MachineCodeForInstruction.h
blob: 03e02501cb9d2fcb406a02fa9203d34c88e3a7e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//===-- llvm/CodeGen/MachineCodeForInstruction.h -----------------*- C++ -*--=//
//
//   Representation of the sequence of machine instructions created
//   for a single VM instruction.  Additionally records information
//   about hidden and implicit values used by the machine instructions:
//   about hidden values used by the machine instructions:
// 
//   "Temporary values" are intermediate values used in the machine
//   instruction sequence, but not in the VM instruction
//   Note that such values should be treated as pure SSA values with
//   no interpretation of their operands (i.e., as a TmpInstruction
//   object which actually represents such a value).
// 
//   (2) "Implicit uses" are values used in the VM instruction but not in
//       the machine instruction sequence
// 
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_MACHINECODE_FOR_INSTRUCTION_H
#define LLVM_CODEGEN_MACHINECODE_FOR_INSTRUCTION_H

#include "llvm/Annotation.h"
#include <vector>
class MachineInstr;
class Instruction;
class Value;

class MachineCodeForInstruction 
                  : public Annotation, public std::vector<MachineInstr*> {
  std::vector<Value*> tempVec;         // used by m/c instr but not VM instr
  
public:
  MachineCodeForInstruction();
  ~MachineCodeForInstruction();
  
  static MachineCodeForInstruction &get(const Instruction *I);
  static void destroy(const Instruction *I);

  // dropAllReferences() - This function drops all references within
  // temporary (hidden) instructions created in implementing the original
  // VM intruction.  This ensures there are no remaining "uses" within
  // these hidden instructions, before the values of a method are freed.
  //
  void dropAllReferences();

  const std::vector<Value*> &getTempValues() const { return tempVec; }
        std::vector<Value*> &getTempValues()       { return tempVec; }
  
  inline MachineCodeForInstruction &addTemp(Value *tmp) {
    tempVec.push_back(tmp);
    return *this;
  }
};

#endif