forked from OSchip/llvm-project
[OpaquePtr][SPARC] Remove getPointerElementType() call in SparcISelLowering
Requires keeping better track of sret types.
This commit is contained in:
parent
c45bd4b9e5
commit
c0281c7607
|
@ -1761,7 +1761,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
/// Extract the preallocated type for a call or parameter.
|
||||
/// Extract the inalloca type for a call or parameter.
|
||||
Type *getParamInAllocaType(unsigned ArgNo) const {
|
||||
if (auto *Ty = Attrs.getParamInAllocaType(ArgNo))
|
||||
return Ty;
|
||||
|
@ -1770,6 +1770,15 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
/// Extract the sret type for a call or parameter.
|
||||
Type *getParamStructRetType(unsigned ArgNo) const {
|
||||
if (auto *Ty = Attrs.getParamStructRetType(ArgNo))
|
||||
return Ty;
|
||||
if (const Function *F = getCalledFunction())
|
||||
return F->getAttributes().getParamStructRetType(ArgNo);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// Extract the number of dereferenceable bytes for a call or
|
||||
/// parameter (0=unknown).
|
||||
uint64_t getRetDereferenceableBytes() const {
|
||||
|
|
|
@ -121,7 +121,7 @@ void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call,
|
|||
IsSwiftError = Call->paramHasAttr(ArgIdx, Attribute::SwiftError);
|
||||
Alignment = Call->getParamStackAlign(ArgIdx);
|
||||
IndirectType = nullptr;
|
||||
assert(IsByVal + IsPreallocated + IsInAlloca <= 1 &&
|
||||
assert(IsByVal + IsPreallocated + IsInAlloca + IsSRet <= 1 &&
|
||||
"multiple ABI attributes?");
|
||||
if (IsByVal) {
|
||||
IndirectType = Call->getParamByValType(ArgIdx);
|
||||
|
@ -132,6 +132,8 @@ void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call,
|
|||
IndirectType = Call->getParamPreallocatedType(ArgIdx);
|
||||
if (IsInAlloca)
|
||||
IndirectType = Call->getParamInAllocaType(ArgIdx);
|
||||
if (IsSRet)
|
||||
IndirectType = Call->getParamStructRetType(ArgIdx);
|
||||
}
|
||||
|
||||
/// Generate a libcall taking the given operands as arguments and returning a
|
||||
|
|
|
@ -825,9 +825,8 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
|||
hasStructRetAttr = true;
|
||||
// sret only allowed on first argument
|
||||
assert(Outs[realArgIdx].OrigArgIndex == 0);
|
||||
PointerType *Ty = cast<PointerType>(CLI.getArgs()[0].Ty);
|
||||
Type *ElementTy = Ty->getPointerElementType();
|
||||
SRetArgSize = DAG.getDataLayout().getTypeAllocSize(ElementTy);
|
||||
SRetArgSize =
|
||||
DAG.getDataLayout().getTypeAllocSize(CLI.getArgs()[0].IndirectType);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2178,8 +2177,10 @@ SparcTargetLowering::LowerF128Op(SDValue Op, SelectionDAG &DAG,
|
|||
RetPtr = DAG.getFrameIndex(RetFI, PtrVT);
|
||||
Entry.Node = RetPtr;
|
||||
Entry.Ty = PointerType::getUnqual(RetTy);
|
||||
if (!Subtarget->is64Bit())
|
||||
if (!Subtarget->is64Bit()) {
|
||||
Entry.IsSRet = true;
|
||||
Entry.IndirectType = RetTy;
|
||||
}
|
||||
Entry.IsReturned = false;
|
||||
Args.push_back(Entry);
|
||||
RetTyABI = Type::getVoidTy(*DAG.getContext());
|
||||
|
|
Loading…
Reference in New Issue