1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Regenerate.

llvm-svn: 32825
This commit is contained in:
Reid Spencer 2007-01-02 21:54:12 +00:00
parent e2e6789b50
commit dac232ab56
3 changed files with 385 additions and 267 deletions

File diff suppressed because it is too large Load Diff

View File

@ -301,7 +301,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" #line 895 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE { typedef union YYSTYPE {
llvm::Module *ModuleVal; llvm::Module *ModuleVal;
llvm::Function *FunctionVal; llvm::Function *FunctionVal;

View File

@ -149,6 +149,58 @@ static struct PerModuleInfo {
} }
return Ret; return Ret;
} }
bool TypeIsUnresolved(PATypeHolder* PATy) {
// If it isn't abstract, its resolved
const Type* Ty = PATy->get();
if (!Ty->isAbstract())
return false;
// Traverse the type looking for abstract types. If it isn't abstract then
// we don't need to traverse that leg of the type.
std::vector<const Type*> WorkList, SeenList;
WorkList.push_back(Ty);
while (!WorkList.empty()) {
const Type* Ty = WorkList.back();
SeenList.push_back(Ty);
WorkList.pop_back();
if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
// Check to see if this is an unresolved type
std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
for ( ; I != E; ++I) {
if (I->second.get() == OpTy)
return true;
}
} else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
const Type* TheTy = SeqTy->getElementType();
if (TheTy->isAbstract() && TheTy != Ty) {
std::vector<const Type*>::iterator I = SeenList.begin(),
E = SeenList.end();
for ( ; I != E; ++I)
if (*I == TheTy)
break;
if (I == E)
WorkList.push_back(TheTy);
}
} else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
const Type* TheTy = StrTy->getElementType(i);
if (TheTy->isAbstract() && TheTy != Ty) {
std::vector<const Type*>::iterator I = SeenList.begin(),
E = SeenList.end();
for ( ; I != E; ++I)
if (*I == TheTy)
break;
if (I == E)
WorkList.push_back(TheTy);
}
}
}
}
return false;
}
} CurModule; } CurModule;
static struct PerFunctionInfo { static struct PerFunctionInfo {
@ -1943,12 +1995,19 @@ FunctionHeaderH : OptCallingConv ResultType Name '(' ArgList ')'
std::string FunctionName($3); std::string FunctionName($3);
free($3); // Free strdup'd memory! free($3); // Free strdup'd memory!
// Check the function result for abstractness if this is a define. We should
// have no abstract types at this point
if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($2.Ty))
GEN_ERROR("Reference to abstract result: "+ $2.Ty->get()->getDescription());
std::vector<const Type*> ParamTypeList; std::vector<const Type*> ParamTypeList;
std::vector<FunctionType::ParameterAttributes> ParamAttrs; std::vector<FunctionType::ParameterAttributes> ParamAttrs;
ParamAttrs.push_back($2.Attrs); ParamAttrs.push_back($2.Attrs);
if ($5) { // If there are arguments... if ($5) { // If there are arguments...
for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I) { for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I) {
const Type* Ty = I->Ty->get(); const Type* Ty = I->Ty->get();
if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
ParamTypeList.push_back(Ty); ParamTypeList.push_back(Ty);
if (Ty != Type::VoidTy) if (Ty != Type::VoidTy)
ParamAttrs.push_back(I->Attrs); ParamAttrs.push_back(I->Attrs);