mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL, ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering provides three virtual functions for targets to override: LowerFormalArguments, LowerCall, and LowerRet, which replace the custom lowering done on the special nodes. They provide the same information, but in a more immediately usable format. This also reworks much of the target-independent tail call logic. The decision of whether or not to perform a tail call is now cleanly split between target-independent portions, and the target dependent portion in IsEligibleForTailCallOptimization. This also synchronizes all in-tree targets, to help enable future refactoring and feature work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -160,8 +160,6 @@ namespace llvm {
|
||||
/// indexed. This is used to implement atomic operations.
|
||||
STCX,
|
||||
|
||||
/// TAILCALL - Indicates a tail call should be taken.
|
||||
TAILCALL,
|
||||
/// TC_RETURN - A tail call return.
|
||||
/// operand #0 chain
|
||||
/// operand #1 callee (register or absolute)
|
||||
@@ -327,12 +325,12 @@ namespace llvm {
|
||||
/// the offset of the target addressing mode.
|
||||
virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
|
||||
|
||||
/// IsEligibleForTailCallOptimization - Check whether the call is eligible
|
||||
/// for tail call optimization. Targets which want to do tail call
|
||||
/// optimization should implement this function.
|
||||
virtual bool IsEligibleForTailCallOptimization(CallSDNode *TheCall,
|
||||
SDValue Ret,
|
||||
SelectionDAG &DAG) const;
|
||||
virtual bool
|
||||
IsEligibleForTailCallOptimization(SDValue Callee,
|
||||
unsigned CalleeCC,
|
||||
bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
SelectionDAG& DAG) const;
|
||||
|
||||
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
|
||||
|
||||
@@ -370,20 +368,6 @@ namespace llvm {
|
||||
SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG, int VarArgsFrameIndex,
|
||||
int VarArgsStackOffset, unsigned VarArgsNumGPR,
|
||||
unsigned VarArgsNumFPR, const PPCSubtarget &Subtarget);
|
||||
SDValue LowerFORMAL_ARGUMENTS_SVR4(SDValue Op, SelectionDAG &DAG,
|
||||
int &VarArgsFrameIndex,
|
||||
int &VarArgsStackOffset,
|
||||
unsigned &VarArgsNumGPR,
|
||||
unsigned &VarArgsNumFPR,
|
||||
const PPCSubtarget &Subtarget);
|
||||
SDValue LowerFORMAL_ARGUMENTS_Darwin(SDValue Op, SelectionDAG &DAG,
|
||||
int &VarArgsFrameIndex,
|
||||
const PPCSubtarget &Subtarget);
|
||||
SDValue LowerCALL_Darwin(SDValue Op, SelectionDAG &DAG,
|
||||
const PPCSubtarget &Subtarget, TargetMachine &TM);
|
||||
SDValue LowerCALL_SVR4(SDValue Op, SelectionDAG &DAG,
|
||||
const PPCSubtarget &Subtarget, TargetMachine &TM);
|
||||
SDValue LowerRET(SDValue Op, SelectionDAG &DAG, TargetMachine &TM);
|
||||
SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
|
||||
const PPCSubtarget &Subtarget);
|
||||
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
|
||||
@@ -400,6 +384,71 @@ namespace llvm {
|
||||
SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG);
|
||||
SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG);
|
||||
SDValue LowerMUL(SDValue Op, SelectionDAG &DAG);
|
||||
|
||||
SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
|
||||
unsigned CallConv, bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
SDValue FinishCall(unsigned CallConv, DebugLoc dl, bool isTailCall,
|
||||
bool isVarArg,
|
||||
SelectionDAG &DAG,
|
||||
SmallVector<std::pair<unsigned, SDValue>, 8>
|
||||
&RegsToPass,
|
||||
SDValue InFlag, SDValue Chain,
|
||||
SDValue &Callee,
|
||||
int SPDiff, unsigned NumBytes,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
|
||||
virtual SDValue
|
||||
LowerFormalArguments(SDValue Chain,
|
||||
unsigned CallConv, bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
|
||||
virtual SDValue
|
||||
LowerCall(SDValue Chain, SDValue Callee,
|
||||
unsigned CallConv, bool isVarArg, bool isTailCall,
|
||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
|
||||
virtual SDValue
|
||||
LowerReturn(SDValue Chain,
|
||||
unsigned CallConv, bool isVarArg,
|
||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
DebugLoc dl, SelectionDAG &DAG);
|
||||
|
||||
SDValue
|
||||
LowerFormalArguments_Darwin(SDValue Chain,
|
||||
unsigned CallConv, bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
SDValue
|
||||
LowerFormalArguments_SVR4(SDValue Chain,
|
||||
unsigned CallConv, bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
|
||||
SDValue
|
||||
LowerCall_Darwin(SDValue Chain, SDValue Callee,
|
||||
unsigned CallConv, bool isVarArg, bool isTailCall,
|
||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
SDValue
|
||||
LowerCall_SVR4(SDValue Chain, SDValue Callee,
|
||||
unsigned CallConv, bool isVarArg, bool isTailCall,
|
||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals);
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user