[PATCH] Add FPExt option to CCValAssign::LocInfo

Lang Hames lhames at gmail.com
Tue Jan 14 12:01:54 PST 2014


Thanks Jim. Committed in r199252.

- Lang.

On Tue, Jan 14, 2014 at 10:05 AM, Jim Grosbach <grosbach at apple.com> wrote:
> LGTM, thanks!
>
> On Jan 9, 2014, at 2:27 PM, Lang Hames <lhames at gmail.com> wrote:
>
>> Hi All,
>>
>> At the moment, when generating calling convention functions, Tablegen
>> will mistakenly specify integer promotions for floating point types.
>> E.g, writing:
>>
>> CCIfType<[f32], CCPromoteToType<f64>>
>>
>> will generate:
>>
>> if (LocVT == MVT::f32) {
>>  LocVT = MVT::f64;
>>  if (ArgFlags.isSExt())
>>      LocInfo = CCValAssign::SExt;
>>  else if (ArgFlags.isZExt())
>>      LocInfo = CCValAssign::ZExt;
>>  else
>>      LocInfo = CCValAssign::AExt;
>> }
>>
>> This logic always return CCValAssign::AExt for FP promotions, since
>> isSExt() and isZExt() both return false for FP types. The resulting
>> combination isn't sane though, since AExt is an integer extend.
>>
>> Backends that use the CCPromoteToType for FP values have been forced
>> to hack around this (E.g. AArch64). I think the proper solution is to
>> introduce an 'FPExt' option to CCValAssign::LocInfo, and have tablegen
>> produce something like:
>>
>> if (LocVT == MVT::f32) {
>>  LocVT = MVT::f64;
>>  LocInfo = CCValAssign::FPExt;
>> }
>>
>> The attached patch does this. The AArch64 backend is updated to treat
>> FPExt as AExt, preserving the existing hack, but allowing it to be
>> removed in the future. Sparc and X86 are updated to assert that they
>> never see an FPExt (if they had previously encountered an AExt for an
>> FP type we would have seen them explode already). All other backends
>> already had assertions to catch unexpected loc info options.
>>
>> Out-of-tree targets that are currently expecting an FP/AExt combo will
>> need to update their code accordingly, but the required changes will
>> be trivial.
>>
>> Could someone who's more familiar with the calling convention lowering
>> logic take a look at this before I commit?
>>
>> Cheers,
>> Lang.
>> <AddFPExtLocInfo.patch>_______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list