mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 15:39:06 +00:00
Add TSFlags to ALU32 type instructions for constant-extender/Relationship maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bacbf1c2cb
commit
39498d1ff0
@ -59,9 +59,6 @@ class MEMInst_V4<dag outs, dag ins, string asmstr, list<dag> pattern>
|
||||
bits<6> imm6;
|
||||
}
|
||||
|
||||
class Immext<dag outs, dag ins, string asmstr, list<dag> pattern>
|
||||
: InstHexagon<outs, ins, asmstr, pattern, "", PREFIX, TypePREFIX> {
|
||||
let isCodeGenOnly = 1;
|
||||
|
||||
bits<26> imm26;
|
||||
}
|
||||
let isCodeGenOnly = 1 in
|
||||
class EXTENDERInst<dag outs, dag ins, string asmstr, list<dag> pattern = []>
|
||||
: InstHexagon<outs, ins, asmstr, pattern, "", PREFIX, TypePREFIX>;
|
||||
|
@ -12,10 +12,14 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
let neverHasSideEffects = 1 in
|
||||
def IMMEXT : Immext<(outs), (ins),
|
||||
"/* immext #... */",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
class T_Immext<dag ins> :
|
||||
EXTENDERInst<(outs), ins, "immext(#$imm)", []>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
def IMMEXT_b : T_Immext<(ins brtarget:$imm)>;
|
||||
def IMMEXT_c : T_Immext<(ins calltarget:$imm)>;
|
||||
def IMMEXT_g : T_Immext<(ins globaladdress:$imm)>;
|
||||
def IMMEXT_i : T_Immext<(ins u26_6Imm:$imm)>;
|
||||
|
||||
// Hexagon V4 Architecture spec defines 8 instruction classes:
|
||||
// LD ST ALU32 XTYPE J JR MEMOP NV CR SYSTEM(system is not implemented in the
|
||||
@ -83,86 +87,77 @@ def IMMEXT : Immext<(outs), (ins),
|
||||
|
||||
// Shift halfword.
|
||||
|
||||
let isPredicated = 1 in
|
||||
let isPredicated = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in {
|
||||
def ASLH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = aslh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASLH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = aslh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASLH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = aslh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASLH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = aslh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASRH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = asrh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASRH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = asrh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASRH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = asrh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def ASRH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = asrh($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
}
|
||||
|
||||
// Sign extend.
|
||||
|
||||
let isPredicated = 1 in
|
||||
let isPredicated = 1, neverHasSideEffects = 1, validSubTargets = HasV4SubT in {
|
||||
def SXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = sxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = sxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = sxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = sxtb($src2)",
|
||||
@ -170,94 +165,86 @@ def SXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = sxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = sxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = sxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let isPredicated = 1 in
|
||||
def SXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = sxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
}
|
||||
|
||||
// Zero exten.
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
let neverHasSideEffects = 1, isPredicated = 1, validSubTargets = HasV4SubT in {
|
||||
def ZXTB_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = zxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTB_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = zxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTB_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = zxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTB_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = zxtb($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTH_cPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1) $dst = zxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTH_cNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1) $dst = zxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTH_cdnPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if ($src1.new) $dst = zxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
|
||||
let neverHasSideEffects = 1, isPredicated = 1 in
|
||||
def ZXTH_cdnNotPt_V4 : ALU32_rr<(outs IntRegs:$dst),
|
||||
(ins PredRegs:$src1, IntRegs:$src2),
|
||||
"if (!$src1.new) $dst = zxth($src2)",
|
||||
[]>,
|
||||
Requires<[HasV4T]>;
|
||||
}
|
||||
|
||||
// Generate frame index addresses.
|
||||
let neverHasSideEffects = 1, isReMaterializable = 1 in
|
||||
let neverHasSideEffects = 1, isReMaterializable = 1,
|
||||
isExtended = 1, opExtendable = 2, validSubTargets = HasV4SubT in
|
||||
def TFR_FI_immext_V4 : ALU32_ri<(outs IntRegs:$dst),
|
||||
(ins IntRegs:$src1, s32Imm:$offset),
|
||||
"$dst = add($src1, ##$offset)",
|
||||
|
@ -241,8 +241,9 @@ static bool IsIndirectCall(MachineInstr* MI) {
|
||||
// reservation fail.
|
||||
void HexagonPacketizerList::reserveResourcesForConstExt(MachineInstr* MI) {
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
MachineInstr *PseudoMI = MI->getParent()->getParent()->CreateMachineInstr(
|
||||
QII->get(Hexagon::IMMEXT), MI->getDebugLoc());
|
||||
MachineFunction *MF = MI->getParent()->getParent();
|
||||
MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
|
||||
MI->getDebugLoc());
|
||||
|
||||
if (ResourceTracker->canReserveResources(PseudoMI)) {
|
||||
ResourceTracker->reserveResources(PseudoMI);
|
||||
@ -259,7 +260,7 @@ bool HexagonPacketizerList::canReserveResourcesForConstExt(MachineInstr *MI) {
|
||||
assert(QII->isExtended(MI) &&
|
||||
"Should only be called for constant extended instructions");
|
||||
MachineFunction *MF = MI->getParent()->getParent();
|
||||
MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT),
|
||||
MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
|
||||
MI->getDebugLoc());
|
||||
bool CanReserve = ResourceTracker->canReserveResources(PseudoMI);
|
||||
MF->DeleteMachineInstr(PseudoMI);
|
||||
@ -270,8 +271,9 @@ bool HexagonPacketizerList::canReserveResourcesForConstExt(MachineInstr *MI) {
|
||||
// true, otherwise, return false.
|
||||
bool HexagonPacketizerList::tryAllocateResourcesForConstExt(MachineInstr* MI) {
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
MachineInstr *PseudoMI = MI->getParent()->getParent()->CreateMachineInstr(
|
||||
QII->get(Hexagon::IMMEXT), MI->getDebugLoc());
|
||||
MachineFunction *MF = MI->getParent()->getParent();
|
||||
MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
|
||||
MI->getDebugLoc());
|
||||
|
||||
if (ResourceTracker->canReserveResources(PseudoMI)) {
|
||||
ResourceTracker->reserveResources(PseudoMI);
|
||||
|
Loading…
Reference in New Issue
Block a user