Remove all traces of the "Opcode Mask" field in the MachineInstr class
[oota-llvm.git] / include / llvm / CodeGen / InstrSelection.h
1 //===-- llvm/CodeGen/InstrSelection.h --------------------------*- C++ -*--===//
2 //
3 // External interface to instruction selection.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_CODEGEN_INSTR_SELECTION_H
8 #define LLVM_CODEGEN_INSTR_SELECTION_H
9
10 #include "llvm/Instruction.h"
11 class Function;
12 class InstrForest;
13 class MachineInstr;
14 class InstructionNode;
15 class TargetMachine;
16 class Pass;
17
18 //===--------------------- Required Functions ---------------------------------
19 // Target-dependent functions that MUST be implemented for each target.
20 //
21
22 const unsigned MAX_INSTR_PER_VMINSTR = 8;
23
24 extern void     GetInstructionsByRule   (InstructionNode* subtreeRoot,
25                                          int ruleForNode,
26                                          short* nts,
27                                          TargetMachine &Target,
28                                          std::vector<MachineInstr*>& mvec);
29
30 extern bool     ThisIsAChainRule        (int eruleno);
31
32
33 //************************ Exported Functions ******************************/
34
35
36 //---------------------------------------------------------------------------
37 // Function: createInstructionSelectionPass
38 // 
39 // Purpose:
40 //   Entry point for instruction selection using BURG.
41 //   Return a pass that performs machine dependant instruction selection.
42 //---------------------------------------------------------------------------
43
44 Pass *createInstructionSelectionPass(TargetMachine &Target);
45
46
47 //************************ Exported Data Types *****************************/
48
49
50 //---------------------------------------------------------------------------
51 // class TmpInstruction
52 //
53 //   This class represents temporary intermediate values
54 //   used within the machine code for a VM instruction
55 //---------------------------------------------------------------------------
56
57 class TmpInstruction : public Instruction {
58   TmpInstruction(const TmpInstruction &TI)
59     : Instruction(TI.getType(), TI.getOpcode()) {
60     if (!TI.Operands.empty()) {
61       Operands.push_back(Use(TI.Operands[0], this));
62       if (TI.Operands.size() == 2)
63         Operands.push_back(Use(TI.Operands[1], this));
64       else
65         assert(0 && "Bad # operands to TmpInstruction!");
66     }
67   }
68 public:
69   // Constructor that uses the type of S1 as the type of the temporary.
70   // s1 must be a valid value.  s2 may be NULL.
71   TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = "");
72   
73   // Constructor that requires the type of the temporary to be specified.
74   // Both S1 and S2 may be NULL.
75   TmpInstruction(const Type *Ty, Value *s1 = 0, Value* s2 = 0,
76                  const std::string &name = "");
77   
78   virtual Instruction *clone() const { return new TmpInstruction(*this); }
79   virtual const char *getOpcodeName() const {
80     return "TempValueForMachineInstr";
81   }
82   
83   // Methods for support type inquiry through isa, cast, and dyn_cast:
84   static inline bool classof(const TmpInstruction *) { return true; }
85   static inline bool classof(const Instruction *I) {
86     return (I->getOpcode() == Instruction::UserOp1);
87   }
88   static inline bool classof(const Value *V) {
89     return isa<Instruction>(V) && classof(cast<Instruction>(V));
90   }
91 };
92
93 #endif