Nat! via llvm-dev
2015-Sep-17 20:55 UTC
[llvm-dev] Introspecting the calling convention and triple
Hi assume, that you know the calling convention of a function and the target-triple of the destination. You also know the types of the parameters. How would you go about finding out, which machine register or stack offset/size will be used for those parameters, if they will be zero extended or not ? Ciao Nat! P.S. Apologies, for this being something somewhat of a cross-post, a bit reworded from an unanswered mail in cfe-dev :)
Daniel Sanders via llvm-dev
2015-Sep-18 09:59 UTC
[llvm-dev] Introspecting the calling convention and triple
Hi, The triple doesn't really tell you much about the desired target but I won't go into that here. There's an explanation at http://lists.llvm.org/pipermail/llvm-dev/2015-July/087700.html. I'm not sure how you'd extract the information you want from this but I can point you at the right code. At the clang level, you can find some of this using *ABIInfo::classifyReturnType() and *ABIInfo::classifyArgumentType(). These functions tell clang how to lower to LLVM-IR and specifies whether the return/argument is passed indirectly or not, sign/zero/not extended, etc. The code responsible for assigning registers, stack slots, etc. in the backend is in *TargetLowering::LowerCall(), *TargetLowering::LowerFormalArguments(), and *TargetLowering::LowerReturn(). Hope that helps> -----Original Message----- > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Nat! > via llvm-dev > Sent: 17 September 2015 21:55 > To: llvm-dev > Subject: [llvm-dev] Introspecting the calling convention and triple > > Hi > > assume, that you know the calling convention of a function and the > target-triple of the destination. You also know the types of the parameters. > > How would you go about finding out, which machine register or stack > offset/size will be used for those parameters, if they will be zero > extended or not ? > > Ciao > Nat! > > P.S. Apologies, for this being something somewhat of a cross-post, a bit > reworded from an unanswered mail in cfe-dev :) > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev