diff --git a/include/llvm/CodeGen/InstrSelection.h b/include/llvm/CodeGen/InstrSelection.h index e07ebd7a333..632d37c85b7 100644 --- a/include/llvm/CodeGen/InstrSelection.h +++ b/include/llvm/CodeGen/InstrSelection.h @@ -4,10 +4,11 @@ // InstrSelection.h // // Purpose: -// +// External interface to instruction selection. +// // History: // 7/02/01 - Vikram Adve - Created -//*************************************************************************** +//**************************************************************************/ #ifndef LLVM_CODEGEN_INSTR_SELECTION_H #define LLVM_CODEGEN_INSTR_SELECTION_H @@ -21,10 +22,10 @@ class TmpInstruction; class ConstPoolVal; class TargetMachine; -//--------------------------------------------------------------------------- -// GLOBAL data and an external function that must be implemented -// for each architecture. -//--------------------------------------------------------------------------- + +/************************* Required Functions ******************************* + * Target-dependent functions that MUST be implemented for each target. + ***************************************************************************/ const unsigned MAX_INSTR_PER_VMINSTR = 8; @@ -37,7 +38,7 @@ extern unsigned GetInstructionsByRule (InstructionNode* subtreeRoot, extern bool ThisIsAChainRule (int eruleno); -//************************ Exported Data Types *****************************/ +//************************ Exported Functions ******************************/ //--------------------------------------------------------------------------- @@ -52,17 +53,8 @@ extern bool ThisIsAChainRule (int eruleno); bool SelectInstructionsForMethod (Method* method, TargetMachine &Target); -//--------------------------------------------------------------------------- -// Function: FoldGetElemChain -// -// Purpose: -// Fold a chain of GetElementPtr instructions into an equivalent -// (Pointer, IndexVector) pair. Returns the pointer Value, and -// stores the resulting IndexVector in argument chainIdxVec. -//--------------------------------------------------------------------------- -Value* FoldGetElemChain (const InstructionNode* getElemInstrNode, - vector& chainIdxVec); +//************************ Exported Data Types *****************************/ //--------------------------------------------------------------------------- diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 21976a099b5..a679590851f 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -380,18 +380,21 @@ public: class MachineCodeForVMInstr: public vector { private: - vector< Value*> tempVec; // used by m/c instr but not VM instr - vector implicitUses; // used by VM instr but not m/c instr + vector tempVec; // used by m/c instr but not VM instr + vector implicitUses; // used by VM instr but not m/c instr public: /*ctor*/ MachineCodeForVMInstr () {} /*ctor*/ ~MachineCodeForVMInstr (); - const vector< Value*>& getTempValues () const { return tempVec; } - const vector& getImplicitUses() const { return implicitUses; } + const vector& getTempValues () const { return tempVec; } + vector& getTempValues () { return tempVec; } - void addTempValue ( Value* val) { tempVec.push_back(val); } - void addImplicitUse(const Value* val) { implicitUses.push_back(val);} + const vector& getImplicitUses() const { return implicitUses; } + vector& getImplicitUses() { return implicitUses; } + + void addTempValue (Value* val) { tempVec.push_back(val); } + void addImplicitUse(Value* val) { implicitUses.push_back(val);} // dropAllReferences() - This function drops all references within // temporary (hidden) instructions created in implementing the original @@ -437,65 +440,17 @@ public: //--------------------------------------------------------------------------- -// Target-independent utility routines for creating machine instructions +// Debugging Support //--------------------------------------------------------------------------- -//------------------------------------------------------------------------ -// Function Set2OperandsFromInstr -// Function Set3OperandsFromInstr -// -// For the common case of 2- and 3-operand arithmetic/logical instructions, -// set the m/c instr. operands directly from the VM instruction's operands. -// Check whether the first or second operand is 0 and can use a dedicated -// "0" register. -// Check whether the second operand should use an immediate field or register. -// (First and third operands are never immediates for such instructions.) -// -// Arguments: -// canDiscardResult: Specifies that the result operand can be discarded -// by using the dedicated "0" -// -// op1position, op2position and resultPosition: Specify in which position -// in the machine instruction the 3 operands (arg1, arg2 -// and result) should go. -// -// RETURN VALUE: unsigned int flags, where -// flags & 0x01 => operand 1 is constant and needs a register -// flags & 0x02 => operand 2 is constant and needs a register -//------------------------------------------------------------------------ - -void Set2OperandsFromInstr (MachineInstr* minstr, - InstructionNode* vmInstrNode, - const TargetMachine& targetMachine, - bool canDiscardResult = false, - int op1Position = 0, - int resultPosition = 1); - -void Set3OperandsFromInstr (MachineInstr* minstr, - InstructionNode* vmInstrNode, - const TargetMachine& targetMachine, - bool canDiscardResult = false, - int op1Position = 0, - int op2Position = 1, - int resultPosition = 2); - -MachineOperand::MachineOperandType - ChooseRegOrImmed(Value* val, - MachineOpCode opCode, - const TargetMachine& targetMachine, - bool canUseImmed, - unsigned int& getMachineRegNum, - int64_t& getImmedValue); +ostream& operator<< (ostream& os, const MachineInstr& minstr); -ostream& operator<<(ostream& os, const MachineInstr& minstr); - - -ostream& operator<<(ostream& os, const MachineOperand& mop); +ostream& operator<< (ostream& os, const MachineOperand& mop); -void PrintMachineInstructions (const Method *method); +void PrintMachineInstructions(const Method *method); //**************************************************************************/