mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 19:24:25 +00:00
Make musttail more robust for vector types on x86
Previously I tried to plug musttail into the existing vararg lowering code. That turned out to be a mistake, because non-vararg calls use significantly different register lowering, even on x86. For example, AVX vectors are usually passed in registers to normal functions and memory to vararg functions. Now musttail uses a completely separate lowering. Hopefully this can be used as the basis for non-x86 perfect forwarding. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D6156 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224745 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -158,6 +158,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Describes a register that needs to be forwarded from the prologue to a
|
||||
/// musttail call.
|
||||
struct ForwardedRegister {
|
||||
ForwardedRegister(unsigned VReg, MCPhysReg PReg, MVT VT)
|
||||
: VReg(VReg), PReg(PReg), VT(VT) {}
|
||||
unsigned VReg;
|
||||
MCPhysReg PReg;
|
||||
MVT VT;
|
||||
};
|
||||
|
||||
/// CCAssignFn - This function assigns a location for Val, updating State to
|
||||
/// reflect the change. It returns 'true' if it failed to handle Val.
|
||||
typedef bool CCAssignFn(unsigned ValNo, MVT ValVT,
|
||||
@ -470,6 +480,19 @@ public:
|
||||
return PendingLocs;
|
||||
}
|
||||
|
||||
/// Compute the remaining unused register parameters that would be used for
|
||||
/// the given value type. This is useful when varargs are passed in the
|
||||
/// registers that normal prototyped parameters would be passed in, or for
|
||||
/// implementing perfect forwarding.
|
||||
void getRemainingRegParmsForType(SmallVectorImpl<MCPhysReg> &Regs, MVT VT,
|
||||
CCAssignFn Fn);
|
||||
|
||||
/// Compute the set of registers that need to be preserved and forwarded to
|
||||
/// any musttail calls.
|
||||
void analyzeMustTailForwardedRegisters(
|
||||
SmallVectorImpl<ForwardedRegister> &Forwards, ArrayRef<MVT> RegParmTypes,
|
||||
CCAssignFn Fn);
|
||||
|
||||
private:
|
||||
/// MarkAllocated - Mark a register and all of its aliases as allocated.
|
||||
void MarkAllocated(unsigned Reg);
|
||||
|
Reference in New Issue
Block a user