mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
Rather than having printMemOperand change the way memory operands are printed
based on a modifier, split it into two functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134637 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -359,17 +359,7 @@ void MipsAsmPrinter::printUnsignedImm(const MachineInstr *MI, int opNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::
|
||||||
printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O) {
|
||||||
const char *Modifier) {
|
|
||||||
// when using stack locations for not load/store instructions
|
|
||||||
// print the same way as all normal 3 operand instructions.
|
|
||||||
if (Modifier && !strcmp(Modifier, "stackloc")) {
|
|
||||||
printOperand(MI, opNum, O);
|
|
||||||
O << ", ";
|
|
||||||
printOperand(MI, opNum+1, O);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load/Store memory operands -- imm($reg)
|
// Load/Store memory operands -- imm($reg)
|
||||||
// If PIC target the target is loaded as the
|
// If PIC target the target is loaded as the
|
||||||
// pattern lw $25,%call16($28)
|
// pattern lw $25,%call16($28)
|
||||||
@ -379,6 +369,16 @@ printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
|||||||
O << ")";
|
O << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MipsAsmPrinter::
|
||||||
|
printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O) {
|
||||||
|
// when using stack locations for not load/store instructions
|
||||||
|
// print the same way as all normal 3 operand instructions.
|
||||||
|
printOperand(MI, opNum, O);
|
||||||
|
O << ", ";
|
||||||
|
printOperand(MI, opNum+1, O);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void MipsAsmPrinter::
|
void MipsAsmPrinter::
|
||||||
printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
||||||
const char *Modifier) {
|
const char *Modifier) {
|
||||||
|
@ -61,8 +61,8 @@ public:
|
|||||||
raw_ostream &O);
|
raw_ostream &O);
|
||||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||||
void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
|
void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||||
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||||
const char *Modifier = 0);
|
void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||||
void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
||||||
const char *Modifier = 0);
|
const char *Modifier = 0);
|
||||||
void EmitStartOfAsmFile(Module &M);
|
void EmitStartOfAsmFile(Module &M);
|
||||||
|
@ -137,6 +137,11 @@ def mem : Operand<i32> {
|
|||||||
let MIOperandInfo = (ops CPURegs, simm16);
|
let MIOperandInfo = (ops CPURegs, simm16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def mem_ea : Operand<i32> {
|
||||||
|
let PrintMethod = "printMemOperandEA";
|
||||||
|
let MIOperandInfo = (ops CPURegs, simm16);
|
||||||
|
}
|
||||||
|
|
||||||
// Transformation Function - get the lower 16 bits.
|
// Transformation Function - get the lower 16 bits.
|
||||||
def LO16 : SDNodeXForm<imm, [{
|
def LO16 : SDNodeXForm<imm, [{
|
||||||
return getI32Imm((unsigned)N->getZExtValue() & 0xFFFF);
|
return getI32Imm((unsigned)N->getZExtValue() & 0xFFFF);
|
||||||
@ -351,7 +356,7 @@ class MoveToLOHI<bits<6> func, string instr_asm>:
|
|||||||
!strconcat(instr_asm, "\t$src"), [], IIHiLo>;
|
!strconcat(instr_asm, "\t$src"), [], IIHiLo>;
|
||||||
|
|
||||||
class EffectiveAddress<string instr_asm> :
|
class EffectiveAddress<string instr_asm> :
|
||||||
FI<0x09, (outs CPURegs:$dst), (ins mem:$addr),
|
FI<0x09, (outs CPURegs:$dst), (ins mem_ea:$addr),
|
||||||
instr_asm, [(set CPURegs:$dst, addr:$addr)], IIAlu>;
|
instr_asm, [(set CPURegs:$dst, addr:$addr)], IIAlu>;
|
||||||
|
|
||||||
// Count Leading Ones/Zeros in Word
|
// Count Leading Ones/Zeros in Word
|
||||||
@ -680,13 +685,13 @@ let addr=0 in
|
|||||||
// instructions. The same not happens for stack address copies, so an
|
// instructions. The same not happens for stack address copies, so an
|
||||||
// add op with mem ComplexPattern is used and the stack address copy
|
// add op with mem ComplexPattern is used and the stack address copy
|
||||||
// can be matched. It's similar to Sparc LEA_ADDRi
|
// can be matched. It's similar to Sparc LEA_ADDRi
|
||||||
def LEA_ADDiu : EffectiveAddress<"addiu\t$dst, ${addr:stackloc}">;
|
def LEA_ADDiu : EffectiveAddress<"addiu\t$dst, $addr">;
|
||||||
|
|
||||||
// DynAlloc node points to dynamically allocated stack space.
|
// DynAlloc node points to dynamically allocated stack space.
|
||||||
// $sp is added to the list of implicitly used registers to prevent dead code
|
// $sp is added to the list of implicitly used registers to prevent dead code
|
||||||
// elimination from removing instructions that modify $sp.
|
// elimination from removing instructions that modify $sp.
|
||||||
let Uses = [SP] in
|
let Uses = [SP] in
|
||||||
def DynAlloc : EffectiveAddress<"addiu\t$dst, ${addr:stackloc}">;
|
def DynAlloc : EffectiveAddress<"addiu\t$dst, $addr">;
|
||||||
|
|
||||||
// MADD*/MSUB*
|
// MADD*/MSUB*
|
||||||
def MADD : MArithR<0, "madd", MipsMAdd, 1>;
|
def MADD : MArithR<0, "madd", MipsMAdd, 1>;
|
||||||
|
Reference in New Issue
Block a user