mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
What if functions can return aggregate values ?
One small step towards multiple return value support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47406 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
172f3118d8
commit
93f9d57bcd
@ -179,7 +179,8 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
|
||||
ParamAttrs(0) {
|
||||
SymTab = new ValueSymbolTable();
|
||||
|
||||
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)
|
||||
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy
|
||||
|| getReturnType()->getTypeID() == Type::StructTyID)
|
||||
&& "LLVM functions cannot return aggregate values!");
|
||||
|
||||
// If the function has arguments, mark them as lazily built.
|
||||
|
@ -443,7 +443,8 @@ FunctionType::FunctionType(const Type *Result,
|
||||
ContainedTys = reinterpret_cast<PATypeHandle*>(this+1);
|
||||
NumContainedTys = Params.size() + 1; // + 1 for result type
|
||||
assert((Result->isFirstClassType() || Result == Type::VoidTy ||
|
||||
isa<OpaqueType>(Result)) &&
|
||||
Result->getTypeID() == Type::StructTyID ||
|
||||
isa<OpaqueType>(Result)) &&
|
||||
"LLVM functions cannot return aggregates");
|
||||
bool isAbstract = Result->isAbstract();
|
||||
new (&ContainedTys[0]) PATypeHandle(Result, this);
|
||||
|
@ -451,7 +451,8 @@ void Verifier::visitFunction(Function &F) {
|
||||
"# formal arguments must match # of arguments for function type!",
|
||||
&F, FT);
|
||||
Assert1(F.getReturnType()->isFirstClassType() ||
|
||||
F.getReturnType() == Type::VoidTy,
|
||||
F.getReturnType() == Type::VoidTy ||
|
||||
F.getReturnType()->getTypeID() == Type::StructTyID,
|
||||
"Functions cannot return aggregate values!", &F);
|
||||
|
||||
Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy,
|
||||
@ -1090,7 +1091,9 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
|
||||
// Check to make sure that only first-class-values are operands to
|
||||
// instructions.
|
||||
Assert1(I.getOperand(i)->getType()->isFirstClassType(),
|
||||
Assert1(I.getOperand(i)->getType()->isFirstClassType()
|
||||
|| (isa<ReturnInst>(I)
|
||||
&& I.getOperand(i)->getType()->getTypeID() == Type::StructTyID),
|
||||
"Instruction operands must be first-class values!", &I);
|
||||
|
||||
if (Function *F = dyn_cast<Function>(I.getOperand(i))) {
|
||||
|
Loading…
Reference in New Issue
Block a user