[PATCH] D45486: [X86][Atom] Convert Atom scheduler model to SchedRW (PR32431)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 11:10:34 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329834: [X86] Generalize X86PadShortFunction to work with TargetSchedModel (authored by RKSimon, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45486?vs=142014&id=142051#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45486
Files:
llvm/trunk/lib/Target/X86/X86PadShortFunction.cpp
Index: llvm/trunk/lib/Target/X86/X86PadShortFunction.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86PadShortFunction.cpp
+++ llvm/trunk/lib/Target/X86/X86PadShortFunction.cpp
@@ -21,7 +21,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -49,7 +49,7 @@
struct PadShortFunc : public MachineFunctionPass {
static char ID;
PadShortFunc() : MachineFunctionPass(ID)
- , Threshold(4), STI(nullptr), TII(nullptr) {}
+ , Threshold(4) {}
bool runOnMachineFunction(MachineFunction &MF) override;
@@ -82,8 +82,7 @@
// VisitedBBs - Cache of previously visited BBs.
DenseMap<MachineBasicBlock*, VisitedBBInfo> VisitedBBs;
- const X86Subtarget *STI;
- const TargetInstrInfo *TII;
+ TargetSchedModel TSM;
};
char PadShortFunc::ID = 0;
@@ -99,15 +98,13 @@
if (skipFunction(MF.getFunction()))
return false;
- if (MF.getFunction().optForSize()) {
+ if (MF.getFunction().optForSize())
return false;
- }
- STI = &MF.getSubtarget<X86Subtarget>();
- if (!STI->padShortFunctions())
+ if (!MF.getSubtarget<X86Subtarget>().padShortFunctions())
return false;
- TII = STI->getInstrInfo();
+ TSM.init(&MF.getSubtarget());
// Search through basic blocks and mark the ones that have early returns
ReturnBBs.clear();
@@ -195,7 +192,7 @@
return true;
}
- CyclesToEnd += TII->getInstrLatency(STI->getInstrItineraryData(), MI);
+ CyclesToEnd += TSM.computeInstrLatency(&MI);
}
VisitedBBs[MBB] = VisitedBBInfo(false, CyclesToEnd);
@@ -209,9 +206,8 @@
MachineBasicBlock::iterator &MBBI,
unsigned int NOOPsToAdd) {
DebugLoc DL = MBBI->getDebugLoc();
+ unsigned IssueWidth = TSM.getIssueWidth();
- while (NOOPsToAdd-- > 0) {
- BuildMI(*MBB, MBBI, DL, TII->get(X86::NOOP));
- BuildMI(*MBB, MBBI, DL, TII->get(X86::NOOP));
- }
+ for (unsigned i = 0, e = IssueWidth * NOOPsToAdd; i != e; ++i)
+ BuildMI(*MBB, MBBI, DL, TSM.getInstrInfo()->get(X86::NOOP));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45486.142051.patch
Type: text/x-patch
Size: 2385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180411/c03a3c3b/attachment.bin>
More information about the llvm-commits
mailing list