aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-upgrade/UpgradeParser.cpp.cvs
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-15 02:41:46 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-15 02:41:46 +0000
commitb6673a9e60b1b09d2ce93a5ac9a8f7b3d861a947 (patch)
treec68cb8705041c1788565e98c8dcd10fc2c97d97f /tools/llvm-upgrade/UpgradeParser.cpp.cvs
parent3d6cd1b149d778c0509ea934485c5d931a1aae7b (diff)
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade/UpgradeParser.cpp.cvs')
-rw-r--r--tools/llvm-upgrade/UpgradeParser.cpp.cvs1277
1 files changed, 640 insertions, 637 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/tools/llvm-upgrade/UpgradeParser.cpp.cvs
index 5ae0db7529..5b57b5d8a2 100644
--- a/tools/llvm-upgrade/UpgradeParser.cpp.cvs
+++ b/tools/llvm-upgrade/UpgradeParser.cpp.cvs
@@ -415,49 +415,49 @@ namespace { // Anonymous namespace to keep our implementation local
/// This type is used to keep track of the signedness of values. Instead
-/// of creating llvm::Value directly, the parser will create ValueInfo which
+/// of creating llvm::Value directly, the parser will create Value which
/// associates a Value* with a Signedness indication.
-struct ValueInfo {
+struct Value {
std::string* val;
- const TypeInfo* type;
+ const Type* type;
bool constant;
bool isConstant() const { return constant; }
- ~ValueInfo() { delete val; }
+ ~Value() { delete val; }
};
/// This type is used to keep track of the signedness of the obsolete
/// integer types. Instead of creating an llvm::Type directly, the Lexer will
-/// create instances of TypeInfo which retains the signedness indication so
+/// create instances of Type which retains the signedness indication so
/// it can be used by the parser for upgrade decisions.
/// For example if "uint" is encountered then the "first" field will be set
/// to "int32" and the "second" field will be set to "isUnsigned". If the
/// type is not obsolete then "second" will be set to "isSignless".
-class TypeInfo {
+class Type {
public:
- static const TypeInfo* get(const std::string &newType, Types oldType);
- static const TypeInfo* get(const std::string& newType, Types oldType,
- const TypeInfo* eTy, const TypeInfo* rTy);
+ static const Type* get(const std::string &newType, TypeIDs oldType);
+ static const Type* get(const std::string& newType, TypeIDs oldType,
+ const Type* eTy, const Type* rTy);
- static const TypeInfo* get(const std::string& newType, Types oldType,
- const TypeInfo *eTy, uint64_t elems);
+ static const Type* get(const std::string& newType, TypeIDs oldType,
+ const Type *eTy, uint64_t elems);
- static const TypeInfo* get(const std::string& newType, Types oldType,
+ static const Type* get(const std::string& newType, TypeIDs oldType,
TypeList* TL);
- static const TypeInfo* get(const std::string& newType, const TypeInfo* resTy,
+ static const Type* get(const std::string& newType, const Type* resTy,
TypeList* TL);
- const TypeInfo* resolve() const;
- bool operator<(const TypeInfo& that) const;
+ const Type* resolve() const;
+ bool operator<(const Type& that) const;
- bool sameNewTyAs(const TypeInfo* that) const {
+ bool sameNewTyAs(const Type* that) const {
return this->newTy == that->newTy;
}
- bool sameOldTyAs(const TypeInfo* that) const;
+ bool sameOldTyAs(const Type* that) const;
- Types getElementTy() const {
+ TypeIDs getElementTy() const {
if (elemTy) {
return elemTy->oldTy;
}
@@ -469,16 +469,16 @@ public:
return atoi(&((getNewTy().c_str())[1])); // skip the slash
}
- typedef std::vector<const TypeInfo*> UpRefStack;
+ typedef std::vector<const Type*> UpRefStack;
void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
std::string makeUniqueName(const std::string& BaseName) const;
const std::string& getNewTy() const { return newTy; }
- const TypeInfo* getResultType() const { return resultTy; }
- const TypeInfo* getElementType() const { return elemTy; }
+ const Type* getResultType() const { return resultTy; }
+ const Type* getElementType() const { return elemTy; }
- const TypeInfo* getPointerType() const {
- return get(newTy + "*", PointerTy, this, (TypeInfo*)0);
+ const Type* getPointerType() const {
+ return get(newTy + "*", PointerTy, this, (Type*)0);
}
bool isUnresolved() const { return oldTy == UnresolvedTy; }
@@ -517,13 +517,13 @@ public:
unsigned getBitWidth() const;
- const TypeInfo* getIndexedType(const ValueInfo* VI) const;
+ const Type* getIndexedType(const Value* V) const;
unsigned getNumStructElements() const {
return (elements ? elements->size() : 0);
}
- const TypeInfo* getElement(unsigned idx) const {
+ const Type* getElement(unsigned idx) const {
if (elements)
if (idx < elements->size())
return (*elements)[idx];
@@ -531,98 +531,98 @@ public:
}
private:
- TypeInfo()
+ Type()
: newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
nelems(0) {
}
- TypeInfo(const TypeInfo& that); // do not implement
- TypeInfo& operator=(const TypeInfo& that); // do not implement
+ Type(const Type& that); // do not implement
+ Type& operator=(const Type& that); // do not implement
- ~TypeInfo() { delete elements; }
+ ~Type() { delete elements; }
struct ltfunctor
{
- bool operator()(const TypeInfo* X, const TypeInfo* Y) const {
+ bool operator()(const Type* X, const Type* Y) const {
assert(X && "Can't compare null pointer");
assert(Y && "Can't compare null pointer");
return *X < *Y;
}
};
- typedef std::set<const TypeInfo*, ltfunctor> TypeRegMap;
+ typedef std::set<const Type*, ltfunctor> TypeRegMap;
- static const TypeInfo* add_new_type(TypeInfo* existing);
+ static const Type* add_new_type(Type* existing);
std::string newTy;
- Types oldTy;
- TypeInfo *elemTy;
- TypeInfo *resultTy;
+ TypeIDs oldTy;
+ Type *elemTy;
+ Type *resultTy;
TypeList *elements;
uint64_t nelems;
static TypeRegMap registry;
public:
- typedef std::vector<const TypeInfo*> TypeVector;
- typedef std::map<std::string,const TypeInfo*> TypeMap;
- typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
+ typedef std::vector<const Type*> TypeVector;
+ typedef std::map<std::string,const Type*> TypeMap;
+ typedef std::map<const Type*,std::string> TypePlaneMap;
typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
static TypeVector EnumeratedTypes;
static TypeMap NamedTypes;
static GlobalsTypeMap Globals;
};
-TypeInfo::TypeRegMap TypeInfo::registry;
-TypeInfo::TypeVector TypeInfo::EnumeratedTypes;
-TypeInfo::TypeMap TypeInfo::NamedTypes;
-TypeInfo::GlobalsTypeMap TypeInfo::Globals;
+Type::TypeRegMap Type::registry;
+Type::TypeVector Type::EnumeratedTypes;
+Type::TypeMap Type::NamedTypes;
+Type::GlobalsTypeMap Type::Globals;
-const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
- TypeInfo* Ty = new TypeInfo();
+const Type* Type::get(const std::string &newType, TypeIDs oldType) {
+ Type* Ty = new Type();
Ty->newTy = newType;
Ty->oldTy = oldType;
return add_new_type(Ty);
}
-const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
- const TypeInfo* eTy, const TypeInfo* rTy) {
- TypeInfo* Ty= new TypeInfo();
+const Type* Type::get(const std::string& newType, TypeIDs oldType,
+ const Type* eTy, const Type* rTy) {
+ Type* Ty= new Type();
Ty->newTy = newType;
Ty->oldTy = oldType;
- Ty->elemTy = const_cast<TypeInfo*>(eTy);
- Ty->resultTy = const_cast<TypeInfo*>(rTy);
+ Ty->elemTy = const_cast<Type*>(eTy);
+ Ty->resultTy = const_cast<Type*>(rTy);
return add_new_type(Ty);
}
-const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
- const TypeInfo *eTy, uint64_t elems) {
- TypeInfo* Ty = new TypeInfo();
+const Type* Type::get(const std::string& newType, TypeIDs oldType,
+ const Type *eTy, uint64_t elems) {
+ Type* Ty = new Type();
Ty->newTy = newType;
Ty->oldTy = oldType;
- Ty->elemTy = const_cast<TypeInfo*>(eTy);
+ Ty->elemTy = const_cast<Type*>(eTy);
Ty->nelems = elems;
return add_new_type(Ty);
}
-const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
+const Type* Type::get(const std::string& newType, TypeIDs oldType,
TypeList* TL) {
- TypeInfo* Ty = new TypeInfo();
+ Type* Ty = new Type();
Ty->newTy = newType;
Ty->oldTy = oldType;
Ty->elements = TL;
return add_new_type(Ty);
}
-const TypeInfo* TypeInfo::get(const std::string& newType, const TypeInfo* resTy,
+const Type* Type::get(const std::string& newType, const Type* resTy,
TypeList* TL) {
- TypeInfo* Ty = new TypeInfo();
+ Type* Ty = new Type();
Ty->newTy = newType;
Ty->oldTy = FunctionTy;
- Ty->resultTy = const_cast<TypeInfo*>(resTy);
+ Ty->resultTy = const_cast<Type*>(resTy);
Ty->elements = TL;
return add_new_type(Ty);
}
-const TypeInfo* TypeInfo::resolve() const {
+const Type* Type::resolve() const {
if (isUnresolved()) {
if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
@@ -634,7 +634,7 @@ const TypeInfo* TypeInfo::resolve() const {
yyerror(msg.c_str());
}
} else {
- TypeInfo::TypeMap::iterator I = NamedTypes.find(newTy);
+ Type::TypeMap::iterator I = NamedTypes.find(newTy);
if (I != NamedTypes.end()) {
return I->second;
} else {
@@ -648,7 +648,7 @@ const TypeInfo* TypeInfo::resolve() const {
return this;
}
-bool TypeInfo::operator<(const TypeInfo& that) const {
+bool Type::operator<(const Type& that) const {
if (this == &that)
return false;
if (oldTy != that.oldTy)
@@ -664,13 +664,13 @@ bool TypeInfo::operator<(const TypeInfo& that) const {
if (this->nelems != that.nelems)
return nelems < that.nelems;
case PointerTy: {
- const TypeInfo* thisTy = this->elemTy;
- const TypeInfo* thatTy = that.elemTy;
+ const Type* thisTy = this->elemTy;
+ const Type* thatTy = that.elemTy;
return *thisTy < *thatTy;
}
case FunctionTy: {
- const TypeInfo* thisTy = this->resultTy;
- const TypeInfo* thatTy = that.resultTy;
+ const Type* thisTy = this->resultTy;
+ const Type* thatTy = that.resultTy;
if (!thisTy->sameOldTyAs(thatTy))
return *thisTy < *thatTy;
/* FALL THROUGH */
@@ -680,8 +680,8 @@ bool TypeInfo::operator<(const TypeInfo& that) const {
if (elements->size() != that.elements->size())
return elements->size() < that.elements->size();
for (unsigned i = 0; i < elements->size(); i++) {
- const TypeInfo* thisTy = (*this->elements)[i];
- const TypeInfo* thatTy = (*that.elements)[i];
+ const Type* thisTy = (*this->elements)[i];
+ const Type* thatTy = (*that.elements)[i];
if (!thisTy->sameOldTyAs(thatTy))
return *thisTy < *thatTy;
}
@@ -695,7 +695,7 @@ bool TypeInfo::operator<(const TypeInfo& that) const {
return false;
}
-bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
+bool Type::sameOldTyAs(const Type* that) const {
if (that == 0)
return false;
if ( this == that )
@@ -709,13 +709,13 @@ bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
return false;
/* FALL THROUGH */
case PointerTy: {
- const TypeInfo* thisTy = this->elemTy;
- const TypeInfo* thatTy = that->elemTy;
+ const Type* thisTy = this->elemTy;
+ const Type* thatTy = that->elemTy;
return thisTy->sameOldTyAs(thatTy);
}
case FunctionTy: {
- const TypeInfo* thisTy = this->resultTy;
- const TypeInfo* thatTy = that->resultTy;
+ const Type* thisTy = this->resultTy;
+ const Type* thatTy = that->resultTy;
if (!thisTy->sameOldTyAs(thatTy))
return false;
/* FALL THROUGH */
@@ -725,8 +725,8 @@ bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
if (elements->size() != that->elements->size())
return false;
for (unsigned i = 0; i < elements->size(); i++) {
- const TypeInfo* thisTy = (*this->elements)[i];
- const TypeInfo* thatTy = (*that->elements)[i];
+ const Type* thisTy = (*this->elements)[i];
+ const Type* thatTy = (*that->elements)[i];
if (!thisTy->sameOldTyAs(thatTy))
return false;
}
@@ -740,7 +740,7 @@ bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
return true;
}
-bool TypeInfo::isUnresolvedDeep() const {
+bool Type::isUnresolvedDeep() const {
switch (oldTy) {
case UnresolvedTy:
return true;
@@ -759,7 +759,7 @@ bool TypeInfo::isUnresolvedDeep() const {
}
}
-unsigned TypeInfo::getBitWidth() const {
+unsigned Type::getBitWidth() const {
switch (oldTy) {
default:
case LabelTy:
@@ -784,12 +784,12 @@ unsigned TypeInfo::getBitWidth() const {
}
}
-const TypeInfo* TypeInfo::getIndexedType(const ValueInfo* VI) const {
+const Type* Type::getIndexedType(const Value* V) const {
if (isStruct()) {
- if (VI->isConstant() && VI->type->isInteger()) {
- size_t pos = VI->val->find(' ') + 1;
- if (pos < VI->val->size()) {
- uint64_t idx = atoi(VI->val->substr(pos).c_str());
+ if (V->isConstant() && V->type->isInteger()) {
+ size_t pos = V->val->find(' ') + 1;
+ if (pos < V->val->size()) {
+ uint64_t idx = atoi(V->val->substr(pos).c_str());
return (*elements)[idx];
} else {
yyerror("Invalid value for constant integer");
@@ -806,7 +806,7 @@ const TypeInfo* TypeInfo::getIndexedType(const ValueInfo* VI) const {
return 0;
}
-void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum,
+void Type::getSignedness(unsigned &sNum, unsigned &uNum,
UpRefStack& stack) const {
switch (oldTy) {
default:
@@ -834,7 +834,7 @@ void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum,
return;
}
case UnresolvedTy: {
- const TypeInfo* Ty = this->resolve();
+ const Type* Ty = this->resolve();
// Let's not recurse.
UpRefStack::const_iterator I = stack.begin(), E = stack.end();
for ( ; I != E && *I != Ty; ++I)
@@ -855,7 +855,7 @@ std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
return Name + Suffix;
}
-std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
+std::string Type::makeUniqueName(const std::string& BaseName) const {
if (BaseName == "\"alloca point\"")
return BaseName;
switch (oldTy) {
@@ -876,14 +876,14 @@ std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
case PointerTy:
case PackedTy:
case ArrayTy: {
- TypeInfo::UpRefStack stack;
+ Type::UpRefStack stack;
elemTy->resolve()->getSignedness(sNum, uNum, stack);
break;
}
case StructTy:
case PackedStructTy: {
for (unsigned i = 0; i < elements->size(); i++) {
- TypeInfo::UpRefStack stack;
+ Type::UpRefStack stack;
(*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
}
break;
@@ -910,7 +910,7 @@ std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
return AddSuffix(BaseName, Suffix);
}
-TypeInfo& TypeInfo::operator=(const TypeInfo& that) {
+Type& Type::operator=(const Type& that) {
oldTy = that.oldTy;
nelems = that.nelems;
newTy = that.newTy;
@@ -925,7 +925,7 @@ TypeInfo& TypeInfo::operator=(const TypeInfo& that) {
return *this;
}
-const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) {
+const Type* Type::add_new_type(Type* newTy) {
TypeRegMap::iterator I = registry.find(newTy);
if (I != registry.end()) {
delete newTy;
@@ -935,11 +935,14 @@ const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) {
return newTy;
}
+class Instruction {
+};
+
/// This type is used to keep track of the signedness of constants.
-struct ConstInfo {
+struct Constant {
std::string *cnst;
- const TypeInfo *type;
- ~ConstInfo() { delete cnst; }
+ const Type *type;
+ ~Constant() { delete cnst; }
};
/// This variable provides a counter for unique names. It is used in various
@@ -961,8 +964,8 @@ static std::string* deleteUselessCastName = 0;
-const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy,
- const TypeInfo* DstTy) {
+const char* getCastOpcode(std::string& Source, const Type* SrcTy,
+ const Type* DstTy) {
unsigned SrcBits = SrcTy->getBitWidth();
unsigned DstBits = DstTy->getBitWidth();
const char* opcode = "bitcast";
@@ -1038,8 +1041,8 @@ const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy,
return opcode;
}
-std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
- const TypeInfo* DstTy, bool isConst) {
+std::string getCastUpgrade(const std::string& Src, const Type* SrcTy,
+ const Type* DstTy, bool isConst) {
std::string Result;
std::string Source = Src;
if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
@@ -1048,12 +1051,12 @@ std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
if (isConst)
Source = "i64 fptoui(" + Source + " to i64)";
else {
- *O << " %cast_upgrade" << UniqueNameCounter++ << " = fptoui "
+ *O << " %cast_upgrade" << UniqueNameCounter << " = fptoui "
<< Source << " to i64\n";
- Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter);
+ Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++);
}
// Update the SrcTy for the getCastOpcode call below
- SrcTy = TypeInfo::get("i64", ULongTy);
+ SrcTy = Type::get("i64", ULongTy);
} else if (DstTy->isBool()) {
// cast type %x to bool was previously defined as setne type %x, null
// The cast semantic is now to truncate, not compare so we must retain
@@ -1079,9 +1082,9 @@ std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
return Result;
}
-const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) {
+const char* getDivRemOpcode(const std::string& opcode, const Type* TI) {
const char* op = opcode.c_str();
- const TypeInfo* Ty = TI->resolve();
+ const Type* Ty = TI->resolve();
if (Ty->isPacked())
Ty = Ty->getElementType();
if (opcode == "div")
@@ -1105,7 +1108,7 @@ const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) {
return op;
}
-std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) {
+std::string getCompareOp(const std::string& setcc, const Type* TI) {
assert(setcc.length() == 5);
char cc1 = setcc[3];
char cc2 = setcc[4];
@@ -1135,10 +1138,10 @@ std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) {
return result;
}
-const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
+const Type* getFunctionReturnType(const Type* PFTy) {
PFTy = PFTy->resolve();
if (PFTy->isPointer()) {
- const TypeInfo* ElemTy = PFTy->getElementType();
+ const Type* ElemTy = PFTy->getElementType();
ElemTy = ElemTy->resolve();
if (ElemTy->isFunction())
return ElemTy->getResultType();
@@ -1148,18 +1151,18 @@ const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
return PFTy;
}
-const TypeInfo* ResolveUpReference(const TypeInfo* Ty,
- TypeInfo::UpRefStack* stack) {
+const Type* ResolveUpReference(const Type* Ty,
+ Type::UpRefStack* stack) {
assert(Ty->isUpReference() && "Can't resolve a non-upreference");
unsigned upref = Ty->getUpRefNum();
assert(upref < stack->size() && "Invalid up reference");
return (*stack)[upref - stack->size() - 1];
}
-const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
- const TypeInfo* Result = PTy = PTy->resolve();
+const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) {
+ const Type* Result = PTy = PTy->resolve();
assert(PTy->isPointer() && "GEP Operand is not a pointer?");
- TypeInfo::UpRefStack stack;
+ Type::UpRefStack stack;
for (unsigned i = 0; i < idxs->size(); ++i) {
if (Result->isComposite()) {
Result = Result->getIndexedType((*idxs)[i]);
@@ -1184,7 +1187,7 @@ const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
// were previously unsigned or signed, respectively. This avoids name
// collisions since the unsigned and signed type planes have collapsed
// into a single signless type plane.
-std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
+std::string getUniqueName(const std::string *Name, const Type* Ty,
bool isGlobal = false, bool isDef = false) {
// If its not a symbolic name, don't modify it, probably a constant val.
@@ -1199,10 +1202,10 @@ std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
Ty = Ty->resolve();
// If its a global name, get its uniquified name, if any
- TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
- if (GI != TypeInfo::Globals.end()) {
- TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
- TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
+ Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
+ if (GI != Type::Globals.end()) {
+ Type::TypePlaneMap::iterator TPI = GI->second.begin();
+ Type::TypePlaneMap::iterator TPE = GI->second.end();
for ( ; TPI != TPE ; ++TPI) {
if (TPI->first->sameNewTyAs(Ty))
return TPI->second;
@@ -1225,13 +1228,13 @@ std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
}
std::string getGlobalName(const std::string* Name, const std::string Linkage,
- const TypeInfo* Ty, bool isConstant) {
+ const Type* Ty, bool isConstant) {
// Default to given name
std::string Result = *Name;
// Look up the name in the Globals Map
- TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
+ Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
// Did we see this global name before?
- if (GI != TypeInfo::Globals.end()) {
+ if (GI != Type::Globals.end()) {
if (Ty->isUnresolvedDeep()) {
// The Gval's type is unresolved. Consequently, we can't disambiguate it
// by type. We'll just change its name and emit a warning.
@@ -1242,7 +1245,7 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage,
Result += llvm::utostr(UniqueNameCounter);
return Result;
} else {
- TypeInfo::TypePlaneMap::iterator TPI = GI->second.find(Ty);
+ Type::TypePlaneMap::iterator TPI = GI->second.find(Ty);
if (TPI != GI->second.end()) {
// We found an existing name of the same old type. This isn't allowed
// in LLVM 2.0. Consequently, we must alter the name of the global so it
@@ -1257,8 +1260,8 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage,
// There isn't an existing definition for this name according to the
// old types. Now search the TypePlanMap for types with the same new
// name.
- TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
- TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
+ Type::TypePlaneMap::iterator TPI = GI->second.begin();
+ Type::TypePlaneMap::iterator TPE = GI->second.end();
for ( ; TPI != TPE; ++TPI) {
if (TPI->first->sameNewTyAs(Ty)) {
// The new types are the same but the old types are different so
@@ -1298,23 +1301,23 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage,
// Its a new global name, if it is external we can't change it
if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
Linkage == "extern_weak" || Linkage == "") {
- TypeInfo::Globals[Result][Ty] = Result;
+ Type::Globals[Result][Ty] = Result;
return Result;
}
// Its a new global name, and it is internal, change the name to make it
// unique for its type.
// Result = getUniqueName(Name, Ty);
- TypeInfo::Globals[*Name][Ty] = Result;
+ Type::Globals[*Name][Ty] = Result;
return Result;
}
} // End anonymous namespace
-// This function is used by the Lexer to create a TypeInfo. It can't be
+// This function is used by the Lexer to create a Type. It can't be
// in the anonymous namespace.
-const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) {
- return TypeInfo::get(newTy, oldTy);
+const Type* getType(const std::string& newTy, TypeIDs oldTy) {
+ return Type::get(newTy, oldTy);
}
@@ -1338,17 +1341,17 @@ const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) {
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 968 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 971 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
- const TypeInfo* Type;
- ValueInfo* Value;
- ConstInfo* Const;
+ const Type* Ty;
+ Value* Val;
+ Constant* Const;
ValueList* ValList;
TypeList* TypeVec;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 1352 "UpgradeParser.tab.c"
+#line 1355 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@@ -1360,7 +1363,7 @@ typedef union YYSTYPE {
/* Line 219 of yacc.c. */
-#line 1364 "UpgradeParser.tab.c"
+#line 1367 "UpgradeParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
@@ -1715,37 +1718,37 @@ static const short int yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 1033, 1033, 1033, 1034, 1034, 1038, 1038, 1038, 1038,
- 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, 1040,
- 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043,
- 1043, 1043, 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044,
- 1044, 1044, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
- 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1052,
- 1052, 1052, 1052, 1053, 1053, 1053, 1053, 1054, 1054, 1055,
- 1055, 1058, 1061, 1066, 1066, 1066, 1066, 1066, 1066, 1067,
- 1068, 1071, 1071, 1071, 1071, 1071, 1072, 1073, 1078, 1083,
- 1084, 1087, 1088, 1096, 1102, 1103, 1106, 1107, 1116, 1117,
- 1130, 1130, 1131, 1131, 1132, 1136, 1136, 1136, 1136, 1136,
- 1136, 1136, 1137, 1137, 1137, 1137, 1137, 1139, 1142, 1145,
- 1148, 1152, 1165, 1171, 1177, 1187, 1190, 1200, 1203, 1211,
- 1215, 1222, 1223, 1228, 1233, 1243, 1250, 1256, 1263, 1270,
- 1277, 1283, 1290, 1297, 1305, 1312, 1319, 1326, 1333, 1340,
- 1347, 1355, 1369, 1381, 1386, 1392, 1397, 1403, 1408, 1413,
- 1421, 1426, 1431, 1441, 1446, 1451, 1451, 1461, 1466, 1469,
- 1474, 1478, 1482, 1484, 1484, 1487, 1497, 1502, 1507, 1517,
- 1527, 1537, 1547, 1552, 1557, 1562, 1564, 1564, 1567, 1572,
- 1579, 1584, 1591, 1598, 1603, 1604, 1612, 1612, 1613, 1613,
- 1615, 1624, 1628, 1632, 1635, 1640, 1643, 1646, 1669, 1670,
- 1673, 1684, 1685, 1687, 1696, 1697, 1698, 1702, 1702, 1716,
- 1717, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1721, 1722,
- 1727, 1728, 1737, 1737, 1741, 1747, 1758, 1767, 1770, 1778,
- 1782, 1787, 1790, 1796, 1796, 1798, 1803, 1808, 1813, 1821,
- 1831, 1840, 1862, 1867, 1873, 1879, 1887, 1905, 1914, 1924,
- 1928, 1935, 1936, 1940, 1945, 1948, 1959, 1969, 1980, 1990,
- 2000, 2011, 2041, 2050, 2057, 2066, 2073, 2080, 2086, 2137,
- 2142, 2143, 2147, 2148, 2151, 2160, 2170, 2179, 2190, 2197,
- 2208, 2219
+ 0, 1036, 1036, 1036, 1037, 1037, 1041, 1041, 1041, 1041,
+ 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1043, 1043, 1043,
+ 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045,
+ 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
+ 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047,
+ 1047, 1047, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049,
+ 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1055,
+ 1055, 1055, 1055, 1056, 1056, 1056, 1056, 1057, 1057, 1058,
+ 1058, 1061, 1064, 1069, 1069, 1069, 1069, 1069, 1069, 1070,
+ 1071, 1074, 1074, 1074, 1074, 1074, 1075, 1076, 1081, 1086,
+ 1087, 1090, 1091, 1099, 1105, 1106, 1109, 1110, 1119, 1120,
+ 1133, 1133, 1134, 1134, 1135, 1139, 1139, 1139, 1139, 1139,
+ 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1142, 1145, 1148,
+ 1151, 1155, 1168, 1174, 1180, 1190, 1193, 1203, 1206, 1214,
+ 1218, 1225, 1226, 1231, 1236, 1246, 1253, 1259, 1266, 1273,
+ 1280, 1286, 1293, 1300, 1308, 1315, 1322, 1329, 1336, 1343,
+ 1350, 1358, 1372, 1384, 1389, 1395, 1400, 1406, 1411, 1416,
+ 1424, 1429, 1434, 1444, 1449, 1454, 1454, 1464, 1469, 1472,
+ 1477, 1481, 1485, 1487, 1487, 1490, 1500, 1505, 1510, 1520,
+ 1530, 1540, 1550, 1555, 1560, 1565, 1567, 1567, 1570, 1575,
+ 1582, 1587, 1594, 1601, 1606, 1607, 1615, 1615, 1616, 1616,
+ 1618, 1627, 1631, 1635, 1638, 1643, 1646, 1649, 1672, 1673,
+ 1676, 1687, 1688, 1690, 1699, 1700, 1701, 1705, 1705, 1719,
+ 1720, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1724, 1725,
+ 1730, 1731, 1740, 1740, 1744, 1750, 1761, 1770, 1773, 1781,
+ 1785, 1790, 1793, 1799, 1799, 1801, 1806, 1811, 1816, 1824,
+ 1834, 1843, 1865, 1870, 1876, 1882, 1890, 1908, 1917, 1927,
+ 1931, 1938, 1939, 1943, 1948, 1951, 1962, 1972, 1983, 1993,
+ 2003, 2014, 2044, 2053, 2060, 2069, 2076, 2083, 2089, 2140,
+ 2145, 2146, 2150, 2151, 2154, 2163, 2173, 2182, 2193, 2200,
+ 2211, 2222
};
#endif
@@ -3092,26 +3095,26 @@ yyreduce:
switch (yyn)
{
case 81:
-#line 1058 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 82:
-#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1064 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string("");
;}
break;
case 90:
-#line 1068 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1071 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 97:
-#line 1073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1076 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3120,27 +3123,27 @@ yyreduce:
break;
case 98:
-#line 1078 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1081 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 99:
-#line 1083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 100:
-#line 1084 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
break;
case 101:
-#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1090 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 102:
-#line 1088 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1091 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
@@ -3150,7 +3153,7 @@ yyreduce:
break;
case 103:
-#line 1096 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1099 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3159,17 +3162,17 @@ yyreduce:
break;
case 104:
-#line 1102 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1105 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 106:
-#line 1106 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1109 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 107:
-#line 1107 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1110 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
if (!(yyvsp[0].String)->empty())
@@ -3180,7 +3183,7 @@ yyreduce:
break;
case 109:
-#line 1117 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1120 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
@@ -3189,38 +3192,38 @@ yyreduce:
break;
case 127:
-#line 1139 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy);
+ (yyval.Ty) = Type::get(*(yyvsp[0].String), OpaqueTy);
;}
break;
case 128:
-#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy);
+ (yyval.Ty) = Type::get(*(yyvsp[0].String), UnresolvedTy);
;}
break;
case 129:
-#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{
- (yyval.Type) = (yyvsp[0].Type);
+ (yyval.Ty) = (yyvsp[0].Ty);
;}
break;
case 130:
-#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
(yyvsp[0].String)->insert(0, "\\");
- (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy);
+ (yyval.Ty) = Type::get(*(yyvsp[0].String), UpRefTy);
;}
break;
case 131:
-#line 1152 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1155 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
- std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
+ std::string newTy( (yyvsp[-3].Ty)->getNewTy() + "(");
for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
if (i != 0)
newTy += ", ";
@@ -3230,32 +3233,32 @@ yyreduce:
newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
}
newTy += ")";
- (yyval.Type) = TypeInfo::get(newTy, (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
+ (yyval.Ty) = Type::get(newTy, (yyvsp[-3].Ty), (yyvsp[-1].TypeVec));
;}
break;
case 132:
-#line 1165 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1168 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
uint64_t elems = atoi((yyvsp[-3].String)->c_str());
(yyvsp[-3].String)->insert(0,"[ ");
- *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
- (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
+ *(yyvsp[-3].String) += " x " + (yyvsp[-1].Ty)->getNewTy() + " ]";
+ (yyval.Ty) = Type::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Ty), elems);
;}
break;
case 133:
-#line 1171 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
+#line 1174 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed array type?
uint64_t elems = atoi((yyvsp[-3].String)->c_str());
(yyvsp[-3].String)->insert(0,"< ");
- *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
- (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
+ *(y