[llvm-commits] [llvm] r157006 - in /llvm/trunk/lib/CodeGen: MachineScheduler.cpp RegisterPressure.cpp RegisterPressure.h

Andrew Trick atrick at apple.com
Thu May 17 15:59:14 PDT 2012


On May 17, 2012, at 2:13 PM, Eric Christopher <echristo at apple.com> wrote:

>> +  /// List of pressure sets that exceed the target's pressure limit before
>> +  /// scheduling, listed in increasing set ID order. Each pressure set is paired
>> +  /// with its max pressure in the currently scheduled regions.
>> +  std::vector<PressureElement> RegionCriticalPSets;
>> +
> 
> Not sure how many of any of the things you have in std::vector you expect, but
> if it's small perhaps a SmallVector?

Not sure it makes a difference. But for the intellectually curious, this was my reasoning: DAG is only allocated once per function so its vectors get reused. The vectors are always passed around as their own ArrayRefs, not as some subpart of another container. DAG is a large collection of top level fields that I didn't want to pad.

>> +/// Return true if the LHS reg pressure effect is better than RHS.
> 
> "Better"? :)

Better comments committed. We can't just say that one regpressure delta is less than another though. Register pressure has a number of dimensions and we view it as good or bad using heuristcs and comparing it to other things going on in the scheduling region.

-Andy

>> +static bool compareRPDelta(const RegPressureDelta &LHS,
>> +                           const RegPressureDelta &RHS) {
>> +  // Compare each component of pressure in decreasing order of importance
>> +  // without checking if any are valid. Invalid PressureElements are assumed to
>> +  // have UnitIncrease==0, so are neutral.
>> +  if (LHS.Excess.UnitIncrease != RHS.Excess.UnitIncrease)
>> +    return LHS.Excess.UnitIncrease < RHS.Excess.UnitIncrease;
>> +
>> +  if (LHS.CriticalMax.UnitIncrease != RHS.CriticalMax.UnitIncrease)
>> +    return LHS.CriticalMax.UnitIncrease < RHS.CriticalMax.UnitIncrease;
>> +
>> +  if (LHS.CurrentMax.UnitIncrease != RHS.CurrentMax.UnitIncrease)
>> +    return LHS.CurrentMax.UnitIncrease < RHS.CurrentMax.UnitIncrease;
>> +
>> +  return false;
>> +}
>> +
> 
> -eric




More information about the llvm-commits mailing list