summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterPressure.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/RegisterPressure.h')
-rw-r--r--lib/CodeGen/RegisterPressure.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/CodeGen/RegisterPressure.h b/lib/CodeGen/RegisterPressure.h
index 733177eae3..93bb85a435 100644
--- a/lib/CodeGen/RegisterPressure.h
+++ b/lib/CodeGen/RegisterPressure.h
@@ -23,6 +23,7 @@ namespace llvm {
class LiveIntervals;
class RegisterClassInfo;
+class MachineInstr;
/// Base class for register pressure results.
struct RegisterPressure {
@@ -79,6 +80,30 @@ struct RegionPressure : RegisterPressure {
void openBottom(MachineBasicBlock::const_iterator PrevBottom);
};
+/// Store the results of a change in pressure.
+///
+/// ExcessUnits is the value of the largest difference in register units beyond
+/// the target's pressure limits across the affected pressure sets, where
+/// largest is defined as the absolute value of the difference. Negative
+/// ExcessUnits indicates a reduction in pressure that had already exceeded the
+/// target's limits.
+///
+/// MaxUnitIncrease is the largest increase in register units required across
+/// the scheduled region across the affected pressure sets, regardless of the
+/// target's pressure limits.
+///
+/// If ExcessUnits == 0, then ExcessSetID is invalid.
+/// If MaxUnitIncrease == 0, then MaxSetID is invalid.
+struct RegPressureDelta {
+ int ExcessUnits;
+ unsigned ExcessSetID;
+ int MaxUnitIncrease;
+ unsigned MaxSetID;
+
+ RegPressureDelta():
+ ExcessUnits(0), ExcessSetID(~0U), MaxUnitIncrease(0), MaxSetID(~0U) {}
+};
+
/// Track the current register pressure at some position in the instruction
/// stream, and remember the high water mark within the region traversed. This
/// does not automatically consider live-through ranges. The client may
@@ -151,6 +176,30 @@ public:
/// or if closeRegion() was explicitly invoked.
RegisterPressure &getPressure() { return P; }
+ /// Consider the pressure increase caused by traversing this instruction
+ /// bottom-up. Find the pressure set with the most change beyond its pressure
+ /// limit based on the tracker's current pressure, and record the number of
+ /// excess register units of that pressure set introduced by this instruction.
+ void getMaxUpwardPressureDelta(const MachineInstr *MI,
+ RegPressureDelta &Delta);
+
+ /// Consider the pressure increase caused by traversing this instruction
+ /// top-down. Find the pressure set with the most change beyond its pressure
+ /// limit based on the tracker's current pressure, and record the number of
+ /// excess register units of that pressure set introduced by this instruction.
+ void getMaxDownwardPressureDelta(const MachineInstr *MI,
+ RegPressureDelta &Delta);
+
+ /// Find the pressure set with the most change beyond its pressure limit after
+ /// traversing this instruction either upward or downward depending on the
+ /// closed end of the current region.
+ void getMaxPressureDelta(const MachineInstr *MI, RegPressureDelta &Delta) {
+ if (isTopClosed())
+ return getMaxDownwardPressureDelta(MI, Delta);
+ assert(isBottomClosed() && "Uninitialized pressure tracker");
+ return getMaxUpwardPressureDelta(MI, Delta);
+ }
+
protected:
bool isTopClosed() const;
bool isBottomClosed() const;