[PATCH] D59715: [HotColdSplit] Reflect full cost of parameters in split penalty

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 10:17:13 PDT 2020


hiraditya added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/HotColdSplitting.cpp:88
 
+static cl::opt<int> MaxParametersForSplit(
+    "hotcoldsplit-max-params", cl::init(8), cl::Hidden,
----------------
vsk wrote:
> rjf wrote:
> > xbolva00 wrote:
> > > vsk wrote:
> > > > hiraditya wrote:
> > > > > vsk wrote:
> > > > > > hiraditya wrote:
> > > > > > > Should we initialize this to be same as # of argument registers. Any arguments more than supported by argument registers are generally stored on stack and may add to code-size overhead both in caller and callee.
> > > > > > Ah, do you mean the number of arguments that can be passed by register? If so, yes, that seems like a straightforward improvement.
> > > > > yes
> > > > I had a look at TargetLowering, TargetCallingConv and a few related interfaces, but couldn't find a way to determine the number of gprs available for pointer-sized call arguments. The necessary information is available in .td files, e.g. for AArch64 there's an entry for:
> > > > 
> > > > ```
> > > >   CCIfType<[i32], CCAssignToRegWithShadow<[W0, W1, W2, W3, W4, W5, W6, W7],
> > > >                                           [X0, X1, X2, X3, X4, X5, X6, X7]>>,
> > > > ```
> > > > 
> > > > Do you know whether there's a straightforward way to surface that?
> > > Maybe @ctopper knows? 
> > Is there a way to get access to a `TargetMachine` instance here? If so, then maybe then you can use `MCRegisterInfo::getNumRegs()` which can be accessed via `TargetMachine` to get the number of registers (Apologies in advance if this isn't helping). 
> MCRegisterInfo::getNumRegs() seems to count the number of registers available on the target, but we're just interested in the subset that can be used to pass pointer-sized values given the selected calling convention.
It doesn't look like the calling convention is exposed to the middle end. So it might be tricky to do the plumbing work to get those values. Given that the calling convention do not usually change can we hard-code some commonly used values in this pass?

Briefly looking at CallingConvention files in lib/Target, it seems:
- X86_64 only allows 4 integer arguments to be passed in a register, and 4 floating point.
- Arch64, ARM, RISC-V have 8 argument registers.

Depending on a calling convention these values do change though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59715/new/

https://reviews.llvm.org/D59715



More information about the llvm-commits mailing list