const unsigned MAX_INSTR_PER_VMINSTR = 8;
+const Instruction::OtherOps TMP_INSTRUCTION_OPCODE = Instruction::UserOp1;
+
extern unsigned GetInstructionsByRule (InstructionNode* subtreeRoot,
int ruleForNode,
short* nts,
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)
//************************ Exported Functions ******************************/
+//---------------------------------------------------------------------------
+// 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
//
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