1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14939
This commit is contained in:
Reid Spencer 2004-07-18 00:12:03 +00:00
parent b320f8eb03
commit 99ac617179

View File

@ -425,12 +425,9 @@ Constant* BytecodeReader::getConstantValue(unsigned TypeSlot, unsigned Slot) {
if (Value *V = getValue(TypeSlot, Slot, false)) if (Value *V = getValue(TypeSlot, Slot, false))
if (Constant *C = dyn_cast<Constant>(V)) if (Constant *C = dyn_cast<Constant>(V))
return C; // If we already have the value parsed, just return it return C; // If we already have the value parsed, just return it
else if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
// ConstantPointerRef's are an abomination, but at least they don't have
// to infest bytecode files.
return ConstantPointerRef::get(GV);
else else
error("Reference of a value is expected to be a constant!"); error("Value for slot " + utostr(Slot) +
" is expected to be a constant!");
const Type *Ty = getType(TypeSlot); const Type *Ty = getType(TypeSlot);
std::pair<const Type*, unsigned> Key(Ty, Slot); std::pair<const Type*, unsigned> Key(Ty, Slot);
@ -1356,14 +1353,13 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) {
GlobalValue *GV; GlobalValue *GV;
if (Val) { if (Val) {
if (!(GV = dyn_cast<GlobalValue>(Val))) if (!(GV = dyn_cast<GlobalValue>(Val)))
error("Value of ConstantPointerRef not in ValueTable!"); error("GlobalValue not in ValueTable!");
} else { } else {
error("Forward references are not allowed here."); error("Forward references are not allowed here.");
} }
Constant* Result = ConstantPointerRef::get(GV); if (Handler) Handler->handleConstantPointer(PT, Slot, GV );
if (Handler) Handler->handleConstantPointer(PT, Slot, GV, Result); return GV;
return Result;
} }
default: default: