mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
[Hexagon] Adding J class call instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224150 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -21,13 +21,52 @@ def callv3nr : SDNode<"HexagonISD::CALLv3nr", SDT_SPCall,
|
|||||||
// J +
|
// J +
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Call subroutine.
|
// Call subroutine.
|
||||||
let isCall = 1, hasSideEffects = 0,
|
let isCall = 1, hasSideEffects = 1, validSubTargets = HasV3SubT,
|
||||||
Defs = [D0, D1, D2, D3, D4, D5, D6, D7, R28, R31,
|
Defs = VolatileV3.Regs, isPredicable = 1,
|
||||||
P0, P1, P2, P3, LC0, LC1, SA0, SA1] in {
|
isExtended = 0, isExtendable = 1, opExtendable = 0,
|
||||||
def CALLv3 : JInst<(outs), (ins calltarget:$dst),
|
isExtentSigned = 1, opExtentBits = 24, opExtentAlign = 2 in
|
||||||
"call $dst", []>, Requires<[HasV3T]>;
|
class T_Call<string ExtStr>
|
||||||
|
: JInst<(outs), (ins calltarget:$dst),
|
||||||
|
"call " # ExtStr # "$dst", [], "", J_tc_2early_SLOT23> {
|
||||||
|
let BaseOpcode = "call";
|
||||||
|
bits<24> dst;
|
||||||
|
|
||||||
|
let IClass = 0b0101;
|
||||||
|
let Inst{27-25} = 0b101;
|
||||||
|
let Inst{24-16,13-1} = dst{23-2};
|
||||||
|
let Inst{0} = 0b0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isCall = 1, hasSideEffects = 1, validSubTargets = HasV3SubT,
|
||||||
|
Defs = VolatileV3.Regs, isPredicated = 1,
|
||||||
|
isExtended = 0, isExtendable = 1, opExtendable = 1,
|
||||||
|
isExtentSigned = 1, opExtentBits = 17, opExtentAlign = 2 in
|
||||||
|
class T_CallPred<bit IfTrue, string ExtStr>
|
||||||
|
: JInst<(outs), (ins PredRegs:$Pu, calltarget:$dst),
|
||||||
|
CondStr<"$Pu", IfTrue, 0>.S # "call " # ExtStr # "$dst",
|
||||||
|
[], "", J_tc_2early_SLOT23> {
|
||||||
|
let BaseOpcode = "call";
|
||||||
|
let isPredicatedFalse = !if(IfTrue,0,1);
|
||||||
|
bits<2> Pu;
|
||||||
|
bits<17> dst;
|
||||||
|
|
||||||
|
let IClass = 0b0101;
|
||||||
|
let Inst{27-24} = 0b1101;
|
||||||
|
let Inst{23-22,20-16,13,7-1} = dst{16-2};
|
||||||
|
let Inst{21} = !if(IfTrue,0,1);
|
||||||
|
let Inst{11} = 0b0;
|
||||||
|
let Inst{9-8} = Pu;
|
||||||
|
}
|
||||||
|
|
||||||
|
multiclass T_Calls<string ExtStr> {
|
||||||
|
def NAME : T_Call<ExtStr>;
|
||||||
|
def t : T_CallPred<1, ExtStr>;
|
||||||
|
def f : T_CallPred<0, ExtStr>;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isCodeGenOnly = 0 in
|
||||||
|
defm J2_call: T_Calls<"">, PredRel;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// J -
|
// J -
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@@ -100,8 +139,8 @@ Requires<[HasV3T]>;
|
|||||||
|
|
||||||
// Map call instruction
|
// Map call instruction
|
||||||
def : Pat<(call (i32 IntRegs:$dst)),
|
def : Pat<(call (i32 IntRegs:$dst)),
|
||||||
(CALLRv3 (i32 IntRegs:$dst))>, Requires<[HasV3T]>;
|
(J2_call (i32 IntRegs:$dst))>, Requires<[HasV3T]>;
|
||||||
def : Pat<(call tglobaladdr:$dst),
|
def : Pat<(call tglobaladdr:$dst),
|
||||||
(CALLv3 tglobaladdr:$dst)>, Requires<[HasV3T]>;
|
(J2_call tglobaladdr:$dst)>, Requires<[HasV3T]>;
|
||||||
def : Pat<(call texternalsym:$dst),
|
def : Pat<(call texternalsym:$dst),
|
||||||
(CALLv3 texternalsym:$dst)>, Requires<[HasV3T]>;
|
(J2_call texternalsym:$dst)>, Requires<[HasV3T]>;
|
||||||
|
@@ -176,7 +176,7 @@ static bool commonChecksToProhibitNewValueJump(bool afterRA,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// if call in path, bail out.
|
// if call in path, bail out.
|
||||||
if (MII->getOpcode() == Hexagon::CALLv3)
|
if (MII->getOpcode() == Hexagon::J2_call)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// if NVJ is running prior to RA, do the following checks.
|
// if NVJ is running prior to RA, do the following checks.
|
||||||
|
8
test/MC/Disassembler/Hexagon/j.txt
Normal file
8
test/MC/Disassembler/Hexagon/j.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# RUN: llvm-mc -triple hexagon -disassemble < %s | FileCheck %s
|
||||||
|
|
||||||
|
0x22 0xc0 0x00 0x5a
|
||||||
|
# CHECK: call
|
||||||
|
0x22 0xc3 0x00 0x5d
|
||||||
|
# CHECK: if (p3) call
|
||||||
|
0x22 0xc3 0x20 0x5d
|
||||||
|
# CHECK: if (!p3) call
|
Reference in New Issue
Block a user