X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FAllocationOrder.h;h=2aee3a63a2b1e5498d983318f3401e5b91e59871;hb=00552e3875ee5f382db6c98286a241a7d0efe1b8;hp=aed461a7ed028d2e62c4a5458d4fcaf5f2c48901;hpb=6d6132986d2ef14bbf9d76f5acbf2a0bace32d69;p=oota-llvm.git diff --git a/lib/CodeGen/AllocationOrder.h b/lib/CodeGen/AllocationOrder.h index aed461a7ed0..2aee3a63a2b 100644 --- a/lib/CodeGen/AllocationOrder.h +++ b/lib/CodeGen/AllocationOrder.h @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_ALLOCATIONORDER_H -#define LLVM_CODEGEN_ALLOCATIONORDER_H +#ifndef LLVM_LIB_CODEGEN_ALLOCATIONORDER_H +#define LLVM_LIB_CODEGEN_ALLOCATIONORDER_H #include "llvm/ADT/ArrayRef.h" #include "llvm/MC/MCRegisterInfo.h" @@ -24,8 +24,9 @@ namespace llvm { class RegisterClassInfo; class VirtRegMap; +class LiveRegMatrix; -class AllocationOrder { +class LLVM_LIBRARY_VISIBILITY AllocationOrder { SmallVector Hints; ArrayRef Order; int Pos; @@ -37,7 +38,8 @@ public: /// @param RegClassInfo Information about reserved and allocatable registers. AllocationOrder(unsigned VirtReg, const VirtRegMap &VRM, - const RegisterClassInfo &RegClassInfo); + const RegisterClassInfo &RegClassInfo, + const LiveRegMatrix *Matrix); /// Get the allocation order without reordered hints. ArrayRef getOrder() const { return Order; } @@ -45,10 +47,12 @@ public: /// Return the next physical register in the allocation order, or 0. /// It is safe to call next() again after it returned 0, it will keep /// returning 0 until rewind() is called. - unsigned next() { + unsigned next(unsigned Limit = 0) { if (Pos < 0) return Hints.end()[Pos++]; - while (Pos < int(Order.size())) { + if (!Limit) + Limit = Order.size(); + while (Pos < int(Limit)) { unsigned Reg = Order[Pos++]; if (!isHint(Reg)) return Reg;