[llvm-dev] What's "register pressure set"
Andrew Trick via llvm-dev
llvm-dev at lists.llvm.org
Mon May 23 15:58:23 PDT 2016
> On May 23, 2016, at 12:57 AM, Xing Su via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi everyone,
>
> I'm looking through codes related to registered pressure tracking, mainly the source files 'RegisterPressure.h/cpp', 'MachineRegisterInfo.h/cpp', 'TargetRegisterInfo.h/cpp'.
>
> There is a concept I can hardly understand, the 'register pressure set'. Class 'TargetRegisterInfo' defines two virtual methods 'getRegClassPressureSets' and 'getRegUnitPressureSets' for querying but I don't see any subclasses overriding it.
>
> What's the meaning of the register pressure set? Anyone can give me some help?
I wish this were better explained/presented in the interface. It's not really so complicated...
Essentially, a register unit is the smallest granual in the target's register file. Some parts of wider registers may be addressed as smaller subregisters. A pressure set is an abstraction that allows the compiler to track the register usage across different register widths in machine independent code.
Say I have a machine with two 64-bit registers: {R0, R1}
And one of the registers can be addressed as two 32-bit registers: {R0L, R0H}
You need two pressure sets to track usage: P32 and P64.
limit(P32) = 2
limit(P64) = 4
That's not a typo. The 64-bit presure set is 4 deep, even though the machine only has two 64-bit registers.
An assignment to a 64-bit register increments P64 by two units:
R0 = ... // P64 += 2
An assignment to a 32-bit register increments both sets, each by one unit:
R0L = ... // P32 += 1; P64 += 1
The LLVM implementation of all this is extraodinarilly complex because these pressure sets are inferred from arbitrary register definitions, subregister relations, and register classes.
Preciselly tracking pressure using the pressure set abstraction can also be fairly expensive.
-Andy
>
> Thanks!
>
>
> Xing
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list