Skip to content

Floating Point Constant Register Allocation Optimization #192

@weiwenhao

Description

@weiwenhao

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions