mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-29 08:16:51 +00:00
Add support for external symbols, and support for variable arity instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23022 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -82,16 +82,20 @@ unsigned SimpleSched::Emit(SDOperand Op) {
|
|||||||
unsigned NumResults = Op.Val->getNumValues();
|
unsigned NumResults = Op.Val->getNumValues();
|
||||||
if (NumResults && Op.Val->getValueType(NumResults-1) == MVT::Other)
|
if (NumResults && Op.Val->getValueType(NumResults-1) == MVT::Other)
|
||||||
--NumResults;
|
--NumResults;
|
||||||
|
|
||||||
|
unsigned NodeOperands = Op.getNumOperands();
|
||||||
|
if (NodeOperands && // Ignore chain if it exists.
|
||||||
|
Op.getOperand(NodeOperands-1).getValueType() == MVT::Other)
|
||||||
|
--NodeOperands;
|
||||||
|
|
||||||
|
unsigned NumMIOperands = NodeOperands+NumResults;
|
||||||
#ifndef _NDEBUG
|
#ifndef _NDEBUG
|
||||||
unsigned Operands = Op.getNumOperands();
|
assert((unsigned(II.numOperands) == NumMIOperands || II.numOperands == -1)&&
|
||||||
if (Operands && Op.getOperand(Operands-1).getValueType() == MVT::Other)
|
|
||||||
--Operands;
|
|
||||||
assert(unsigned(II.numOperands) == Operands+NumResults &&
|
|
||||||
"#operands for dag node doesn't match .td file!");
|
"#operands for dag node doesn't match .td file!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the new machine instruction.
|
// Create the new machine instruction.
|
||||||
MachineInstr *MI = new MachineInstr(Opc, II.numOperands, true, true);
|
MachineInstr *MI = new MachineInstr(Opc, NumMIOperands, true, true);
|
||||||
|
|
||||||
// Add result register values for things that are defined by this
|
// Add result register values for things that are defined by this
|
||||||
// instruction.
|
// instruction.
|
||||||
@@ -136,6 +140,9 @@ unsigned SimpleSched::Emit(SDOperand Op) {
|
|||||||
} else if (ConstantPoolSDNode *CP =
|
} else if (ConstantPoolSDNode *CP =
|
||||||
dyn_cast<ConstantPoolSDNode>(Op.getOperand(i))) {
|
dyn_cast<ConstantPoolSDNode>(Op.getOperand(i))) {
|
||||||
MI->addConstantPoolIndexOperand(CP->getIndex());
|
MI->addConstantPoolIndexOperand(CP->getIndex());
|
||||||
|
} else if (ExternalSymbolSDNode *ES =
|
||||||
|
dyn_cast<ExternalSymbolSDNode>(Op.getOperand(i))) {
|
||||||
|
MI->addExternalSymbolOperand(ES->getSymbol(), false);
|
||||||
} else {
|
} else {
|
||||||
unsigned R = Emit(Op.getOperand(i));
|
unsigned R = Emit(Op.getOperand(i));
|
||||||
// Add an operand, unless this corresponds to a chain node.
|
// Add an operand, unless this corresponds to a chain node.
|
||||||
|
|||||||
Reference in New Issue
Block a user