mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
getresult does not support nested aggregates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47396 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
55574c2cea
commit
dd4d45337b
@ -2719,10 +2719,21 @@ GetResultInst::GetResultInst(Value *Aggregate, unsigned Index,
|
||||
bool GetResultInst::isValidOperands(const Value *Aggregate, unsigned Index) {
|
||||
if (!Aggregate)
|
||||
return false;
|
||||
if (const StructType *STy = dyn_cast<StructType>(Aggregate->getType()))
|
||||
if (Index < STy->getNumElements())
|
||||
return true;
|
||||
|
||||
if (const StructType *STy = dyn_cast<StructType>(Aggregate->getType())) {
|
||||
unsigned NumElements = STy->getNumElements();
|
||||
if (Index >= NumElements)
|
||||
return false;
|
||||
|
||||
// getresult aggregate value's element types are restricted to
|
||||
// avoid nested aggregates.
|
||||
for (unsigned i = 0; i < NumElements; ++i)
|
||||
if (!STy->getElementType(i)->isFirstClassType())
|
||||
return false;
|
||||
|
||||
// Otherwise, Aggregate is valid.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user