mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +00:00
Need to subtract, not add, stack size in SAVE instruction!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1011,7 +1011,7 @@ GetInstructionsForProlog(BasicBlock* entryBB,
|
|||||||
mvec[0] = new MachineInstr(SAVE);
|
mvec[0] = new MachineInstr(SAVE);
|
||||||
mvec[0]->SetMachineOperand(0, target.getRegInfo().getStackPointer());
|
mvec[0]->SetMachineOperand(0, target.getRegInfo().getStackPointer());
|
||||||
mvec[0]->SetMachineOperand(1, MachineOperand::MO_SignExtendedImmed,
|
mvec[0]->SetMachineOperand(1, MachineOperand::MO_SignExtendedImmed,
|
||||||
staticStackSize);
|
- staticStackSize);
|
||||||
mvec[0]->SetMachineOperand(2, target.getRegInfo().getStackPointer());
|
mvec[0]->SetMachineOperand(2, target.getRegInfo().getStackPointer());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1519,8 +1519,11 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
case 42: // bool: SetCC(reg, reg):
|
case 42: // bool: SetCC(reg, reg):
|
||||||
{
|
{
|
||||||
// If result of the SetCC is only used for a single branch, we can
|
// If result of the SetCC is only used for a single branch, we can
|
||||||
// discard the result. Otherwise, the boolean value must go into
|
// discard the boolean result and keep only the condition code.
|
||||||
// an integer register.
|
// Otherwise, the boolean value must go into an integer register.
|
||||||
|
// To put the boolean result in a register we use a conditional move,
|
||||||
|
// unless the result of the SUBCC instruction can be used as the bool!
|
||||||
|
// This assumes that zero is FALSE and any non-zero integer is TRUE.
|
||||||
//
|
//
|
||||||
bool keepBoolVal = (subtreeRoot->parent() == NULL ||
|
bool keepBoolVal = (subtreeRoot->parent() == NULL ||
|
||||||
((InstructionNode*) subtreeRoot->parent())
|
((InstructionNode*) subtreeRoot->parent())
|
||||||
|
|||||||
Reference in New Issue
Block a user