mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-21 16:24:47 +00:00
remove dead code left over from when this functionality was shared with the
bcwriter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c6c384314a
commit
c3e56e20e4
@ -119,13 +119,11 @@ private:
|
|||||||
/// been inserted already, they get inserted, otherwise they are ignored.
|
/// been inserted already, they get inserted, otherwise they are ignored.
|
||||||
/// Either way, the slot number for the Value* is returned.
|
/// Either way, the slot number for the Value* is returned.
|
||||||
unsigned getOrCreateSlot(const Value *V);
|
unsigned getOrCreateSlot(const Value *V);
|
||||||
unsigned getOrCreateSlot(const Type *Ty);
|
|
||||||
|
|
||||||
/// Insert a value into the value table. Return the slot number
|
/// Insert a value into the value table. Return the slot number
|
||||||
/// that it now occupies. BadThings(TM) will happen if you insert a
|
/// that it now occupies. BadThings(TM) will happen if you insert a
|
||||||
/// Value that's already been inserted.
|
/// Value that's already been inserted.
|
||||||
unsigned insertValue(const Value *V);
|
unsigned insertValue(const Value *V);
|
||||||
unsigned insertValue(const Type *Ty);
|
|
||||||
|
|
||||||
/// Add all of the module level global variables (and their initializers)
|
/// Add all of the module level global variables (and their initializers)
|
||||||
/// and function declarations, but not the contents of those functions.
|
/// and function declarations, but not the contents of those functions.
|
||||||
@ -1666,8 +1664,9 @@ unsigned SlotMachine::getOrCreateSlot(const Value *V) {
|
|||||||
|
|
||||||
const Type* VTy = V->getType();
|
const Type* VTy = V->getType();
|
||||||
|
|
||||||
// Just ignore void typed things
|
// Just ignore void typed things or things with names.
|
||||||
if (VTy == Type::VoidTy) return 0; // FIXME: Wrong return value!
|
if (VTy == Type::VoidTy || V->hasName())
|
||||||
|
return 0; // FIXME: Wrong return value!
|
||||||
|
|
||||||
// Look up the type plane for the Value's type from the module map
|
// Look up the type plane for the Value's type from the module map
|
||||||
TypedPlanes::const_iterator MI = mMap.find(VTy);
|
TypedPlanes::const_iterator MI = mMap.find(VTy);
|
||||||
@ -1737,44 +1736,6 @@ unsigned SlotMachine::getOrCreateSlot(const Value *V) {
|
|||||||
return insertValue(V);
|
return insertValue(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new slot, or return the existing slot if it is already
|
|
||||||
// inserted. Note that the logic here parallels getSlot but instead
|
|
||||||
// of asserting when the Value* isn't found, it inserts the value.
|
|
||||||
unsigned SlotMachine::getOrCreateSlot(const Type *Ty) {
|
|
||||||
assert(Ty && "Can't insert a null Type to SlotMachine");
|
|
||||||
|
|
||||||
if (TheFunction) {
|
|
||||||
// Lookup the Type in the function map
|
|
||||||
TypeMap::const_iterator FTI = fTypes.map.find(Ty);
|
|
||||||
// If the type doesn't exist in the function map
|
|
||||||
if (FTI == fTypes.map.end()) {
|
|
||||||
// Look up the type in the module map
|
|
||||||
TypeMap::const_iterator MTI = mTypes.map.find(Ty);
|
|
||||||
// If we didn't find it, it wasn't inserted
|
|
||||||
if (MTI == mTypes.map.end())
|
|
||||||
return insertValue(Ty);
|
|
||||||
else
|
|
||||||
// We found it only at the module level
|
|
||||||
return MTI->second;
|
|
||||||
|
|
||||||
// else the value exists in the function map
|
|
||||||
} else {
|
|
||||||
// Return the slot number as the module's contribution to
|
|
||||||
// the type plane plus the index in the function's contribution
|
|
||||||
// to the type plane.
|
|
||||||
return mTypes.next_slot + FTI->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// N.B. Can only get here if !TheFunction
|
|
||||||
|
|
||||||
// Lookup the type in the module's map
|
|
||||||
TypeMap::const_iterator MTI = mTypes.map.find(Ty);
|
|
||||||
if (MTI != mTypes.map.end())
|
|
||||||
return MTI->second;
|
|
||||||
|
|
||||||
return insertValue(Ty);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Low level insert function. Minimal checking is done. This
|
// Low level insert function. Minimal checking is done. This
|
||||||
// function is just for the convenience of getOrCreateSlot (above).
|
// function is just for the convenience of getOrCreateSlot (above).
|
||||||
@ -1782,13 +1743,7 @@ unsigned SlotMachine::insertValue(const Value *V) {
|
|||||||
assert(V && "Can't insert a null Value into SlotMachine!");
|
assert(V && "Can't insert a null Value into SlotMachine!");
|
||||||
assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
|
assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
|
||||||
"Can't insert a non-GlobalValue Constant into SlotMachine");
|
"Can't insert a non-GlobalValue Constant into SlotMachine");
|
||||||
|
assert(V->getType() != Type::VoidTy && !V->hasName());
|
||||||
// If this value does not contribute to a plane (is void)
|
|
||||||
// or if the value already has a name then ignore it.
|
|
||||||
if (V->getType() == Type::VoidTy || V->hasName()) {
|
|
||||||
SC_DEBUG("ignored value " << *V << "\n");
|
|
||||||
return 0; // FIXME: Wrong return value
|
|
||||||
}
|
|
||||||
|
|
||||||
const Type *VTy = V->getType();
|
const Type *VTy = V->getType();
|
||||||
unsigned DestSlot = 0;
|
unsigned DestSlot = 0;
|
||||||
@ -1813,21 +1768,3 @@ unsigned SlotMachine::insertValue(const Value *V) {
|
|||||||
SC_DEBUG("]\n");
|
SC_DEBUG("]\n");
|
||||||
return DestSlot;
|
return DestSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Low level insert function. Minimal checking is done. This
|
|
||||||
// function is just for the convenience of getOrCreateSlot (above).
|
|
||||||
unsigned SlotMachine::insertValue(const Type *Ty) {
|
|
||||||
assert(Ty && "Can't insert a null Type into SlotMachine!");
|
|
||||||
|
|
||||||
unsigned DestSlot = 0;
|
|
||||||
|
|
||||||
if (TheFunction) {
|
|
||||||
DestSlot = fTypes.map[Ty] = fTypes.next_slot++;
|
|
||||||
} else {
|
|
||||||
DestSlot = fTypes.map[Ty] = fTypes.next_slot++;
|
|
||||||
}
|
|
||||||
SC_DEBUG(" Inserting type [" << DestSlot << "] = " << Ty << "\n");
|
|
||||||
return DestSlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: sw=2
|
|
||||||
|
Loading…
Reference in New Issue
Block a user