mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Drop CSRET CC
llvm-svn: 33598
This commit is contained in:
parent
611d5e2eda
commit
95f3449d4d
@ -570,7 +570,6 @@ static void ResolveTypeTo(char *Name, const Type *ToTy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief This just makes any name given to it unique, up to MAX_UINT times.
|
|
||||||
static std::string makeNameUnique(const std::string& Name) {
|
static std::string makeNameUnique(const std::string& Name) {
|
||||||
static unsigned UniqueNameCounter = 1;
|
static unsigned UniqueNameCounter = 1;
|
||||||
std::string Result(Name);
|
std::string Result(Name);
|
||||||
@ -578,57 +577,6 @@ static std::string makeNameUnique(const std::string& Name) {
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is the implementation portion of TypeHasInteger. It traverses the
|
|
||||||
/// type given, avoiding recursive types, and returns true as soon as it finds
|
|
||||||
/// an integer type. If no integer type is found, it returns false.
|
|
||||||
static bool TypeHasIntegerI(const Type *Ty, std::vector<const Type*> Stack) {
|
|
||||||
// Handle some easy cases
|
|
||||||
if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID))
|
|
||||||
return false;
|
|
||||||
if (Ty->isInteger())
|
|
||||||
return true;
|
|
||||||
if (const SequentialType *STy = dyn_cast<SequentialType>(Ty))
|
|
||||||
return STy->getElementType()->isInteger();
|
|
||||||
|
|
||||||
// Avoid type structure recursion
|
|
||||||
for (std::vector<const Type*>::iterator I = Stack.begin(), E = Stack.end();
|
|
||||||
I != E; ++I)
|
|
||||||
if (Ty == *I)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Push us on the type stack
|
|
||||||
Stack.push_back(Ty);
|
|
||||||
|
|
||||||
if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
|
|
||||||
if (TypeHasIntegerI(FTy->getReturnType(), Stack))
|
|
||||||
return true;
|
|
||||||
FunctionType::param_iterator I = FTy->param_begin();
|
|
||||||
FunctionType::param_iterator E = FTy->param_end();
|
|
||||||
for (; I != E; ++I)
|
|
||||||
if (TypeHasIntegerI(*I, Stack))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
} else if (const StructType *STy = dyn_cast<StructType>(Ty)) {
|
|
||||||
StructType::element_iterator I = STy->element_begin();
|
|
||||||
StructType::element_iterator E = STy->element_end();
|
|
||||||
for (; I != E; ++I) {
|
|
||||||
if (TypeHasIntegerI(*I, Stack))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// There shouldn't be anything else, but its definitely not integer
|
|
||||||
assert(0 && "What type is this?");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This is the interface to TypeHasIntegerI. It just provides the type stack,
|
|
||||||
/// to avoid recursion, and then calls TypeHasIntegerI.
|
|
||||||
static inline bool TypeHasInteger(const Type *Ty) {
|
|
||||||
std::vector<const Type*> TyStack;
|
|
||||||
return TypeHasIntegerI(Ty, TyStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// setValueName - Set the specified value to the name given. The name may be
|
// setValueName - Set the specified value to the name given. The name may be
|
||||||
// null potentially, in which case this is a noop. The string passed in is
|
// null potentially, in which case this is a noop. The string passed in is
|
||||||
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
||||||
@ -657,16 +605,16 @@ static void setValueName(Value *V, char *NameStr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Existing) {
|
if (Existing) {
|
||||||
// An existing value of the same name was found. This might have happened
|
if (Existing->getType() == V->getType()) {
|
||||||
// because of the integer type planes collapsing in LLVM 2.0.
|
// The type of the Existing value and the new one are the same. This
|
||||||
if (Existing->getType() == V->getType() &&
|
// is probably a type plane collapsing error. If the types involved
|
||||||
!TypeHasInteger(Existing->getType())) {
|
// are both integer, just rename it. Otherwise it
|
||||||
// If the type does not contain any integers in them then this can't be
|
// is a redefinition error.
|
||||||
// a type plane collapsing issue. It truly is a redefinition and we
|
if (!Existing->getType()->isInteger()) {
|
||||||
// should error out as the assembly is invalid.
|
error("Redefinition of value named '" + Name + "' in the '" +
|
||||||
error("Redefinition of value named '" + Name + "' of type '" +
|
V->getType()->getDescription() + "' type plane");
|
||||||
V->getType()->getDescription() + "'");
|
return;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
// In LLVM 2.0 we don't allow names to be re-used for any values in a
|
// In LLVM 2.0 we don't allow names to be re-used for any values in a
|
||||||
// function, regardless of Type. Previously re-use of names was okay as
|
// function, regardless of Type. Previously re-use of names was okay as
|
||||||
@ -1628,7 +1576,7 @@ OptLinkage
|
|||||||
OptCallingConv
|
OptCallingConv
|
||||||
: /*empty*/ { $$ = CallingConv::C; }
|
: /*empty*/ { $$ = CallingConv::C; }
|
||||||
| CCC_TOK { $$ = CallingConv::C; }
|
| CCC_TOK { $$ = CallingConv::C; }
|
||||||
| CSRETCC_TOK { $$ = CallingConv::CSRet; }
|
| CSRETCC_TOK { $$ = CallingConv::C; }
|
||||||
| FASTCC_TOK { $$ = CallingConv::Fast; }
|
| FASTCC_TOK { $$ = CallingConv::Fast; }
|
||||||
| COLDCC_TOK { $$ = CallingConv::Cold; }
|
| COLDCC_TOK { $$ = CallingConv::Cold; }
|
||||||
| X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; }
|
| X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; }
|
||||||
|
@ -570,7 +570,6 @@ static void ResolveTypeTo(char *Name, const Type *ToTy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief This just makes any name given to it unique, up to MAX_UINT times.
|
|
||||||
static std::string makeNameUnique(const std::string& Name) {
|
static std::string makeNameUnique(const std::string& Name) {
|
||||||
static unsigned UniqueNameCounter = 1;
|
static unsigned UniqueNameCounter = 1;
|
||||||
std::string Result(Name);
|
std::string Result(Name);
|
||||||
@ -578,57 +577,6 @@ static std::string makeNameUnique(const std::string& Name) {
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is the implementation portion of TypeHasInteger. It traverses the
|
|
||||||
/// type given, avoiding recursive types, and returns true as soon as it finds
|
|
||||||
/// an integer type. If no integer type is found, it returns false.
|
|
||||||
static bool TypeHasIntegerI(const Type *Ty, std::vector<const Type*> Stack) {
|
|
||||||
// Handle some easy cases
|
|
||||||
if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID))
|
|
||||||
return false;
|
|
||||||
if (Ty->isInteger())
|
|
||||||
return true;
|
|
||||||
if (const SequentialType *STy = dyn_cast<SequentialType>(Ty))
|
|
||||||
return STy->getElementType()->isInteger();
|
|
||||||
|
|
||||||
// Avoid type structure recursion
|
|
||||||
for (std::vector<const Type*>::iterator I = Stack.begin(), E = Stack.end();
|
|
||||||
I != E; ++I)
|
|
||||||
if (Ty == *I)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Push us on the type stack
|
|
||||||
Stack.push_back(Ty);
|
|
||||||
|
|
||||||
if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
|
|
||||||
if (TypeHasIntegerI(FTy->getReturnType(), Stack))
|
|
||||||
return true;
|
|
||||||
FunctionType::param_iterator I = FTy->param_begin();
|
|
||||||
FunctionType::param_iterator E = FTy->param_end();
|
|
||||||
for (; I != E; ++I)
|
|
||||||
if (TypeHasIntegerI(*I, Stack))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
} else if (const StructType *STy = dyn_cast<StructType>(Ty)) {
|
|
||||||
StructType::element_iterator I = STy->element_begin();
|
|
||||||
StructType::element_iterator E = STy->element_end();
|
|
||||||
for (; I != E; ++I) {
|
|
||||||
if (TypeHasIntegerI(*I, Stack))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// There shouldn't be anything else, but its definitely not integer
|
|
||||||
assert(0 && "What type is this?");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This is the interface to TypeHasIntegerI. It just provides the type stack,
|
|
||||||
/// to avoid recursion, and then calls TypeHasIntegerI.
|
|
||||||
static inline bool TypeHasInteger(const Type *Ty) {
|
|
||||||
std::vector<const Type*> TyStack;
|
|
||||||
return TypeHasIntegerI(Ty, TyStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// setValueName - Set the specified value to the name given. The name may be
|
// setValueName - Set the specified value to the name given. The name may be
|
||||||
// null potentially, in which case this is a noop. The string passed in is
|
// null potentially, in which case this is a noop. The string passed in is
|
||||||
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
||||||
@ -657,16 +605,16 @@ static void setValueName(Value *V, char *NameStr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Existing) {
|
if (Existing) {
|
||||||
// An existing value of the same name was found. This might have happened
|
if (Existing->getType() == V->getType()) {
|
||||||
// because of the integer type planes collapsing in LLVM 2.0.
|
// The type of the Existing value and the new one are the same. This
|
||||||
if (Existing->getType() == V->getType() &&
|
// is probably a type plane collapsing error. If the types involved
|
||||||
!TypeHasInteger(Existing->getType())) {
|
// are both integer, just rename it. Otherwise it
|
||||||
// If the type does not contain any integers in them then this can't be
|
// is a redefinition error.
|
||||||
// a type plane collapsing issue. It truly is a redefinition and we
|
if (!Existing->getType()->isInteger()) {
|
||||||
// should error out as the assembly is invalid.
|
error("Redefinition of value named '" + Name + "' in the '" +
|
||||||
error("Redefinition of value named '" + Name + "' of type '" +
|
V->getType()->getDescription() + "' type plane");
|
||||||
V->getType()->getDescription() + "'");
|
return;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
// In LLVM 2.0 we don't allow names to be re-used for any values in a
|
// In LLVM 2.0 we don't allow names to be re-used for any values in a
|
||||||
// function, regardless of Type. Previously re-use of names was okay as
|
// function, regardless of Type. Previously re-use of names was okay as
|
||||||
@ -1628,7 +1576,7 @@ OptLinkage
|
|||||||
OptCallingConv
|
OptCallingConv
|
||||||
: /*empty*/ { $$ = CallingConv::C; }
|
: /*empty*/ { $$ = CallingConv::C; }
|
||||||
| CCC_TOK { $$ = CallingConv::C; }
|
| CCC_TOK { $$ = CallingConv::C; }
|
||||||
| CSRETCC_TOK { $$ = CallingConv::CSRet; }
|
| CSRETCC_TOK { $$ = CallingConv::C; }
|
||||||
| FASTCC_TOK { $$ = CallingConv::Fast; }
|
| FASTCC_TOK { $$ = CallingConv::Fast; }
|
||||||
| COLDCC_TOK { $$ = CallingConv::Cold; }
|
| COLDCC_TOK { $$ = CallingConv::Cold; }
|
||||||
| X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; }
|
| X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; }
|
||||||
|
Loading…
Reference in New Issue
Block a user