[PATCH] D27050: [X86] Add explicit regparm flag for X86-32 calling convention.

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 12:51:37 PST 2017


niravd added a comment.

> Can you elaborate on why we need these new calling conventions? I thought that just the module flag would be enough to get things right.

The module flag makes it clear how to do the lowering for intrinsics. The calling convention is to mark which calls are to intrinsics. At call time we only have the type / arg attributes and the calling convention and given the C regparm attribute, we can't rely on the reg arg attributes being zero for just intrinsics. The obvious solutions for this are:

1. Explicitly label all library calls as being of a special calling convention that always uses the module flag value - Uses two calling conventions because of StdCall.
2. Calculate which parameters should be done in registers in intrinsic lowering time -  This seems brittle and more awkward than it's worth.
3. Mark each intrinsic function with a new "isIntrinsic" function-level attribute - Attributes seem more valuable a resource then calling conventions but this would work as well.

I'm disinclined to implement 2 but 3 might be reasonable.

1. Add a isIntrinsic Attribute to each intrinsic function - This is reasonable, but

2.

3. . Mark the reg attributes correctly in the intrinsic table directly- This is a pain again and Intrinsics are supposed to be meaningful outside of modules so this is

. One could modify the Intrinsics::getAttributes to take the module but its

2.

At call lowering time we only have the calling convention and the argument attributes of the callee function

The problem is that because of the regparm function attribute it's not currently visible if any particularly callee function being lowered is an intrinsic or not. The only


https://reviews.llvm.org/D27050





More information about the llvm-commits mailing list