Skip to content

Investigate more aggressive MachineOutlining strategies #49

@resistor

Description

@resistor

The AArch64 backend implements a number of different strategies for MachineOutliner which are used to reduce overhead / improve code size savings:

  • Default - the outlined code uses a normal call sequence
  • Tail call - the outlined code ends with a tail call
  • No LR Save - the link register is known to be dead, so the save/restore can be skipped
  • Thunk - the outlined code ends with a call to a normal function
  • RegSave - the link register can be saved/restored to a scratch register rather than to the stack.

These are reasonably well explained in the upstream code here: https://github.com/llvm/llvm-project/blob/590f451b60d434b26c634a07125fb05baf461fa0/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp#L8570

The RISCV equivalent, by contrast, only implements the Default strategy today. Given that MachineOutliner provides significant code size savings for us, we should investigate porting some or all of the more advanced strategies from AArch64 to RISCV. Ideally this should be done in LLVM upstream, then cherry-picked and adapted for CHERIoT as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions