[PATCH] D25204: Register Calling Convention, Clang changes

Oren Ben Simhon via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 05:25:56 PDT 2016


oren_ben_simhon added inline comments.


> AttrDocs.td:1267
> +
> +.. _`__regcall`: https://software.intel.com/en-us/node/512847
> +  }];

You might want to use the following link instead because it is most updated: https://software.intel.com/en-us/node/693069

> TargetInfo.cpp:3352
>    // Keep track of the number of assigned registers.
> -  unsigned freeIntRegs = 6, freeSSERegs = 8;
> +  unsigned freeIntRegs = IsRegCall ? 11 : 6;
> +  unsigned freeSSERegs = IsRegCall ? 16 : 8;

According to the ABI, there are 12 free int regs for windows and 11 free int regs for non-windows (linux, OSX, etc). Is that taken into account somewhere?

> TargetInfo.cpp:3732
> +  } else if (IsRegCall) {
> +    // RegCall gives us 16 SSE registers total, return or otherwise.
> +    FreeSSERegs = 16;

Maybe i misinterpret the comment, but AFAIK, RegCall gives us 16 SSE registers for each (return values and passed arguments)

> regcall.c:26
> +void __regcall v3(int a, struct Small b, int c) {}
> +// Win32: define x86_regcallcc void @"\01__regcall3__v3 at 12"(i32 inreg %a, i32 %b.0, i32 inreg %c)
> +// Win64: define x86_regcallcc void @"\01__regcall3__v3 at 24"(i32 %a, i32 %b.coerce, i32 %c)

I see that expended structures don't get InReg attribute. IMHO, If you know that the value should be saved in register then you InReg attribute should be added.

https://reviews.llvm.org/D25204





More information about the cfe-commits mailing list