clangir icon indicating copy to clipboard operation
clangir copied to clipboard

ABI-aware calling conventions

Open bcardosolopes opened this issue 1 year ago • 0 comments

Right now CIRGen mostly uses direct lowering (1 to 1 correspondence between C/C++ and IR), this is not how things are expected to work, since the LLVM emitted is not ABI compatible with what traditional LLVM codegen does, nor matches what ABI specs expect.

The current plan is to handle all ABI logic before we lower down to LLVM, these are the high level items needed in order to implement this:

  1. Add cir.call support for holding attributes for each param.
  2. In CIRGen, add ABI attributes that represent how these params need to be broken down in a later passes.
  3. Add a new pass or teach LoweringPrepare how to break the params based on each param attributes

(cc: @sitio-couto @sommerlukas)

bcardosolopes avatar Jan 23 '24 22:01 bcardosolopes