mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Remove the '-disable-scheduling' flag and replace it with the 'source' option of
the '-pre-RA-sched' flag. It actually makes more sense to do it this way. Also, keep track of the SDNode ordering by default. Eventually, we would like to make this ordering a way to break a "tie" in the scheduler. However, doing that now breaks the "CodeGen/X86/abi-isel.ll" test for 32-bit Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94308 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -46,6 +46,11 @@ static RegisterScheduler
|
||||
tdrListrDAGScheduler("list-tdrr",
|
||||
"Top-down register reduction list scheduling",
|
||||
createTDRRListDAGScheduler);
|
||||
static RegisterScheduler
|
||||
sourceListDAGScheduler("source",
|
||||
"Similar to list-burr but schedules in source "
|
||||
"order when possible",
|
||||
createSourceListDAGScheduler);
|
||||
|
||||
namespace {
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -931,6 +936,16 @@ namespace {
|
||||
|
||||
bool operator()(const SUnit* left, const SUnit* right) const;
|
||||
};
|
||||
|
||||
struct src_ls_rr_sort : public std::binary_function<SUnit*, SUnit*, bool> {
|
||||
RegReductionPriorityQueue<src_ls_rr_sort> *SPQ;
|
||||
src_ls_rr_sort(RegReductionPriorityQueue<src_ls_rr_sort> *spq)
|
||||
: SPQ(spq) {}
|
||||
src_ls_rr_sort(const src_ls_rr_sort &RHS)
|
||||
: SPQ(RHS.SPQ) {}
|
||||
|
||||
bool operator()(const SUnit* left, const SUnit* right) const;
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
/// CalcNodeSethiUllmanNumber - Compute Sethi Ullman number.
|
||||
@@ -981,9 +996,9 @@ namespace {
|
||||
|
||||
public:
|
||||
RegReductionPriorityQueue(const TargetInstrInfo *tii,
|
||||
const TargetRegisterInfo *tri) :
|
||||
Queue(SF(this)), currentQueueId(0),
|
||||
TII(tii), TRI(tri), scheduleDAG(NULL) {}
|
||||
const TargetRegisterInfo *tri)
|
||||
: Queue(SF(this)), currentQueueId(0),
|
||||
TII(tii), TRI(tri), scheduleDAG(NULL) {}
|
||||
|
||||
void initNodes(std::vector<SUnit> &sunits) {
|
||||
SUnits = &sunits;
|
||||
@@ -1089,6 +1104,9 @@ namespace {
|
||||
|
||||
typedef RegReductionPriorityQueue<td_ls_rr_sort>
|
||||
TDRegReductionPriorityQueue;
|
||||
|
||||
typedef RegReductionPriorityQueue<src_ls_rr_sort>
|
||||
SrcRegReductionPriorityQueue;
|
||||
}
|
||||
|
||||
/// closestSucc - Returns the scheduled cycle of the successor which is
|
||||
@@ -1122,16 +1140,9 @@ static unsigned calcMaxScratches(const SUnit *SU) {
|
||||
return Scratches;
|
||||
}
|
||||
|
||||
// Bottom up
|
||||
bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
|
||||
unsigned LOrder = SPQ->getNodeOrdering(left);
|
||||
unsigned ROrder = SPQ->getNodeOrdering(right);
|
||||
|
||||
// Prefer an ordering where the lower the non-zero order number, the higher
|
||||
// the preference.
|
||||
if ((LOrder || ROrder) && LOrder != ROrder)
|
||||
return LOrder != 0 && (LOrder < ROrder || ROrder == 0);
|
||||
|
||||
template <typename RRSort>
|
||||
static bool BURRSort(const SUnit *left, const SUnit *right,
|
||||
const RegReductionPriorityQueue<RRSort> *SPQ) {
|
||||
unsigned LPriority = SPQ->getNodePriority(left);
|
||||
unsigned RPriority = SPQ->getNodePriority(right);
|
||||
if (LPriority != RPriority)
|
||||
@@ -1176,6 +1187,24 @@ bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
|
||||
return (left->NodeQueueId > right->NodeQueueId);
|
||||
}
|
||||
|
||||
// Bottom up
|
||||
bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
|
||||
return BURRSort(left, right, SPQ);
|
||||
}
|
||||
|
||||
// Source order, otherwise bottom up.
|
||||
bool src_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const{
|
||||
unsigned LOrder = SPQ->getNodeOrdering(left);
|
||||
unsigned ROrder = SPQ->getNodeOrdering(right);
|
||||
|
||||
// Prefer an ordering where the lower the non-zero order number, the higher
|
||||
// the preference.
|
||||
if ((LOrder || ROrder) && LOrder != ROrder)
|
||||
return LOrder != 0 && (LOrder < ROrder || ROrder == 0);
|
||||
|
||||
return BURRSort(left, right, SPQ);
|
||||
}
|
||||
|
||||
template<class SF>
|
||||
bool
|
||||
RegReductionPriorityQueue<SF>::canClobber(const SUnit *SU, const SUnit *Op) {
|
||||
@@ -1196,7 +1225,6 @@ RegReductionPriorityQueue<SF>::canClobber(const SUnit *SU, const SUnit *Op) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// hasCopyToRegUse - Return true if SU has a value successor that is a
|
||||
/// CopyToReg node.
|
||||
static bool hasCopyToRegUse(const SUnit *SU) {
|
||||
@@ -1544,3 +1572,17 @@ llvm::createTDRRListDAGScheduler(SelectionDAGISel *IS, CodeGenOpt::Level) {
|
||||
PQ->setScheduleDAG(SD);
|
||||
return SD;
|
||||
}
|
||||
|
||||
llvm::ScheduleDAGSDNodes *
|
||||
llvm::createSourceListDAGScheduler(SelectionDAGISel *IS, CodeGenOpt::Level) {
|
||||
const TargetMachine &TM = IS->TM;
|
||||
const TargetInstrInfo *TII = TM.getInstrInfo();
|
||||
const TargetRegisterInfo *TRI = TM.getRegisterInfo();
|
||||
|
||||
SrcRegReductionPriorityQueue *PQ = new SrcRegReductionPriorityQueue(TII, TRI);
|
||||
|
||||
ScheduleDAGRRList *SD =
|
||||
new ScheduleDAGRRList(*IS->MF, true, PQ);
|
||||
PQ->setScheduleDAG(SD);
|
||||
return SD;
|
||||
}
|
||||
|
Reference in New Issue
Block a user