mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Convert to SymbolTable's new lookup and iteration interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c8a1fcdb48
commit
567bc2cc1e
@ -172,22 +172,21 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
const SymbolTable *SrcST = &Src->getSymbolTable();
|
const SymbolTable *SrcST = &Src->getSymbolTable();
|
||||||
|
|
||||||
// Look for a type plane for Type's...
|
// Look for a type plane for Type's...
|
||||||
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
|
SymbolTable::type_const_iterator TI = SrcST->type_begin();
|
||||||
if (PI == SrcST->end()) return false; // No named types, do nothing.
|
SymbolTable::type_const_iterator TE = SrcST->type_end();
|
||||||
|
if (TI == TE) return false; // No named types, do nothing.
|
||||||
|
|
||||||
// Some types cannot be resolved immediately because they depend on other
|
// Some types cannot be resolved immediately because they depend on other
|
||||||
// types being resolved to each other first. This contains a list of types we
|
// types being resolved to each other first. This contains a list of types we
|
||||||
// are waiting to recheck.
|
// are waiting to recheck.
|
||||||
std::vector<std::string> DelayedTypesToResolve;
|
std::vector<std::string> DelayedTypesToResolve;
|
||||||
|
|
||||||
const SymbolTable::VarMap &VM = PI->second;
|
for ( ; TI != TE; ++TI ) {
|
||||||
for (SymbolTable::type_const_iterator I = VM.begin(), E = VM.end();
|
const std::string &Name = TI->first;
|
||||||
I != E; ++I) {
|
Type *RHS = TI->second;
|
||||||
const std::string &Name = I->first;
|
|
||||||
Type *RHS = cast<Type>(I->second);
|
|
||||||
|
|
||||||
// Check to see if this type name is already in the dest module...
|
// Check to see if this type name is already in the dest module...
|
||||||
Type *Entry = cast_or_null<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *Entry = DestST->lookupType(Name);
|
||||||
|
|
||||||
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
||||||
// They look different, save the types 'till later to resolve.
|
// They look different, save the types 'till later to resolve.
|
||||||
@ -203,8 +202,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// Try direct resolution by name...
|
// Try direct resolution by name...
|
||||||
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
Type *T1 = cast<Type>(VM.find(Name)->second);
|
Type *T1 = SrcST->lookupType(Name);
|
||||||
Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *T2 = DestST->lookupType(Name);
|
||||||
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
||||||
@ -218,8 +217,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// two types: { int* } and { opaque* }
|
// two types: { int* } and { opaque* }
|
||||||
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
PATypeHolder T1(cast<Type>(VM.find(Name)->second));
|
PATypeHolder T1(SrcST->lookupType(Name));
|
||||||
PATypeHolder T2(cast<Type>(DestST->lookup(Type::TypeTy, Name)));
|
PATypeHolder T2(DestST->lookupType(Name));
|
||||||
|
|
||||||
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
@ -236,8 +235,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
if (DelayedTypesToResolve.size() == OldSize) {
|
if (DelayedTypesToResolve.size() == OldSize) {
|
||||||
const std::string &Name = DelayedTypesToResolve.back();
|
const std::string &Name = DelayedTypesToResolve.back();
|
||||||
|
|
||||||
const Type *T1 = cast<Type>(VM.find(Name)->second);
|
const Type *T1 = SrcST->lookupType(Name);
|
||||||
const Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
const Type *T2 = DestST->lookupType(Name);
|
||||||
std::cerr << "WARNING: Type conflict between types named '" << Name
|
std::cerr << "WARNING: Type conflict between types named '" << Name
|
||||||
<< "'.\n Src='";
|
<< "'.\n Src='";
|
||||||
WriteTypeSymbolic(std::cerr, T1, Src);
|
WriteTypeSymbolic(std::cerr, T1, Src);
|
||||||
@ -383,29 +382,29 @@ static GlobalValue *FindGlobalNamed(const std::string &Name, const Type *Ty,
|
|||||||
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
||||||
// table, checking each of them for a type-compatible version.
|
// table, checking each of them for a type-compatible version.
|
||||||
//
|
//
|
||||||
for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
|
for (SymbolTable::plane_iterator PI = ST->plane_begin(), PE = ST->plane_end();
|
||||||
if (I->first != Type::TypeTy) {
|
PI != PE; ++PI) {
|
||||||
SymbolTable::VarMap &VM = I->second;
|
SymbolTable::ValueMap &VM = PI->second;
|
||||||
|
|
||||||
// Does this type plane contain an entry with the specified name?
|
// Does this type plane contain an entry with the specified name?
|
||||||
SymbolTable::type_iterator TI = VM.find(Name);
|
SymbolTable::value_iterator VI = VM.find(Name);
|
||||||
if (TI != VM.end()) {
|
if (VI != VM.end()) {
|
||||||
//
|
//
|
||||||
// Ensure that this type if placed correctly into the symbol table.
|
// Ensure that this type if placed correctly into the symbol table.
|
||||||
//
|
//
|
||||||
assert(TI->second->getType() == I->first && "Type conflict!");
|
assert(VI->second->getType() == PI->first && "Type conflict!");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save a reference to the new type. Resolving the type can modify the
|
// Save a reference to the new type. Resolving the type can modify the
|
||||||
// symbol table, invalidating the TI variable.
|
// symbol table, invalidating the TI variable.
|
||||||
//
|
//
|
||||||
Value *ValPtr = TI->second;
|
Value *ValPtr = VI->second;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine whether we can fold the two types together, resolving them.
|
// Determine whether we can fold the two types together, resolving them.
|
||||||
// If so, we can use this value.
|
// If so, we can use this value.
|
||||||
//
|
//
|
||||||
if (!RecursiveResolveTypes(Ty, I->first, ST, ""))
|
if (!RecursiveResolveTypes(Ty, PI->first, ST, ""))
|
||||||
return cast<GlobalValue>(ValPtr);
|
return cast<GlobalValue>(ValPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -925,3 +924,4 @@ bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// vim: sw=2
|
||||||
|
@ -172,22 +172,21 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
const SymbolTable *SrcST = &Src->getSymbolTable();
|
const SymbolTable *SrcST = &Src->getSymbolTable();
|
||||||
|
|
||||||
// Look for a type plane for Type's...
|
// Look for a type plane for Type's...
|
||||||
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
|
SymbolTable::type_const_iterator TI = SrcST->type_begin();
|
||||||
if (PI == SrcST->end()) return false; // No named types, do nothing.
|
SymbolTable::type_const_iterator TE = SrcST->type_end();
|
||||||
|
if (TI == TE) return false; // No named types, do nothing.
|
||||||
|
|
||||||
// Some types cannot be resolved immediately because they depend on other
|
// Some types cannot be resolved immediately because they depend on other
|
||||||
// types being resolved to each other first. This contains a list of types we
|
// types being resolved to each other first. This contains a list of types we
|
||||||
// are waiting to recheck.
|
// are waiting to recheck.
|
||||||
std::vector<std::string> DelayedTypesToResolve;
|
std::vector<std::string> DelayedTypesToResolve;
|
||||||
|
|
||||||
const SymbolTable::VarMap &VM = PI->second;
|
for ( ; TI != TE; ++TI ) {
|
||||||
for (SymbolTable::type_const_iterator I = VM.begin(), E = VM.end();
|
const std::string &Name = TI->first;
|
||||||
I != E; ++I) {
|
Type *RHS = TI->second;
|
||||||
const std::string &Name = I->first;
|
|
||||||
Type *RHS = cast<Type>(I->second);
|
|
||||||
|
|
||||||
// Check to see if this type name is already in the dest module...
|
// Check to see if this type name is already in the dest module...
|
||||||
Type *Entry = cast_or_null<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *Entry = DestST->lookupType(Name);
|
||||||
|
|
||||||
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
||||||
// They look different, save the types 'till later to resolve.
|
// They look different, save the types 'till later to resolve.
|
||||||
@ -203,8 +202,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// Try direct resolution by name...
|
// Try direct resolution by name...
|
||||||
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
Type *T1 = cast<Type>(VM.find(Name)->second);
|
Type *T1 = SrcST->lookupType(Name);
|
||||||
Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *T2 = DestST->lookupType(Name);
|
||||||
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
||||||
@ -218,8 +217,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// two types: { int* } and { opaque* }
|
// two types: { int* } and { opaque* }
|
||||||
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
PATypeHolder T1(cast<Type>(VM.find(Name)->second));
|
PATypeHolder T1(SrcST->lookupType(Name));
|
||||||
PATypeHolder T2(cast<Type>(DestST->lookup(Type::TypeTy, Name)));
|
PATypeHolder T2(DestST->lookupType(Name));
|
||||||
|
|
||||||
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
@ -236,8 +235,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
if (DelayedTypesToResolve.size() == OldSize) {
|
if (DelayedTypesToResolve.size() == OldSize) {
|
||||||
const std::string &Name = DelayedTypesToResolve.back();
|
const std::string &Name = DelayedTypesToResolve.back();
|
||||||
|
|
||||||
const Type *T1 = cast<Type>(VM.find(Name)->second);
|
const Type *T1 = SrcST->lookupType(Name);
|
||||||
const Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
const Type *T2 = DestST->lookupType(Name);
|
||||||
std::cerr << "WARNING: Type conflict between types named '" << Name
|
std::cerr << "WARNING: Type conflict between types named '" << Name
|
||||||
<< "'.\n Src='";
|
<< "'.\n Src='";
|
||||||
WriteTypeSymbolic(std::cerr, T1, Src);
|
WriteTypeSymbolic(std::cerr, T1, Src);
|
||||||
@ -383,29 +382,29 @@ static GlobalValue *FindGlobalNamed(const std::string &Name, const Type *Ty,
|
|||||||
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
||||||
// table, checking each of them for a type-compatible version.
|
// table, checking each of them for a type-compatible version.
|
||||||
//
|
//
|
||||||
for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
|
for (SymbolTable::plane_iterator PI = ST->plane_begin(), PE = ST->plane_end();
|
||||||
if (I->first != Type::TypeTy) {
|
PI != PE; ++PI) {
|
||||||
SymbolTable::VarMap &VM = I->second;
|
SymbolTable::ValueMap &VM = PI->second;
|
||||||
|
|
||||||
// Does this type plane contain an entry with the specified name?
|
// Does this type plane contain an entry with the specified name?
|
||||||
SymbolTable::type_iterator TI = VM.find(Name);
|
SymbolTable::value_iterator VI = VM.find(Name);
|
||||||
if (TI != VM.end()) {
|
if (VI != VM.end()) {
|
||||||
//
|
//
|
||||||
// Ensure that this type if placed correctly into the symbol table.
|
// Ensure that this type if placed correctly into the symbol table.
|
||||||
//
|
//
|
||||||
assert(TI->second->getType() == I->first && "Type conflict!");
|
assert(VI->second->getType() == PI->first && "Type conflict!");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save a reference to the new type. Resolving the type can modify the
|
// Save a reference to the new type. Resolving the type can modify the
|
||||||
// symbol table, invalidating the TI variable.
|
// symbol table, invalidating the TI variable.
|
||||||
//
|
//
|
||||||
Value *ValPtr = TI->second;
|
Value *ValPtr = VI->second;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine whether we can fold the two types together, resolving them.
|
// Determine whether we can fold the two types together, resolving them.
|
||||||
// If so, we can use this value.
|
// If so, we can use this value.
|
||||||
//
|
//
|
||||||
if (!RecursiveResolveTypes(Ty, I->first, ST, ""))
|
if (!RecursiveResolveTypes(Ty, PI->first, ST, ""))
|
||||||
return cast<GlobalValue>(ValPtr);
|
return cast<GlobalValue>(ValPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -925,3 +924,4 @@ bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// vim: sw=2
|
||||||
|
@ -172,22 +172,21 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
const SymbolTable *SrcST = &Src->getSymbolTable();
|
const SymbolTable *SrcST = &Src->getSymbolTable();
|
||||||
|
|
||||||
// Look for a type plane for Type's...
|
// Look for a type plane for Type's...
|
||||||
SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy);
|
SymbolTable::type_const_iterator TI = SrcST->type_begin();
|
||||||
if (PI == SrcST->end()) return false; // No named types, do nothing.
|
SymbolTable::type_const_iterator TE = SrcST->type_end();
|
||||||
|
if (TI == TE) return false; // No named types, do nothing.
|
||||||
|
|
||||||
// Some types cannot be resolved immediately because they depend on other
|
// Some types cannot be resolved immediately because they depend on other
|
||||||
// types being resolved to each other first. This contains a list of types we
|
// types being resolved to each other first. This contains a list of types we
|
||||||
// are waiting to recheck.
|
// are waiting to recheck.
|
||||||
std::vector<std::string> DelayedTypesToResolve;
|
std::vector<std::string> DelayedTypesToResolve;
|
||||||
|
|
||||||
const SymbolTable::VarMap &VM = PI->second;
|
for ( ; TI != TE; ++TI ) {
|
||||||
for (SymbolTable::type_const_iterator I = VM.begin(), E = VM.end();
|
const std::string &Name = TI->first;
|
||||||
I != E; ++I) {
|
Type *RHS = TI->second;
|
||||||
const std::string &Name = I->first;
|
|
||||||
Type *RHS = cast<Type>(I->second);
|
|
||||||
|
|
||||||
// Check to see if this type name is already in the dest module...
|
// Check to see if this type name is already in the dest module...
|
||||||
Type *Entry = cast_or_null<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *Entry = DestST->lookupType(Name);
|
||||||
|
|
||||||
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
if (ResolveTypes(Entry, RHS, DestST, Name)) {
|
||||||
// They look different, save the types 'till later to resolve.
|
// They look different, save the types 'till later to resolve.
|
||||||
@ -203,8 +202,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// Try direct resolution by name...
|
// Try direct resolution by name...
|
||||||
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
for (unsigned i = 0; i != DelayedTypesToResolve.size(); ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
Type *T1 = cast<Type>(VM.find(Name)->second);
|
Type *T1 = SrcST->lookupType(Name);
|
||||||
Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
Type *T2 = DestST->lookupType(Name);
|
||||||
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
if (!ResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
||||||
@ -218,8 +217,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
// two types: { int* } and { opaque* }
|
// two types: { int* } and { opaque* }
|
||||||
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) {
|
||||||
const std::string &Name = DelayedTypesToResolve[i];
|
const std::string &Name = DelayedTypesToResolve[i];
|
||||||
PATypeHolder T1(cast<Type>(VM.find(Name)->second));
|
PATypeHolder T1(SrcST->lookupType(Name));
|
||||||
PATypeHolder T2(cast<Type>(DestST->lookup(Type::TypeTy, Name)));
|
PATypeHolder T2(DestST->lookupType(Name));
|
||||||
|
|
||||||
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
||||||
// We are making progress!
|
// We are making progress!
|
||||||
@ -236,8 +235,8 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
|||||||
if (DelayedTypesToResolve.size() == OldSize) {
|
if (DelayedTypesToResolve.size() == OldSize) {
|
||||||
const std::string &Name = DelayedTypesToResolve.back();
|
const std::string &Name = DelayedTypesToResolve.back();
|
||||||
|
|
||||||
const Type *T1 = cast<Type>(VM.find(Name)->second);
|
const Type *T1 = SrcST->lookupType(Name);
|
||||||
const Type *T2 = cast<Type>(DestST->lookup(Type::TypeTy, Name));
|
const Type *T2 = DestST->lookupType(Name);
|
||||||
std::cerr << "WARNING: Type conflict between types named '" << Name
|
std::cerr << "WARNING: Type conflict between types named '" << Name
|
||||||
<< "'.\n Src='";
|
<< "'.\n Src='";
|
||||||
WriteTypeSymbolic(std::cerr, T1, Src);
|
WriteTypeSymbolic(std::cerr, T1, Src);
|
||||||
@ -383,29 +382,29 @@ static GlobalValue *FindGlobalNamed(const std::string &Name, const Type *Ty,
|
|||||||
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
// It doesn't exist exactly, scan through all of the type planes in the symbol
|
||||||
// table, checking each of them for a type-compatible version.
|
// table, checking each of them for a type-compatible version.
|
||||||
//
|
//
|
||||||
for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
|
for (SymbolTable::plane_iterator PI = ST->plane_begin(), PE = ST->plane_end();
|
||||||
if (I->first != Type::TypeTy) {
|
PI != PE; ++PI) {
|
||||||
SymbolTable::VarMap &VM = I->second;
|
SymbolTable::ValueMap &VM = PI->second;
|
||||||
|
|
||||||
// Does this type plane contain an entry with the specified name?
|
// Does this type plane contain an entry with the specified name?
|
||||||
SymbolTable::type_iterator TI = VM.find(Name);
|
SymbolTable::value_iterator VI = VM.find(Name);
|
||||||
if (TI != VM.end()) {
|
if (VI != VM.end()) {
|
||||||
//
|
//
|
||||||
// Ensure that this type if placed correctly into the symbol table.
|
// Ensure that this type if placed correctly into the symbol table.
|
||||||
//
|
//
|
||||||
assert(TI->second->getType() == I->first && "Type conflict!");
|
assert(VI->second->getType() == PI->first && "Type conflict!");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save a reference to the new type. Resolving the type can modify the
|
// Save a reference to the new type. Resolving the type can modify the
|
||||||
// symbol table, invalidating the TI variable.
|
// symbol table, invalidating the TI variable.
|
||||||
//
|
//
|
||||||
Value *ValPtr = TI->second;
|
Value *ValPtr = VI->second;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine whether we can fold the two types together, resolving them.
|
// Determine whether we can fold the two types together, resolving them.
|
||||||
// If so, we can use this value.
|
// If so, we can use this value.
|
||||||
//
|
//
|
||||||
if (!RecursiveResolveTypes(Ty, I->first, ST, ""))
|
if (!RecursiveResolveTypes(Ty, PI->first, ST, ""))
|
||||||
return cast<GlobalValue>(ValPtr);
|
return cast<GlobalValue>(ValPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -925,3 +924,4 @@ bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// vim: sw=2
|
||||||
|
@ -246,7 +246,7 @@ GlobalVariable *Module::getGlobalVariable(const std::string &Name,
|
|||||||
bool Module::addTypeName(const std::string &Name, const Type *Ty) {
|
bool Module::addTypeName(const std::string &Name, const Type *Ty) {
|
||||||
SymbolTable &ST = getSymbolTable();
|
SymbolTable &ST = getSymbolTable();
|
||||||
|
|
||||||
if (ST.lookup(Type::TypeTy, Name)) return true; // Already in symtab...
|
if (ST.lookupType(Name)) return true; // Already in symtab...
|
||||||
|
|
||||||
// Not in symbol table? Set the name with the Symtab as an argument so the
|
// Not in symbol table? Set the name with the Symtab as an argument so the
|
||||||
// type knows what to update...
|
// type knows what to update...
|
||||||
@ -259,7 +259,7 @@ bool Module::addTypeName(const std::string &Name, const Type *Ty) {
|
|||||||
/// null if there is none by that name.
|
/// null if there is none by that name.
|
||||||
const Type *Module::getTypeByName(const std::string &Name) const {
|
const Type *Module::getTypeByName(const std::string &Name) const {
|
||||||
const SymbolTable &ST = getSymbolTable();
|
const SymbolTable &ST = getSymbolTable();
|
||||||
return cast_or_null<Type>(ST.lookup(Type::TypeTy, Name));
|
return cast_or_null<Type>(ST.lookupType(Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// getTypeName - If there is at least one entry in the symbol table for the
|
// getTypeName - If there is at least one entry in the symbol table for the
|
||||||
@ -267,13 +267,12 @@ const Type *Module::getTypeByName(const std::string &Name) const {
|
|||||||
//
|
//
|
||||||
std::string Module::getTypeName(const Type *Ty) const {
|
std::string Module::getTypeName(const Type *Ty) const {
|
||||||
const SymbolTable &ST = getSymbolTable();
|
const SymbolTable &ST = getSymbolTable();
|
||||||
if (ST.find(Type::TypeTy) == ST.end())
|
|
||||||
return ""; // No names for types...
|
|
||||||
|
|
||||||
SymbolTable::type_const_iterator TI = ST.type_begin(Type::TypeTy);
|
SymbolTable::type_const_iterator TI = ST.type_begin();
|
||||||
SymbolTable::type_const_iterator TE = ST.type_end(Type::TypeTy);
|
SymbolTable::type_const_iterator TE = ST.type_end();
|
||||||
|
if ( TI == TE ) return ""; // No names for types
|
||||||
|
|
||||||
while (TI != TE && TI->second != (const Value*)Ty)
|
while (TI != TE && TI->second != Ty)
|
||||||
++TI;
|
++TI;
|
||||||
|
|
||||||
if (TI != TE) // Must have found an entry!
|
if (TI != TE) // Must have found an entry!
|
||||||
|
Loading…
Reference in New Issue
Block a user