Skip to content

Commit 56bbf54

Browse files
author
Krzysztof Parzyszek
committed
[Hexagon] Update the Hexagon packetizer
llvm-svn: 255807
1 parent 187d33e commit 56bbf54

File tree

4 files changed

+1235
-888
lines changed

4 files changed

+1235
-888
lines changed

llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ using namespace llvm;
4040

4141
using namespace llvm;
4242

43-
static cl::opt<bool> ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden,
43+
cl::opt<bool> ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden,
4444
cl::init(false), cl::desc("Do not consider inline-asm a scheduling/"
4545
"packetization boundary."));
4646

4747
static cl::opt<bool> EnableBranchPrediction("hexagon-enable-branch-prediction",
4848
cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"));
4949

50+
static cl::opt<bool> DisableNVSchedule("disable-hexagon-nv-schedule",
51+
cl::Hidden, cl::ZeroOrMore, cl::init(false),
52+
cl::desc("Disable schedule adjustment for new value stores."));
53+
5054
static cl::opt<bool> EnableTimingClassLatency(
5155
"enable-timing-class-latency", cl::Hidden, cl::init(false),
5256
cl::desc("Enable timing class latency"));
@@ -1857,6 +1861,17 @@ bool HexagonInstrInfo::isFloat(const MachineInstr *MI) const {
18571861
}
18581862

18591863

1864+
// No V60 HVX VMEM with A_INDIRECT.
1865+
bool HexagonInstrInfo::isHVXMemWithAIndirect(const MachineInstr *I,
1866+
const MachineInstr *J) const {
1867+
if (!isV60VectorInstruction(I))
1868+
return false;
1869+
if (!I->mayLoad() && !I->mayStore())
1870+
return false;
1871+
return J->isIndirectBranch() || isIndirectCall(J) || isIndirectL4Return(J);
1872+
}
1873+
1874+
18601875
bool HexagonInstrInfo::isIndirectCall(const MachineInstr *MI) const {
18611876
switch (MI->getOpcode()) {
18621877
case Hexagon::J2_callr :
@@ -2492,6 +2507,28 @@ bool HexagonInstrInfo::isVecUsableNextPacket(const MachineInstr *ProdMI,
24922507
}
24932508

24942509

2510+
/// \brief Can these instructions execute at the same time in a bundle.
2511+
bool HexagonInstrInfo::canExecuteInBundle(const MachineInstr *First,
2512+
const MachineInstr *Second) const {
2513+
if (DisableNVSchedule)
2514+
return false;
2515+
if (mayBeNewStore(Second)) {
2516+
// Make sure the definition of the first instruction is the value being
2517+
// stored.
2518+
const MachineOperand &Stored =
2519+
Second->getOperand(Second->getNumOperands() - 1);
2520+
if (!Stored.isReg())
2521+
return false;
2522+
for (unsigned i = 0, e = First->getNumOperands(); i < e; ++i) {
2523+
const MachineOperand &Op = First->getOperand(i);
2524+
if (Op.isReg() && Op.isDef() && Op.getReg() == Stored.getReg())
2525+
return true;
2526+
}
2527+
}
2528+
return false;
2529+
}
2530+
2531+
24952532
bool HexagonInstrInfo::hasEHLabel(const MachineBasicBlock *B) const {
24962533
for (auto &I : *B)
24972534
if (I.isEHLabel())

llvm/lib/Target/Hexagon/HexagonInstrInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ class HexagonInstrInfo : public HexagonGenInstrInfo {
280280
bool isExtendable(const MachineInstr* MI) const;
281281
bool isExtended(const MachineInstr* MI) const;
282282
bool isFloat(const MachineInstr *MI) const;
283+
bool isHVXMemWithAIndirect(const MachineInstr *I,
284+
const MachineInstr *J) const;
283285
bool isIndirectCall(const MachineInstr *MI) const;
284286
bool isIndirectL4Return(const MachineInstr *MI) const;
285287
bool isJumpR(const MachineInstr *MI) const;
@@ -322,6 +324,8 @@ class HexagonInstrInfo : public HexagonGenInstrInfo {
322324
const MachineInstr *ConsMI) const;
323325

324326

327+
bool canExecuteInBundle(const MachineInstr *First,
328+
const MachineInstr *Second) const;
325329
bool hasEHLabel(const MachineBasicBlock *B) const;
326330
bool hasNonExtEquivalent(const MachineInstr *MI) const;
327331
bool hasPseudoInstrPair(const MachineInstr *MI) const;

0 commit comments

Comments
 (0)