mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Change interface for TargetLowering::LowerCallTo and TargetLowering::LowerCall
to pass around a struct instead of a large set of individual values. This cleans up the interface and allows more information to be added to the struct for future targets without requiring changes to each and every target. NV_CONTRIB git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "llvm/CallingConv.h"
|
||||
#include "llvm/InlineAsm.h"
|
||||
#include "llvm/Attributes.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/CodeGen/RuntimeLibcalls.h"
|
||||
#include "llvm/Support/DebugLoc.h"
|
||||
@@ -1203,11 +1204,6 @@ public:
|
||||
llvm_unreachable("Not Implemented");
|
||||
}
|
||||
|
||||
/// LowerCallTo - This function lowers an abstract call to a function into an
|
||||
/// actual call. This returns a pair of operands. The first element is the
|
||||
/// return value for the function (if RetTy is not VoidTy). The second
|
||||
/// element is the outgoing token chain. It calls LowerCall to do the actual
|
||||
/// lowering.
|
||||
struct ArgListEntry {
|
||||
SDValue Node;
|
||||
Type* Ty;
|
||||
@@ -1223,13 +1219,72 @@ public:
|
||||
isSRet(false), isNest(false), isByVal(false), Alignment(0) { }
|
||||
};
|
||||
typedef std::vector<ArgListEntry> ArgListTy;
|
||||
std::pair<SDValue, SDValue>
|
||||
LowerCallTo(SDValue Chain, Type *RetTy, bool RetSExt, bool RetZExt,
|
||||
bool isVarArg, bool isInreg, unsigned NumFixedArgs,
|
||||
CallingConv::ID CallConv, bool isTailCall,
|
||||
bool doesNotRet, bool isReturnValueUsed,
|
||||
SDValue Callee, ArgListTy &Args,
|
||||
SelectionDAG &DAG, DebugLoc dl) const;
|
||||
|
||||
/// CallLoweringInfo - This structure contains all information that is
|
||||
/// necessary for lowering calls. It is passed to TLI::LowerCallTo when the
|
||||
/// SelectionDAG builder needs to lower a call, and targets will see this
|
||||
/// struct in their LowerCall implementation.
|
||||
struct CallLoweringInfo {
|
||||
SDValue Chain;
|
||||
Type *RetTy;
|
||||
bool RetSExt : 1;
|
||||
bool RetZExt : 1;
|
||||
bool IsVarArg : 1;
|
||||
bool IsInReg : 1;
|
||||
bool DoesNotReturn : 1;
|
||||
bool IsReturnValueUsed : 1;
|
||||
|
||||
// IsTailCall should be modified by implementations of
|
||||
// TargetLowering::LowerCall that perform tail call conversions.
|
||||
bool IsTailCall;
|
||||
|
||||
unsigned NumFixedArgs;
|
||||
CallingConv::ID CallConv;
|
||||
SDValue Callee;
|
||||
ArgListTy &Args;
|
||||
SelectionDAG &DAG;
|
||||
DebugLoc DL;
|
||||
ImmutableCallSite *CS;
|
||||
SmallVector<ISD::OutputArg, 32> Outs;
|
||||
SmallVector<SDValue, 32> OutVals;
|
||||
SmallVector<ISD::InputArg, 32> Ins;
|
||||
|
||||
|
||||
/// CallLoweringInfo - Constructs a call lowering context based on the
|
||||
/// ImmutableCallSite \p cs.
|
||||
CallLoweringInfo(SDValue chain, Type *retTy,
|
||||
FunctionType *FTy, bool isTailCall, SDValue callee,
|
||||
ArgListTy &args, SelectionDAG &dag, DebugLoc dl,
|
||||
ImmutableCallSite &cs)
|
||||
: Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attribute::SExt)),
|
||||
RetZExt(cs.paramHasAttr(0, Attribute::ZExt)), IsVarArg(FTy->isVarArg()),
|
||||
IsInReg(cs.paramHasAttr(0, Attribute::InReg)),
|
||||
DoesNotReturn(cs.doesNotReturn()),
|
||||
IsReturnValueUsed(!cs.getInstruction()->use_empty()),
|
||||
IsTailCall(isTailCall), NumFixedArgs(FTy->getNumParams()),
|
||||
CallConv(cs.getCallingConv()), Callee(callee), Args(args), DAG(dag),
|
||||
DL(dl), CS(&cs) {}
|
||||
|
||||
/// CallLoweringInfo - Constructs a call lowering context based on the
|
||||
/// provided call information.
|
||||
CallLoweringInfo(SDValue chain, Type *retTy, bool retSExt, bool retZExt,
|
||||
bool isVarArg, bool isInReg, unsigned numFixedArgs,
|
||||
CallingConv::ID callConv, bool isTailCall,
|
||||
bool doesNotReturn, bool isReturnValueUsed, SDValue callee,
|
||||
ArgListTy &args, SelectionDAG &dag, DebugLoc dl)
|
||||
: Chain(chain), RetTy(retTy), RetSExt(retSExt), RetZExt(retZExt),
|
||||
IsVarArg(isVarArg), IsInReg(isInReg), DoesNotReturn(doesNotReturn),
|
||||
IsReturnValueUsed(isReturnValueUsed), IsTailCall(isTailCall),
|
||||
NumFixedArgs(numFixedArgs), CallConv(callConv), Callee(callee),
|
||||
Args(args), DAG(dag), DL(dl), CS(NULL) {}
|
||||
};
|
||||
|
||||
/// LowerCallTo - This function lowers an abstract call to a function into an
|
||||
/// actual call. This returns a pair of operands. The first element is the
|
||||
/// return value for the function (if RetTy is not VoidTy). The second
|
||||
/// element is the outgoing token chain. It calls LowerCall to do the actual
|
||||
/// lowering.
|
||||
std::pair<SDValue, SDValue> LowerCallTo(CallLoweringInfo &CLI) const;
|
||||
|
||||
/// LowerCall - This hook must be implemented to lower calls into the
|
||||
/// the specified DAG. The outgoing arguments to the call are described
|
||||
@@ -1238,13 +1293,7 @@ public:
|
||||
/// InVals array with legal-type return values from the call, and return
|
||||
/// the resulting token chain value.
|
||||
virtual SDValue
|
||||
LowerCall(SDValue /*Chain*/, SDValue /*Callee*/,
|
||||
CallingConv::ID /*CallConv*/, bool /*isVarArg*/,
|
||||
bool /*doesNotRet*/, bool &/*isTailCall*/,
|
||||
const SmallVectorImpl<ISD::OutputArg> &/*Outs*/,
|
||||
const SmallVectorImpl<SDValue> &/*OutVals*/,
|
||||
const SmallVectorImpl<ISD::InputArg> &/*Ins*/,
|
||||
DebugLoc /*dl*/, SelectionDAG &/*DAG*/,
|
||||
LowerCall(CallLoweringInfo &/*CLI*/,
|
||||
SmallVectorImpl<SDValue> &/*InVals*/) const {
|
||||
llvm_unreachable("Not Implemented");
|
||||
}
|
||||
|
Reference in New Issue
Block a user