mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Mark pattern-less mayLoad / mayStore instructions neverHasSideEffects. These do not have other un-modeled side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104111 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3c3195cbf1
commit
5fd1c9be2d
@ -1141,7 +1141,8 @@ def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr,
|
||||
[(set GPR:$dst, (load addrmode2:$addr))]>;
|
||||
|
||||
// Special LDR for loads from non-pc-relative constpools.
|
||||
let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
|
||||
let canFoldAsLoad = 1, mayLoad = 1, neverHasSideEffects = 1,
|
||||
isReMaterializable = 1 in
|
||||
def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr,
|
||||
"ldr", "\t$dst, $addr", []>;
|
||||
|
||||
@ -1163,7 +1164,7 @@ def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
|
||||
IIC_iLoadr, "ldrsb", "\t$dst, $addr",
|
||||
[(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>;
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
// Load doubleword
|
||||
def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm,
|
||||
IIC_iLoadr, "ldrd", "\t$dst1, $addr",
|
||||
@ -1222,7 +1223,7 @@ def LDRD_POST : AI3lddpo<(outs GPR:$dst1, GPR:$dst2, GPR:$base_wb),
|
||||
"ldrd", "\t$dst1, $dst2, [$base], $offset", "$base = $base_wb", []>,
|
||||
Requires<[IsARM, HasV5TE]>;
|
||||
|
||||
}
|
||||
} // mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1
|
||||
|
||||
// LDRT, LDRBT, LDRSBT, LDRHT, LDRSHT are for disassembly only.
|
||||
|
||||
@ -1271,7 +1272,7 @@ def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer,
|
||||
[(truncstorei8 GPR:$src, addrmode2:$addr)]>;
|
||||
|
||||
// Store doubleword
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr),
|
||||
StMiscFrm, IIC_iStorer,
|
||||
"strd", "\t$src1, $addr", []>, Requires<[IsARM, HasV5TE]>;
|
||||
@ -1363,7 +1364,7 @@ def STRHT: AI3sthpo<(outs GPR:$base_wb),
|
||||
// Load / store multiple Instructions.
|
||||
//
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
def LDM : AXI4ld<(outs), (ins addrmode4:$addr, pred:$p,
|
||||
reglist:$dsts, variable_ops),
|
||||
IndexModeNone, LdStMulFrm, IIC_iLoadm,
|
||||
@ -1374,9 +1375,9 @@ def LDM_UPD : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||
IndexModeUpd, LdStMulFrm, IIC_iLoadm,
|
||||
"ldm${addr:submode}${p}\t$addr!, $dsts",
|
||||
"$addr.addr = $wb", []>;
|
||||
} // mayLoad, hasExtraDefRegAllocReq
|
||||
} // mayLoad, neverHasSideEffects, hasExtraDefRegAllocReq
|
||||
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
def STM : AXI4st<(outs), (ins addrmode4:$addr, pred:$p,
|
||||
reglist:$srcs, variable_ops),
|
||||
IndexModeNone, LdStMulFrm, IIC_iStorem,
|
||||
@ -1387,7 +1388,7 @@ def STM_UPD : AXI4st<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||
IndexModeUpd, LdStMulFrm, IIC_iStorem,
|
||||
"stm${addr:submode}${p}\t$addr!, $srcs",
|
||||
"$addr.addr = $wb", []>;
|
||||
} // mayStore, hasExtraSrcRegAllocReq
|
||||
} // mayStore, neverHasSideEffects, hasExtraSrcRegAllocReq
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Move Instructions.
|
||||
|
@ -115,7 +115,7 @@ def h64imm : Operand<i64> {
|
||||
// NEON load / store instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
let mayLoad = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1 in {
|
||||
// Use vldmia to load a Q register as a D register pair.
|
||||
// This is equivalent to VLDMD except that it has a Q register operand
|
||||
// instead of a pair of D registers.
|
||||
@ -130,9 +130,9 @@ def VLDMQ
|
||||
def VLD1q
|
||||
: NLdSt<0,0b10,0b1010,0b1100, (outs QPR:$dst), (ins addrmode6:$addr),
|
||||
IIC_VLD1, "vld1", "64", "${dst:dregpair}, $addr", "", []>;
|
||||
} // mayLoad = 1
|
||||
} // mayLoad = 1, neverHasSideEffects = 1
|
||||
|
||||
let mayStore = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1 in {
|
||||
// Use vstmia to store a Q register as a D register pair.
|
||||
// This is equivalent to VSTMD except that it has a Q register operand
|
||||
// instead of a pair of D registers.
|
||||
@ -147,9 +147,9 @@ def VSTMQ
|
||||
def VST1q
|
||||
: NLdSt<0,0b00,0b1010,0b1100, (outs), (ins addrmode6:$addr, QPR:$src),
|
||||
IIC_VST, "vst1", "64", "${src:dregpair}, $addr", "", []>;
|
||||
} // mayStore = 1
|
||||
} // mayStore = 1, neverHasSideEffects = 1
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
|
||||
// VLD1 : Vector Load (multiple single elements)
|
||||
class VLD1D<bits<4> op7_4, string Dt>
|
||||
@ -473,9 +473,9 @@ def VLD4LNq32_UPD : VLD4LNWB<0b1011, {?,1,?,?}, "32">;
|
||||
// VLD3DUP : Vector Load (single 3-element structure to all lanes)
|
||||
// VLD4DUP : Vector Load (single 4-element structure to all lanes)
|
||||
// FIXME: Not yet implemented.
|
||||
} // mayLoad = 1, hasExtraDefRegAllocReq = 1
|
||||
} // mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1
|
||||
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
|
||||
// VST1 : Vector Store (multiple single elements)
|
||||
class VST1D<bits<4> op7_4, string Dt>
|
||||
@ -788,7 +788,7 @@ def VST4LNd32_UPD : VST4LNWB<0b1011, {?,0,?,?}, "32">;
|
||||
def VST4LNq16_UPD : VST4LNWB<0b0111, {?,?,1,?}, "16">;
|
||||
def VST4LNq32_UPD : VST4LNWB<0b1011, {?,1,?,?}, "32">;
|
||||
|
||||
} // mayStore = 1, hasExtraSrcRegAllocReq = 1
|
||||
} // mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -480,7 +480,7 @@ def tLDRspi : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi,
|
||||
|
||||
// Special instruction for restore. It cannot clobber condition register
|
||||
// when it's expanded by eliminateCallFramePseudoInstr().
|
||||
let canFoldAsLoad = 1, mayLoad = 1 in
|
||||
let canFoldAsLoad = 1, mayLoad = 1, neverHasSideEffects = 1 in
|
||||
def tRestore : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi,
|
||||
"ldr", "\t$dst, $addr", []>,
|
||||
T1LdStSP<{1,?,?}>;
|
||||
@ -494,7 +494,8 @@ def tLDRpci : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi,
|
||||
T1Encoding<{0,1,0,0,1,?}>; // A6.2 & A8.6.59
|
||||
|
||||
// Special LDR for loads from non-pc-relative constpools.
|
||||
let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
|
||||
let canFoldAsLoad = 1, mayLoad = 1, neverHasSideEffects = 1,
|
||||
isReMaterializable = 1 in
|
||||
def tLDRcp : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi,
|
||||
"ldr", "\t$dst, $addr", []>,
|
||||
T1LdStSP<{1,?,?}>;
|
||||
@ -531,7 +532,7 @@ def tSTRspi : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStorei,
|
||||
[(store tGPR:$src, t_addrmode_sp:$addr)]>,
|
||||
T1LdStSP<{0,?,?}>;
|
||||
|
||||
let mayStore = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1 in {
|
||||
// Special instruction for spill. It cannot clobber condition register
|
||||
// when it's expanded by eliminateCallFramePseudoInstr().
|
||||
def tSpill : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStorei,
|
||||
@ -544,7 +545,7 @@ def tSpill : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStorei,
|
||||
//
|
||||
|
||||
// These requires base address to be written back or one of the loaded regs.
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
def tLDM : T1I<(outs),
|
||||
(ins addrmode4:$addr, pred:$p, reglist:$dsts, variable_ops),
|
||||
IIC_iLoadm,
|
||||
@ -557,9 +558,9 @@ def tLDM_UPD : T1It<(outs tGPR:$wb),
|
||||
"ldm${addr:submode}${p}\t$addr!, $dsts",
|
||||
"$addr.addr = $wb", []>,
|
||||
T1Encoding<{1,1,0,0,1,?}>; // A6.2 & A8.6.53
|
||||
} // mayLoad, hasExtraDefRegAllocReq
|
||||
} // mayLoad, neverHasSideEffects = 1, hasExtraDefRegAllocReq
|
||||
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
def tSTM_UPD : T1It<(outs tGPR:$wb),
|
||||
(ins addrmode4:$addr, pred:$p, reglist:$srcs, variable_ops),
|
||||
IIC_iStorem,
|
||||
|
@ -914,7 +914,7 @@ defm t2LDRB : T2I_ld<0, 0b00, "ldrb", UnOpFrag<(zextloadi8 node:$Src)>>;
|
||||
defm t2LDRSH : T2I_ld<1, 0b01, "ldrsh", UnOpFrag<(sextloadi16 node:$Src)>>;
|
||||
defm t2LDRSB : T2I_ld<1, 0b00, "ldrsb", UnOpFrag<(sextloadi8 node:$Src)>>;
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
// Load doubleword
|
||||
def t2LDRDi8 : T2Ii8s4<1, 0, 1, (outs GPR:$dst1, GPR:$dst2),
|
||||
(ins t2addrmode_imm8s4:$addr),
|
||||
@ -924,7 +924,7 @@ def t2LDRDpci : T2Ii8s4<1, 0, 1, (outs GPR:$dst1, GPR:$dst2),
|
||||
"ldrd", "\t$dst1, $addr", []> {
|
||||
let Inst{19-16} = 0b1111; // Rn
|
||||
}
|
||||
}
|
||||
} // mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1
|
||||
|
||||
// zextload i1 -> zextload i8
|
||||
def : T2Pat<(zextloadi1 t2addrmode_imm12:$addr),
|
||||
@ -967,7 +967,7 @@ def : T2Pat<(extloadi16 (ARMWrapper tconstpool:$addr)),
|
||||
(t2LDRHpci tconstpool:$addr)>;
|
||||
|
||||
// Indexed loads
|
||||
let mayLoad = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1 in {
|
||||
def t2LDR_PRE : T2Iidxldst<0, 0b10, 1, 1, (outs GPR:$dst, GPR:$base_wb),
|
||||
(ins t2addrmode_imm8:$addr),
|
||||
AddrModeT2_i8, IndexModePre, IIC_iLoadiu,
|
||||
@ -1023,7 +1023,7 @@ def t2LDRSH_POST : T2Iidxldst<1, 0b01, 1, 0, (outs GPR:$dst, GPR:$base_wb),
|
||||
AddrModeT2_i8, IndexModePost, IIC_iLoadiu,
|
||||
"ldrsh", "\t$dst, [$base], $offset", "$base = $base_wb",
|
||||
[]>;
|
||||
}
|
||||
} // mayLoad = 1, neverHasSideEffects = 1
|
||||
|
||||
// LDRT, LDRBT, LDRHT, LDRSBT, LDRSHT all have offset mode (PUW=0b110) and are
|
||||
// for disassembly only.
|
||||
@ -1053,7 +1053,7 @@ defm t2STRB:T2I_st<0b00,"strb",BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>;
|
||||
defm t2STRH:T2I_st<0b01,"strh",BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>;
|
||||
|
||||
// Store doubleword
|
||||
let mayLoad = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in
|
||||
def t2STRDi8 : T2Ii8s4<1, 0, 0, (outs),
|
||||
(ins GPR:$src1, GPR:$src2, t2addrmode_imm8s4:$addr),
|
||||
IIC_iStorer, "strd", "\t$src1, $addr", []>;
|
||||
@ -1216,7 +1216,7 @@ defm t2PLI : T2Ipl<1, 0, "pli">;
|
||||
// Load / store multiple Instructions.
|
||||
//
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
def t2LDM : T2XI<(outs), (ins addrmode4:$addr, pred:$p,
|
||||
reglist:$dsts, variable_ops), IIC_iLoadm,
|
||||
"ldm${addr:submode}${p}${addr:wide}\t$addr, $dsts", []> {
|
||||
@ -1239,9 +1239,9 @@ def t2LDM_UPD : T2XIt<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||
let Inst{21} = 1; // The W bit.
|
||||
let Inst{20} = 1; // Load
|
||||
}
|
||||
} // mayLoad, hasExtraDefRegAllocReq
|
||||
} // mayLoad, neverHasSideEffects, hasExtraDefRegAllocReq
|
||||
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
def t2STM : T2XI<(outs), (ins addrmode4:$addr, pred:$p,
|
||||
reglist:$srcs, variable_ops), IIC_iStorem,
|
||||
"stm${addr:submode}${p}${addr:wide}\t$addr, $srcs", []> {
|
||||
@ -1265,7 +1265,7 @@ def t2STM_UPD : T2XIt<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||
let Inst{21} = 1; // The W bit.
|
||||
let Inst{20} = 0; // Store
|
||||
}
|
||||
} // mayStore, hasExtraSrcRegAllocReq
|
||||
} // mayStore, neverHasSideEffects, hasExtraSrcRegAllocReq
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Move Instructions.
|
||||
|
@ -76,7 +76,7 @@ def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr),
|
||||
// Load / store multiple Instructions.
|
||||
//
|
||||
|
||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
let mayLoad = 1, neverHasSideEffects = 1, hasExtraDefRegAllocReq = 1 in {
|
||||
def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
|
||||
variable_ops), IndexModeNone, IIC_fpLoadm,
|
||||
"vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
|
||||
@ -104,9 +104,9 @@ def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||
"$addr.base = $wb", []> {
|
||||
let Inst{20} = 1;
|
||||
}
|
||||
} // mayLoad, hasExtraDefRegAllocReq
|
||||
} // mayLoad, neverHasSideEffects, hasExtraDefRegAllocReq
|
||||
|
||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
let mayStore = 1, neverHasSideEffects = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||
def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
|
||||
variable_ops), IndexModeNone, IIC_fpStorem,
|
||||
"vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
|
||||
@ -134,7 +134,7 @@ def VSTMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||
"$addr.base = $wb", []> {
|
||||
let Inst{20} = 0;
|
||||
}
|
||||
} // mayStore, hasExtraSrcRegAllocReq
|
||||
} // mayStore, neverHasSideEffects, hasExtraSrcRegAllocReq
|
||||
|
||||
// FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user