-
-
Notifications
You must be signed in to change notification settings - Fork 64
Description
While golang puts floating-point constants in the initial block, register allocation is done to implement putting the definition before the point of use. Instruction scheduling can achieve a similar effect, but it requires a global move and will also cross multiple call barriers.
If this special life cycle generated by a floating-point constant is recognized in the interval of a register (floating-point constants cannot be modified), and the interval generated by the var defined in the ssa definition is immutable, then the initialization recognizes the const interval. So after the initialization recognizes the const interval, the interval can be spilled directly into the stack (in fact, it can be deleted directly), and the value of the constant is stored directly in the interval.
A test case needs to be added to see if this approach can be applied to int const. When a register must be assigned, insert the mov instruction and assign the register to the interval.
The mov stack -> reg is directly replaced by mov const -> reg. But the const here needs to support rip.