forked from OSchip/llvm-project
Define ADJCALLSTACKDOWN/UP nodes. These nodes are emitted regardless of whether
or not it is in mips16 mode. Define MipsPseudo (mode-independant pseudo) and PseudoSE (mips32/64 pseudo) classes. llvm-svn: 161071
This commit is contained in:
parent
fb4263f156
commit
a66d676b20
|
@ -249,18 +249,6 @@ let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1, hasCtrlDep=1,
|
|||
hasExtraSrcRegAllocReq = 1 in
|
||||
def RetRA16 : MipsPseudo16<(outs), (ins), "", [(MipsRet)]>;
|
||||
|
||||
// As stack alignment is always done with addiu, we need a 16-bit immediate
|
||||
// This is basically deprecated code but needs to be there for things
|
||||
// to work.
|
||||
let Defs = [SP], Uses = [SP] in {
|
||||
def ADJCALLSTACKDOWN16 : MipsPseudo16<(outs), (ins uimm16:$amt),
|
||||
";",
|
||||
[(callseq_start timm:$amt)]>;
|
||||
def ADJCALLSTACKUP16 : MipsPseudo16<(outs), (ins uimm16:$amt1, uimm16:$amt2),
|
||||
";",
|
||||
[(callseq_end timm:$amt1, timm:$amt2)]>;
|
||||
}
|
||||
|
||||
// Small immediates
|
||||
def : Mips16Pat<(i32 immZExt16:$in), (LiRxImmX16 immZExt16:$in)>;
|
||||
|
||||
|
|
|
@ -416,25 +416,23 @@ let Defs=[FCR31] in {
|
|||
//===----------------------------------------------------------------------===//
|
||||
// Floating Point Pseudo-Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
def MOVCCRToCCR : MipsPseudo<(outs CCR:$dst), (ins CCR:$src),
|
||||
"# MOVCCRToCCR", []>;
|
||||
def MOVCCRToCCR : PseudoSE<(outs CCR:$dst), (ins CCR:$src),
|
||||
"# MOVCCRToCCR", []>;
|
||||
|
||||
// This pseudo instr gets expanded into 2 mtc1 instrs after register
|
||||
// allocation.
|
||||
def BuildPairF64 :
|
||||
MipsPseudo<(outs AFGR64:$dst),
|
||||
(ins CPURegs:$lo, CPURegs:$hi), "",
|
||||
[(set AFGR64:$dst, (MipsBuildPairF64 CPURegs:$lo, CPURegs:$hi))]>;
|
||||
PseudoSE<(outs AFGR64:$dst),
|
||||
(ins CPURegs:$lo, CPURegs:$hi), "",
|
||||
[(set AFGR64:$dst, (MipsBuildPairF64 CPURegs:$lo, CPURegs:$hi))]>;
|
||||
|
||||
// This pseudo instr gets expanded into 2 mfc1 instrs after register
|
||||
// allocation.
|
||||
// if n is 0, lower part of src is extracted.
|
||||
// if n is 1, higher part of src is extracted.
|
||||
def ExtractElementF64 :
|
||||
MipsPseudo<(outs CPURegs:$dst),
|
||||
(ins AFGR64:$src, i32imm:$n), "",
|
||||
[(set CPURegs:$dst,
|
||||
(MipsExtractElementF64 AFGR64:$src, imm:$n))]>;
|
||||
PseudoSE<(outs CPURegs:$dst), (ins AFGR64:$src, i32imm:$n), "",
|
||||
[(set CPURegs:$dst, (MipsExtractElementF64 AFGR64:$src, imm:$n))]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Floating Point Patterns
|
||||
|
|
|
@ -37,8 +37,8 @@ def FrmFI : Format<5>;
|
|||
def FrmOther : Format<6>; // Instruction w/ a custom format
|
||||
|
||||
// Generic Mips Format
|
||||
class InstSE<dag outs, dag ins, string asmstr, list<dag> pattern,
|
||||
InstrItinClass itin, Format f>: Instruction
|
||||
class MipsInst<dag outs, dag ins, string asmstr, list<dag> pattern,
|
||||
InstrItinClass itin, Format f>: Instruction
|
||||
{
|
||||
field bits<32> Inst;
|
||||
Format Form = f;
|
||||
|
@ -70,18 +70,28 @@ class InstSE<dag outs, dag ins, string asmstr, list<dag> pattern,
|
|||
let DecoderNamespace = "Mips";
|
||||
|
||||
field bits<32> SoftFail = 0;
|
||||
}
|
||||
|
||||
// Mips32/64 Instruction Format
|
||||
class InstSE<dag outs, dag ins, string asmstr, list<dag> pattern,
|
||||
InstrItinClass itin, Format f>:
|
||||
MipsInst<outs, ins, asmstr, pattern, itin, f> {
|
||||
let Predicates = [HasStandardEncoding];
|
||||
|
||||
}
|
||||
|
||||
// Mips Pseudo Instructions Format
|
||||
class MipsPseudo<dag outs, dag ins, string asmstr, list<dag> pattern>:
|
||||
InstSE<outs, ins, asmstr, pattern, IIPseudo, Pseudo> {
|
||||
MipsInst<outs, ins, asmstr, pattern, IIPseudo, Pseudo> {
|
||||
let isCodeGenOnly = 1;
|
||||
let isPseudo = 1;
|
||||
}
|
||||
|
||||
// Mips32/64 Pseudo Instruction Format
|
||||
class PseudoSE<dag outs, dag ins, string asmstr, list<dag> pattern>:
|
||||
MipsPseudo<outs, ins, asmstr, pattern> {
|
||||
let Predicates = [HasStandardEncoding];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Format R instruction class in Mips : <|opcode|rs|rt|rd|shamt|funct|>
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -803,9 +803,9 @@ class InsBase<bits<6> _funct, string instr_asm, RegisterClass RC>:
|
|||
// Atomic instructions with 2 source operands (ATOMIC_SWAP & ATOMIC_LOAD_*).
|
||||
class Atomic2Ops<PatFrag Op, string Opstr, RegisterClass DRC,
|
||||
RegisterClass PRC> :
|
||||
MipsPseudo<(outs DRC:$dst), (ins PRC:$ptr, DRC:$incr),
|
||||
!strconcat("atomic_", Opstr, "\t$dst, $ptr, $incr"),
|
||||
[(set DRC:$dst, (Op PRC:$ptr, DRC:$incr))]>;
|
||||
PseudoSE<(outs DRC:$dst), (ins PRC:$ptr, DRC:$incr),
|
||||
!strconcat("atomic_", Opstr, "\t$dst, $ptr, $incr"),
|
||||
[(set DRC:$dst, (Op PRC:$ptr, DRC:$incr))]>;
|
||||
|
||||
multiclass Atomic2Ops32<PatFrag Op, string Opstr> {
|
||||
def #NAME# : Atomic2Ops<Op, Opstr, CPURegs, CPURegs>,
|
||||
|
@ -819,9 +819,9 @@ multiclass Atomic2Ops32<PatFrag Op, string Opstr> {
|
|||
// Atomic Compare & Swap.
|
||||
class AtomicCmpSwap<PatFrag Op, string Width, RegisterClass DRC,
|
||||
RegisterClass PRC> :
|
||||
MipsPseudo<(outs DRC:$dst), (ins PRC:$ptr, DRC:$cmp, DRC:$swap),
|
||||
!strconcat("atomic_cmp_swap_", Width, "\t$dst, $ptr, $cmp, $swap"),
|
||||
[(set DRC:$dst, (Op PRC:$ptr, DRC:$cmp, DRC:$swap))]>;
|
||||
PseudoSE<(outs DRC:$dst), (ins PRC:$ptr, DRC:$cmp, DRC:$swap),
|
||||
!strconcat("atomic_cmp_swap_", Width, "\t$dst, $ptr, $cmp, $swap"),
|
||||
[(set DRC:$dst, (Op PRC:$ptr, DRC:$cmp, DRC:$swap))]>;
|
||||
|
||||
multiclass AtomicCmpSwap32<PatFrag Op, string Width> {
|
||||
def #NAME# : AtomicCmpSwap<Op, Width, CPURegs, CPURegs>,
|
||||
|
@ -851,14 +851,13 @@ class SCBase<bits<6> Opc, string opstring, RegisterClass RC, Operand Mem> :
|
|||
|
||||
// Return RA.
|
||||
let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1, hasCtrlDep=1 in
|
||||
def RetRA : MipsPseudo<(outs), (ins), "", [(MipsRet)]>;
|
||||
def RetRA : PseudoSE<(outs), (ins), "", [(MipsRet)]>;
|
||||
|
||||
// As stack alignment is always done with addiu, we need a 16-bit immediate
|
||||
let Defs = [SP], Uses = [SP] in {
|
||||
def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins uimm16:$amt),
|
||||
let Defs = [SP], Uses = [SP], hasSideEffects = 1 in {
|
||||
def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins i32imm:$amt),
|
||||
"!ADJCALLSTACKDOWN $amt",
|
||||
[(callseq_start timm:$amt)]>;
|
||||
def ADJCALLSTACKUP : MipsPseudo<(outs), (ins uimm16:$amt1, uimm16:$amt2),
|
||||
def ADJCALLSTACKUP : MipsPseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
|
||||
"!ADJCALLSTACKUP $amt1",
|
||||
[(callseq_end timm:$amt1, timm:$amt2)]>;
|
||||
}
|
||||
|
@ -868,8 +867,8 @@ def ADJCALLSTACKUP : MipsPseudo<(outs), (ins uimm16:$amt1, uimm16:$amt2),
|
|||
// are used, we have the same behavior, but get also a bunch of warnings
|
||||
// from the assembler.
|
||||
let neverHasSideEffects = 1 in
|
||||
def CPRESTORE : MipsPseudo<(outs), (ins i32imm:$loc, CPURegs:$gp),
|
||||
".cprestore\t$loc", []>;
|
||||
def CPRESTORE : PseudoSE<(outs), (ins i32imm:$loc, CPURegs:$gp),
|
||||
".cprestore\t$loc", []>;
|
||||
|
||||
let usesCustomInserter = 1 in {
|
||||
defm ATOMIC_LOAD_ADD_I8 : Atomic2Ops32<atomic_load_add_8, "load_add_8">;
|
||||
|
|
Loading…
Reference in New Issue