mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
Fix bug exposed by this testcase:
declare int "call_operand" (%rtx_def*, int) ;; Prototype for: call_operand declare int "restore_operand" (%rtx_def*, int) ;; Prototype for: restore_operand %rtx_def = type opaque %rtx_def = type int implementation llvm-svn: 934
This commit is contained in:
parent
8acdb272f4
commit
3495dd8b2f
@ -62,7 +62,7 @@ public:
|
|||||||
// insert - Add named definition to the symbol table...
|
// insert - Add named definition to the symbol table...
|
||||||
inline void insert(Value *N) {
|
inline void insert(Value *N) {
|
||||||
assert(N->hasName() && "Value must be named to go into symbol table!");
|
assert(N->hasName() && "Value must be named to go into symbol table!");
|
||||||
insertEntry(N->getName(), N);
|
insertEntry(N->getName(), N->getType(), N);
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert - Insert a constant or type into the symbol table with the specified
|
// insert - Insert a constant or type into the symbol table with the specified
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
inline void insert(const string &Name, Value *V) {
|
inline void insert(const string &Name, Value *V) {
|
||||||
assert((isa<Type>(V) || isa<ConstPoolVal>(V)) &&
|
assert((isa<Type>(V) || isa<ConstPoolVal>(V)) &&
|
||||||
"Can only insert types and constants here!");
|
"Can only insert types and constants here!");
|
||||||
insertEntry(Name, V);
|
insertEntry(Name, V->getType(), V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(Value *N);
|
void remove(Value *N);
|
||||||
@ -111,7 +111,7 @@ private:
|
|||||||
// insertEntry - Insert a value into the symbol table with the specified
|
// insertEntry - Insert a value into the symbol table with the specified
|
||||||
// name...
|
// name...
|
||||||
//
|
//
|
||||||
void insertEntry(const string &Name, Value *V);
|
void insertEntry(const string &Name, const Type *Ty, Value *V);
|
||||||
|
|
||||||
// This function is called when one of the types in the type plane are refined
|
// This function is called when one of the types in the type plane are refined
|
||||||
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
|
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
|
||||||
|
@ -119,9 +119,7 @@ Value *SymbolTable::type_remove(const type_iterator &It) {
|
|||||||
// insertEntry - Insert a value into the symbol table with the specified
|
// insertEntry - Insert a value into the symbol table with the specified
|
||||||
// name...
|
// name...
|
||||||
//
|
//
|
||||||
void SymbolTable::insertEntry(const string &Name, Value *V) {
|
void SymbolTable::insertEntry(const string &Name, const Type *VTy, Value *V) {
|
||||||
const Type *VTy = V->getType();
|
|
||||||
|
|
||||||
// TODO: The typeverifier should catch this when its implemented
|
// TODO: The typeverifier should catch this when its implemented
|
||||||
assert(lookup(VTy, Name) == 0 &&
|
assert(lookup(VTy, Name) == 0 &&
|
||||||
"SymbolTable::insertEntry - Name already in symbol table!");
|
"SymbolTable::insertEntry - Name already in symbol table!");
|
||||||
@ -133,9 +131,16 @@ void SymbolTable::insertEntry(const string &Name, Value *V) {
|
|||||||
|
|
||||||
iterator I = find(VTy);
|
iterator I = find(VTy);
|
||||||
if (I == end()) { // Not in collection yet... insert dummy entry
|
if (I == end()) { // Not in collection yet... insert dummy entry
|
||||||
(*this)[VTy] = VarMap();
|
// Insert a new empty element. I points to the new elements.
|
||||||
I = find(VTy);
|
I = super::insert(make_pair(VTy, VarMap())).first;
|
||||||
assert(I != end() && "How did insert fail?");
|
assert(I != end() && "How did insert fail?");
|
||||||
|
|
||||||
|
// Check to see if the type is abstract. If so, it might be refined in the
|
||||||
|
// future, which would cause the plane of the old type to get merged into
|
||||||
|
// a new type plane.
|
||||||
|
//
|
||||||
|
if (VTy->isAbstract())
|
||||||
|
cast<DerivedType>(VTy)->addAbstractTypeUser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
I->second.insert(make_pair(Name, V));
|
I->second.insert(make_pair(Name, V));
|
||||||
@ -153,7 +158,23 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
|
|||||||
const Type *NewType) {
|
const Type *NewType) {
|
||||||
if (OldType == NewType) return; // Noop, don't waste time dinking around
|
if (OldType == NewType) return; // Noop, don't waste time dinking around
|
||||||
|
|
||||||
iterator TPI = find(Type::TypeTy);
|
// Search to see if we have any values of the type oldtype. If so, we need to
|
||||||
|
// move them into the newtype plane...
|
||||||
|
iterator TPI = find(OldType);
|
||||||
|
if (TPI != end()) {
|
||||||
|
VarMap &OldPlane = TPI->second;
|
||||||
|
while (!OldPlane.empty()) {
|
||||||
|
pair<const string, Value*> V = *OldPlane.begin();
|
||||||
|
OldPlane.erase(OldPlane.begin());
|
||||||
|
insertEntry(V.first, NewType, V.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ok, now we are not referencing the type anymore... take me off your user
|
||||||
|
// list please!
|
||||||
|
OldType->removeAbstractTypeUser(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
TPI = find(Type::TypeTy);
|
||||||
assert(TPI != end() &&"Type plane not in symbol table but we contain types!");
|
assert(TPI != end() &&"Type plane not in symbol table but we contain types!");
|
||||||
|
|
||||||
// Loop over all of the types in the symbol table, replacing any references to
|
// Loop over all of the types in the symbol table, replacing any references to
|
||||||
|
Loading…
Reference in New Issue
Block a user