Remove the Function::getRetAttributes method in favor of using the AttributeSet accessor method.
llvm-svn: 171256
This commit is contained in:
parent
94dcaf8e2b
commit
74dba875e2
|
@ -189,11 +189,6 @@ public:
|
||||||
void setGC(const char *Str);
|
void setGC(const char *Str);
|
||||||
void clearGC();
|
void clearGC();
|
||||||
|
|
||||||
/// getRetAttributes - Return the return attributes for querying.
|
|
||||||
Attribute getRetAttributes() const {
|
|
||||||
return AttributeList.getRetAttributes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// addAttribute - adds the attribute to the list of attributes.
|
/// addAttribute - adds the attribute to the list of attributes.
|
||||||
void addAttribute(unsigned i, Attribute attr);
|
void addAttribute(unsigned i, Attribute attr);
|
||||||
|
|
||||||
|
|
|
@ -2217,7 +2217,7 @@ private:
|
||||||
/// GetReturnInfo - Given an LLVM IR type and return type attributes,
|
/// GetReturnInfo - Given an LLVM IR type and return type attributes,
|
||||||
/// compute the return value EVTs and flags, and optionally also
|
/// compute the return value EVTs and flags, and optionally also
|
||||||
/// the offsets, if the return value is being lowered to memory.
|
/// the offsets, if the return value is being lowered to memory.
|
||||||
void GetReturnInfo(Type* ReturnType, Attribute attr,
|
void GetReturnInfo(Type* ReturnType, AttributeSet attr,
|
||||||
SmallVectorImpl<ISD::OutputArg> &Outs,
|
SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
const TargetLowering &TLI);
|
const TargetLowering &TLI);
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf) {
|
||||||
|
|
||||||
// Check whether the function can return without sret-demotion.
|
// Check whether the function can return without sret-demotion.
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(Fn->getReturnType(),
|
GetReturnInfo(Fn->getReturnType(), Fn->getAttributes(), Outs, TLI);
|
||||||
Fn->getAttributes().getRetAttributes(), Outs, TLI);
|
|
||||||
CanLowerReturn = TLI.CanLowerReturn(Fn->getCallingConv(), *MF,
|
CanLowerReturn = TLI.CanLowerReturn(Fn->getCallingConv(), *MF,
|
||||||
Fn->isVarArg(),
|
Fn->isVarArg(),
|
||||||
Outs, Fn->getContext());
|
Outs, Fn->getContext());
|
||||||
|
|
|
@ -1233,9 +1233,11 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
|
||||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||||
|
|
||||||
const Function *F = I.getParent()->getParent();
|
const Function *F = I.getParent()->getParent();
|
||||||
if (F->getRetAttributes().hasAttribute(Attribute::SExt))
|
if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
|
||||||
|
Attribute::SExt))
|
||||||
ExtendKind = ISD::SIGN_EXTEND;
|
ExtendKind = ISD::SIGN_EXTEND;
|
||||||
else if (F->getRetAttributes().hasAttribute(Attribute::ZExt))
|
else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
|
||||||
|
Attribute::ZExt))
|
||||||
ExtendKind = ISD::ZERO_EXTEND;
|
ExtendKind = ISD::ZERO_EXTEND;
|
||||||
|
|
||||||
if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
|
if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
|
||||||
|
@ -1250,7 +1252,8 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
|
||||||
|
|
||||||
// 'inreg' on function refers to return value
|
// 'inreg' on function refers to return value
|
||||||
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
||||||
if (F->getRetAttributes().hasAttribute(Attribute::InReg))
|
if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
|
||||||
|
Attribute::InReg))
|
||||||
Flags.setInReg();
|
Flags.setInReg();
|
||||||
|
|
||||||
// Propagate extension type if any
|
// Propagate extension type if any
|
||||||
|
@ -5194,8 +5197,7 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee,
|
||||||
|
|
||||||
// Check whether the function can return without sret-demotion.
|
// Check whether the function can return without sret-demotion.
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(RetTy, CS.getAttributes().getRetAttributes(),
|
GetReturnInfo(RetTy, CS.getAttributes(), Outs, TLI);
|
||||||
Outs, TLI);
|
|
||||||
|
|
||||||
bool CanLowerReturn = TLI.CanLowerReturn(CS.getCallingConv(),
|
bool CanLowerReturn = TLI.CanLowerReturn(CS.getCallingConv(),
|
||||||
DAG.getMachineFunction(),
|
DAG.getMachineFunction(),
|
||||||
|
@ -6584,8 +6586,7 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
|
||||||
|
|
||||||
// Check whether the function can return without sret-demotion.
|
// Check whether the function can return without sret-demotion.
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(F.getReturnType(), F.getAttributes().getRetAttributes(),
|
GetReturnInfo(F.getReturnType(), F.getAttributes(), Outs, TLI);
|
||||||
Outs, TLI);
|
|
||||||
|
|
||||||
if (!FuncInfo->CanLowerReturn) {
|
if (!FuncInfo->CanLowerReturn) {
|
||||||
// Put in an sret pointer parameter before all the other parameters.
|
// Put in an sret pointer parameter before all the other parameters.
|
||||||
|
|
|
@ -990,7 +990,7 @@ unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
|
||||||
/// type of the given function. This does not require a DAG or a return value,
|
/// type of the given function. This does not require a DAG or a return value,
|
||||||
/// and is suitable for use before any DAGs for the function are constructed.
|
/// and is suitable for use before any DAGs for the function are constructed.
|
||||||
/// TODO: Move this out of TargetLowering.cpp.
|
/// TODO: Move this out of TargetLowering.cpp.
|
||||||
void llvm::GetReturnInfo(Type* ReturnType, Attribute attr,
|
void llvm::GetReturnInfo(Type* ReturnType, AttributeSet attr,
|
||||||
SmallVectorImpl<ISD::OutputArg> &Outs,
|
SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
const TargetLowering &TLI) {
|
const TargetLowering &TLI) {
|
||||||
SmallVector<EVT, 4> ValueVTs;
|
SmallVector<EVT, 4> ValueVTs;
|
||||||
|
@ -1002,9 +1002,9 @@ void llvm::GetReturnInfo(Type* ReturnType, Attribute attr,
|
||||||
EVT VT = ValueVTs[j];
|
EVT VT = ValueVTs[j];
|
||||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||||
|
|
||||||
if (attr.hasAttribute(Attribute::SExt))
|
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt))
|
||||||
ExtendKind = ISD::SIGN_EXTEND;
|
ExtendKind = ISD::SIGN_EXTEND;
|
||||||
else if (attr.hasAttribute(Attribute::ZExt))
|
else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt))
|
||||||
ExtendKind = ISD::ZERO_EXTEND;
|
ExtendKind = ISD::ZERO_EXTEND;
|
||||||
|
|
||||||
// FIXME: C calling convention requires the return type to be promoted to
|
// FIXME: C calling convention requires the return type to be promoted to
|
||||||
|
@ -1022,13 +1022,13 @@ void llvm::GetReturnInfo(Type* ReturnType, Attribute attr,
|
||||||
|
|
||||||
// 'inreg' on function refers to return value
|
// 'inreg' on function refers to return value
|
||||||
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
||||||
if (attr.hasAttribute(Attribute::InReg))
|
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::InReg))
|
||||||
Flags.setInReg();
|
Flags.setInReg();
|
||||||
|
|
||||||
// Propagate extension type if any
|
// Propagate extension type if any
|
||||||
if (attr.hasAttribute(Attribute::SExt))
|
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt))
|
||||||
Flags.setSExt();
|
Flags.setSExt();
|
||||||
else if (attr.hasAttribute(Attribute::ZExt))
|
else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt))
|
||||||
Flags.setZExt();
|
Flags.setZExt();
|
||||||
|
|
||||||
for (unsigned i = 0; i < NumParts; ++i)
|
for (unsigned i = 0; i < NumParts; ++i)
|
||||||
|
|
|
@ -2102,8 +2102,7 @@ bool ARMFastISel::SelectRet(const Instruction *I) {
|
||||||
CallingConv::ID CC = F.getCallingConv();
|
CallingConv::ID CC = F.getCallingConv();
|
||||||
if (Ret->getNumOperands() > 0) {
|
if (Ret->getNumOperands() > 0) {
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(F.getReturnType(), F.getAttributes().getRetAttributes(),
|
GetReturnInfo(F.getReturnType(), F.getAttributes(), Outs, TLI);
|
||||||
Outs, TLI);
|
|
||||||
|
|
||||||
// Analyze operands of the call, assigning locations to each operand.
|
// Analyze operands of the call, assigning locations to each operand.
|
||||||
SmallVector<CCValAssign, 16> ValLocs;
|
SmallVector<CCValAssign, 16> ValLocs;
|
||||||
|
|
|
@ -740,8 +740,7 @@ bool X86FastISel::X86SelectRet(const Instruction *I) {
|
||||||
|
|
||||||
if (Ret->getNumOperands() > 0) {
|
if (Ret->getNumOperands() > 0) {
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(F.getReturnType(), F.getAttributes().getRetAttributes(),
|
GetReturnInfo(F.getReturnType(), F.getAttributes(), Outs, TLI);
|
||||||
Outs, TLI);
|
|
||||||
|
|
||||||
// Analyze operands of the call, assigning locations to each operand.
|
// Analyze operands of the call, assigning locations to each operand.
|
||||||
SmallVector<CCValAssign, 16> ValLocs;
|
SmallVector<CCValAssign, 16> ValLocs;
|
||||||
|
@ -1585,8 +1584,7 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
||||||
|
|
||||||
// Check whether the function can return without sret-demotion.
|
// Check whether the function can return without sret-demotion.
|
||||||
SmallVector<ISD::OutputArg, 4> Outs;
|
SmallVector<ISD::OutputArg, 4> Outs;
|
||||||
GetReturnInfo(I->getType(), CS.getAttributes().getRetAttributes(),
|
GetReturnInfo(I->getType(), CS.getAttributes(), Outs, TLI);
|
||||||
Outs, TLI);
|
|
||||||
bool CanLowerReturn = TLI.CanLowerReturn(CS.getCallingConv(),
|
bool CanLowerReturn = TLI.CanLowerReturn(CS.getCallingConv(),
|
||||||
*FuncInfo.MF, FTy->isVarArg(),
|
*FuncInfo.MF, FTy->isVarArg(),
|
||||||
Outs, FTy->getContext());
|
Outs, FTy->getContext());
|
||||||
|
|
Loading…
Reference in New Issue