diff options
| -rw-r--r-- | llvm/include/llvm/CodeGen/InstrSelection.h | 5 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/InstrSelectionSupport.h | 38 | 
2 files changed, 42 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/InstrSelection.h b/llvm/include/llvm/CodeGen/InstrSelection.h index 632d37c85b7..8010614d67f 100644 --- a/llvm/include/llvm/CodeGen/InstrSelection.h +++ b/llvm/include/llvm/CodeGen/InstrSelection.h @@ -29,6 +29,8 @@ class TargetMachine;  const unsigned MAX_INSTR_PER_VMINSTR = 8; +const Instruction::OtherOps TMP_INSTRUCTION_OPCODE = Instruction::UserOp1; +  extern unsigned	GetInstructionsByRule	(InstructionNode* subtreeRoot,  					 int ruleForNode,  					 short* nts, @@ -74,7 +76,8 @@ public:    TmpInstruction(OtherOps Opcode, Value *S1, Value* S2, const string &Name = "")      : Instruction(S1->getType(), Opcode, Name)    { -    assert(Opcode == UserOp1 && "Tmp instruction opcode invalid!"); +    assert(Opcode == TMP_INSTRUCTION_OPCODE && +           "Tmp instruction opcode invalid!");      Operands.reserve(S2? 2 : 1);      Operands.push_back(Use(S1, this));      if (S2) diff --git a/llvm/include/llvm/CodeGen/InstrSelectionSupport.h b/llvm/include/llvm/CodeGen/InstrSelectionSupport.h index 5253ef8cc45..7d11e206b51 100644 --- a/llvm/include/llvm/CodeGen/InstrSelectionSupport.h +++ b/llvm/include/llvm/CodeGen/InstrSelectionSupport.h @@ -28,6 +28,23 @@ class TargetMachine;  //--------------------------------------------------------------------------- +// Function GetConstantValueAsSignedInt +//  +// Convenience function to get the value of an integer constant, for an +// appropriate integer or non-integer type that can be held in an integer. +// The type of the argument must be the following: +//      Signed or unsigned integer +//      Boolean +//      Pointer +//  +// isValidConstant is set to true if a valid constant was found. +//--------------------------------------------------------------------------- + +int64_t         GetConstantValueAsSignedInt     (const Value *V, +                                                 bool &isValidConstant); + + +//---------------------------------------------------------------------------  // Function: FoldGetElemChain  //   // Purpose: @@ -97,6 +114,27 @@ MachineOperand::MachineOperandType                                           unsigned int& getMachineRegNum,                                           int64_t& getImmedValue); + +//--------------------------------------------------------------------------- +// Function: FixConstantOperandsForInstr +//  +// Purpose: +// Special handling for constant operands of a machine instruction +// -- if the constant is 0, use the hardwired 0 register, if any; +// -- if the constant fits in the IMMEDIATE field, use that field; +// -- else create instructions to put the constant into a register, either +//    directly or by loading explicitly from the constant pool. +//  +// In the first 2 cases, the operand of `minstr' is modified in place. +// Returns a vector of machine instructions generated for operands that +// fall under case 3; these must be inserted before `minstr'. +//--------------------------------------------------------------------------- + +vector<MachineInstr*> FixConstantOperandsForInstr (Instruction* vmInstr, +                                                   MachineInstr* minstr, +                                                   TargetMachine& target); + +  //**************************************************************************/  #endif  | 

