mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5298 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
83435fbaf9
commit
1531b63421
@ -302,73 +302,6 @@ GetMemInstArgs(InstructionNode* memInstrNode,
|
||||
: ptrVal;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// 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.
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
Set2OperandsFromInstr(MachineInstr* minstr,
|
||||
InstructionNode* vmInstrNode,
|
||||
const TargetMachine& target,
|
||||
bool canDiscardResult,
|
||||
int op1Position,
|
||||
int resultPosition)
|
||||
{
|
||||
Set3OperandsFromInstr(minstr, vmInstrNode, target,
|
||||
canDiscardResult, op1Position,
|
||||
/*op2Position*/ -1, resultPosition);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Set3OperandsFromInstr(MachineInstr* minstr,
|
||||
InstructionNode* vmInstrNode,
|
||||
const TargetMachine& target,
|
||||
bool canDiscardResult,
|
||||
int op1Position,
|
||||
int op2Position,
|
||||
int resultPosition)
|
||||
{
|
||||
assert(op1Position >= 0);
|
||||
assert(resultPosition >= 0);
|
||||
|
||||
// operand 1
|
||||
minstr->SetMachineOperandVal(op1Position, MachineOperand::MO_VirtualRegister,
|
||||
vmInstrNode->leftChild()->getValue());
|
||||
|
||||
// operand 2 (if any)
|
||||
if (op2Position >= 0)
|
||||
minstr->SetMachineOperandVal(op2Position, MachineOperand::MO_VirtualRegister,
|
||||
vmInstrNode->rightChild()->getValue());
|
||||
|
||||
// result operand: if it can be discarded, use a dead register if one exists
|
||||
if (canDiscardResult && target.getRegInfo().getZeroRegNum() >= 0)
|
||||
minstr->SetMachineOperandReg(resultPosition,
|
||||
target.getRegInfo().getZeroRegNum());
|
||||
else
|
||||
minstr->SetMachineOperandVal(resultPosition,
|
||||
MachineOperand::MO_VirtualRegister, vmInstrNode->getValue());
|
||||
}
|
||||
|
||||
|
||||
MachineOperand::MachineOperandType
|
||||
ChooseRegOrImmed(int64_t intValue,
|
||||
bool isSigned,
|
||||
|
@ -302,73 +302,6 @@ GetMemInstArgs(InstructionNode* memInstrNode,
|
||||
: ptrVal;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// 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.
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
Set2OperandsFromInstr(MachineInstr* minstr,
|
||||
InstructionNode* vmInstrNode,
|
||||
const TargetMachine& target,
|
||||
bool canDiscardResult,
|
||||
int op1Position,
|
||||
int resultPosition)
|
||||
{
|
||||
Set3OperandsFromInstr(minstr, vmInstrNode, target,
|
||||
canDiscardResult, op1Position,
|
||||
/*op2Position*/ -1, resultPosition);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Set3OperandsFromInstr(MachineInstr* minstr,
|
||||
InstructionNode* vmInstrNode,
|
||||
const TargetMachine& target,
|
||||
bool canDiscardResult,
|
||||
int op1Position,
|
||||
int op2Position,
|
||||
int resultPosition)
|
||||
{
|
||||
assert(op1Position >= 0);
|
||||
assert(resultPosition >= 0);
|
||||
|
||||
// operand 1
|
||||
minstr->SetMachineOperandVal(op1Position, MachineOperand::MO_VirtualRegister,
|
||||
vmInstrNode->leftChild()->getValue());
|
||||
|
||||
// operand 2 (if any)
|
||||
if (op2Position >= 0)
|
||||
minstr->SetMachineOperandVal(op2Position, MachineOperand::MO_VirtualRegister,
|
||||
vmInstrNode->rightChild()->getValue());
|
||||
|
||||
// result operand: if it can be discarded, use a dead register if one exists
|
||||
if (canDiscardResult && target.getRegInfo().getZeroRegNum() >= 0)
|
||||
minstr->SetMachineOperandReg(resultPosition,
|
||||
target.getRegInfo().getZeroRegNum());
|
||||
else
|
||||
minstr->SetMachineOperandVal(resultPosition,
|
||||
MachineOperand::MO_VirtualRegister, vmInstrNode->getValue());
|
||||
}
|
||||
|
||||
|
||||
MachineOperand::MachineOperandType
|
||||
ChooseRegOrImmed(int64_t intValue,
|
||||
bool isSigned,
|
||||
|
Loading…
x
Reference in New Issue
Block a user