src/cpu/x86/vm/x86_32.ad

Print this page
rev 5188 : 8024344: PPC64 (part 112): C argument in register AND stack slot.
Summary: On PPC, the first 13 floating point arguments to C calls are passed in floating point registers. Also, all but the first 8 arguments are passed on the stack. So there can be floating point arguments that are passed on the stack and in a register. We duplicate the regs datastructure in c_calling_convention() to represent this.


3738   // Body of function which returns an integer array locating
3739   // arguments either in registers or in stack slots.  Passed an array
3740   // of ideal registers called "sig" and a "length" count.  Stack-slot
3741   // offsets are based on outgoing arguments, i.e. a CALLER setting up
3742   // arguments for a CALLEE.  Incoming stack arguments are
3743   // automatically biased by the preserve_stack_slots field above.
3744   calling_convention %{
3745     // No difference between ingoing/outgoing just pass false
3746     SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
3747   %}
3748 
3749 
3750   // Body of function which returns an integer array locating
3751   // arguments either in registers or in stack slots.  Passed an array
3752   // of ideal registers called "sig" and a "length" count.  Stack-slot
3753   // offsets are based on outgoing arguments, i.e. a CALLER setting up
3754   // arguments for a CALLEE.  Incoming stack arguments are
3755   // automatically biased by the preserve_stack_slots field above.
3756   c_calling_convention %{
3757     // This is obviously always outgoing
3758     (void) SharedRuntime::c_calling_convention(sig_bt, regs, length);
3759   %}
3760 
3761   // Location of C & interpreter return values
3762   c_return_value %{
3763     assert( ideal_reg >= Op_RegI && ideal_reg <= Op_RegL, "only return normal values" );
3764     static int lo[Op_RegL+1] = { 0, 0, OptoReg::Bad, EAX_num,      EAX_num,      FPR1L_num,    FPR1L_num, EAX_num };
3765     static int hi[Op_RegL+1] = { 0, 0, OptoReg::Bad, OptoReg::Bad, OptoReg::Bad, OptoReg::Bad, FPR1H_num, EDX_num };
3766 
3767     // in SSE2+ mode we want to keep the FPU stack clean so pretend
3768     // that C functions return float and double results in XMM0.
3769     if( ideal_reg == Op_RegD && UseSSE>=2 )
3770       return OptoRegPair(XMM0b_num,XMM0_num);
3771     if( ideal_reg == Op_RegF && UseSSE>=2 )
3772       return OptoRegPair(OptoReg::Bad,XMM0_num);
3773 
3774     return OptoRegPair(hi[ideal_reg],lo[ideal_reg]);
3775   %}
3776 
3777   // Location of return values
3778   return_value %{




3738   // Body of function which returns an integer array locating
3739   // arguments either in registers or in stack slots.  Passed an array
3740   // of ideal registers called "sig" and a "length" count.  Stack-slot
3741   // offsets are based on outgoing arguments, i.e. a CALLER setting up
3742   // arguments for a CALLEE.  Incoming stack arguments are
3743   // automatically biased by the preserve_stack_slots field above.
3744   calling_convention %{
3745     // No difference between ingoing/outgoing just pass false
3746     SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
3747   %}
3748 
3749 
3750   // Body of function which returns an integer array locating
3751   // arguments either in registers or in stack slots.  Passed an array
3752   // of ideal registers called "sig" and a "length" count.  Stack-slot
3753   // offsets are based on outgoing arguments, i.e. a CALLER setting up
3754   // arguments for a CALLEE.  Incoming stack arguments are
3755   // automatically biased by the preserve_stack_slots field above.
3756   c_calling_convention %{
3757     // This is obviously always outgoing
3758     (void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
3759   %}
3760 
3761   // Location of C & interpreter return values
3762   c_return_value %{
3763     assert( ideal_reg >= Op_RegI && ideal_reg <= Op_RegL, "only return normal values" );
3764     static int lo[Op_RegL+1] = { 0, 0, OptoReg::Bad, EAX_num,      EAX_num,      FPR1L_num,    FPR1L_num, EAX_num };
3765     static int hi[Op_RegL+1] = { 0, 0, OptoReg::Bad, OptoReg::Bad, OptoReg::Bad, OptoReg::Bad, FPR1H_num, EDX_num };
3766 
3767     // in SSE2+ mode we want to keep the FPU stack clean so pretend
3768     // that C functions return float and double results in XMM0.
3769     if( ideal_reg == Op_RegD && UseSSE>=2 )
3770       return OptoRegPair(XMM0b_num,XMM0_num);
3771     if( ideal_reg == Op_RegF && UseSSE>=2 )
3772       return OptoRegPair(OptoReg::Bad,XMM0_num);
3773 
3774     return OptoRegPair(hi[ideal_reg],lo[ideal_reg]);
3775   %}
3776 
3777   // Location of return values
3778   return_value %{