Why CallingConvention is modeled at multiple places in LLVM IR

Was doing some work related to changing a Function’s CallingConvention.

I couldn’t help notice the CallingConvention is modeled with each Function itself as well as each and every single CallSite.

This seems duplicate to me and I wonder which one should I patch in my pass


I also had the same thought when I started using LLVM. :sweat_smile: IMO, calling conventions should simply be part of function types. For example,

  • i32 fastcc (i32)
  • i64 swiftcc (f64, f64)

Does anyone know how the original design has been agreed on?

1 Like