[libc-commits] [lldb] [flang] [clang-tools-extra] [libcxx] [compiler-rt] [clang] [libc] [llvm] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

via libc-commits libc-commits at lists.llvm.org
Fri Dec 22 18:02:49 PST 2023


================
@@ -62,6 +62,107 @@ static RegisterRegAlloc fastRegAlloc("fast", "fast register allocator",
 
 namespace {
 
+/// Assign ascending index for instructions in machine basic block. The index
+/// can be used to determine dominance between instructions in same MBB.
+class InstrPosIndexes {
+public:
+  void init(const MachineBasicBlock &MBB) {
+    CurMBB = &MBB;
+    Instr2PosIndex.clear();
+    uint64_t LastIndex = 0;
+    for (const MachineInstr &MI : MBB) {
+      LastIndex += InstrDist;
+      Instr2PosIndex[&MI] = LastIndex;
+    }
----------------
HaohaiWen wrote:

#76275

https://github.com/llvm/llvm-project/pull/72250


More information about the libc-commits mailing list