[llvm] [MISched] Unify the way to specify scheduling direction (PR #119518)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 01:58:58 PST 2024
================
@@ -99,8 +99,16 @@
namespace llvm {
-extern cl::opt<bool> ForceTopDown;
-extern cl::opt<bool> ForceBottomUp;
+namespace MISched {
+enum Direction {
+ Unspecified,
----------------
wangpc-pp wrote:
My point is that there will be a lot of `getNumOccurrences()`, which makes the conditions complicated. For example:
```
static ScheduleDAGInstrs *createInstructionShuffler(MachineSchedContext *C) {
bool Alternate =
PreRADirection != MISched::TopDown && PreRADirection != MISched::BottomUp;
bool TopDown = PreRADirection != MISched::BottomUp;
return new ScheduleDAGMILive(
C, std::make_unique<InstructionShuffler>(Alternate, TopDown));
}
```
will be:
```
static ScheduleDAGInstrs *createInstructionShuffler(MachineSchedContext *C) {
bool Alternate = PreRADirection.getNumOccurrences() > 0 &&
PreRADirection != MISched::TopDown && PreRADirection != MISched::BottomUp;
bool TopDown = PreRADirection.getNumOccurrences() > 0 && PreRADirection != MISched::BottomUp;
return new ScheduleDAGMILive(
C, std::make_unique<InstructionShuffler>(Alternate, TopDown));
}
```
https://github.com/llvm/llvm-project/pull/119518
More information about the llvm-commits
mailing list