mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 06:32:09 +00:00
1. Add a bottom-up pass on BURG trees that is used to fix constant operands.
Needs to be bottom up because constant values may be forward-substituted to their uses (i.e., into the parent in the BURG tree). 2. Move most of the constant-fixup code into machine-indepedent file InstrSelectionSupport.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@860 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6d35326cd5
commit
f60b1f479f
@ -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)
|
||||
|
@ -27,6 +27,23 @@ class TargetMachine;
|
||||
//************************ 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
|
||||
//
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user