clean up some sloppy and inconsistent spacing

llvm-svn: 32255
This commit is contained in:
Chris Lattner 2006-12-06 05:12:21 +00:00
parent 54932b015e
commit 23e829acf1
1 changed files with 46 additions and 46 deletions

View File

@ -73,10 +73,10 @@ public:
/// @{
public:
/// @brief Construct from a module
SlotMachine(const Module *M );
SlotMachine(const Module *M);
/// @brief Construct from a function, starting out in incorp state.
SlotMachine(const Function *F );
SlotMachine(const Function *F);
/// @}
/// @name Accessors
@ -119,13 +119,13 @@ private:
/// been inserted already, they get inserted, otherwise they are ignored.
/// Either way, the slot number for the Value* is returned.
unsigned createSlot(const Value *V);
unsigned createSlot(const Type* Ty);
unsigned createSlot(const Type *Ty);
/// Insert a value into the value table. Return the slot number
/// that it now occupies. BadThings(TM) will happen if you insert a
/// Value that's already been inserted.
unsigned insertValue( const Value *V );
unsigned insertValue( const Type* Ty);
unsigned insertValue(const Value *V);
unsigned insertValue(const Type *Ty);
/// Add all of the module level global variables (and their initializers)
/// and function declarations, but not the contents of those functions.
@ -242,7 +242,7 @@ static void fillTypeNameTable(const Module *M,
if (!M) return;
const SymbolTable &ST = M->getSymbolTable();
SymbolTable::type_const_iterator TI = ST.type_begin();
for (; TI != ST.type_end(); ++TI ) {
for (; TI != ST.type_end(); ++TI) {
// As a heuristic, don't insert pointer to primitive types, because
// they are used too often to have a single useful name.
//
@ -933,7 +933,7 @@ void AssemblyWriter::printSymbolTable(const SymbolTable &ST) {
// Print the types.
for (SymbolTable::type_const_iterator TI = ST.type_begin();
TI != ST.type_end(); ++TI ) {
TI != ST.type_end(); ++TI) {
Out << "\t" << getLLVMName(TI->first) << " = type ";
// Make sure we print out at least one level of the type structure, so
@ -944,7 +944,7 @@ void AssemblyWriter::printSymbolTable(const SymbolTable &ST) {
// Print the constants, in type plane order.
for (SymbolTable::plane_const_iterator PI = ST.plane_begin();
PI != ST.plane_end(); ++PI ) {
PI != ST.plane_end(); ++PI) {
SymbolTable::value_const_iterator VI = ST.value_begin(PI->first);
SymbolTable::value_const_iterator VE = ST.value_end(PI->first);
@ -1417,7 +1417,7 @@ void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; }
void CachedWriter::setModule(const Module *M) {
delete SC; delete AW;
if (M) {
SC = new SlotMachine(M );
SC = new SlotMachine(M);
AW = new AssemblyWriter(Out, *SC, M, 0);
} else {
SC = 0; AW = 0;
@ -1479,8 +1479,8 @@ SlotMachine::SlotMachine(const Module *M)
// Function level constructor. Causes the contents of the Module and the one
// function provided to be added to the slot table.
SlotMachine::SlotMachine(const Function *F )
: TheModule( F ? F->getParent() : 0 ) ///< Saved for lazy initialization
SlotMachine::SlotMachine(const Function *F)
: TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization
, TheFunction(F) ///< Saved for lazy initialization
, FunctionProcessed(false)
, mMap()
@ -1491,11 +1491,11 @@ SlotMachine::SlotMachine(const Function *F )
}
inline void SlotMachine::initialize(void) {
if ( TheModule) {
if (TheModule) {
processModule();
TheModule = 0; ///< Prevent re-processing next time we're called.
}
if ( TheFunction && ! FunctionProcessed) {
if (TheFunction && ! FunctionProcessed) {
processFunction();
}
}
@ -1561,7 +1561,7 @@ void SlotMachine::purgeFunction() {
/// ask for a Value that hasn't previously been inserted with createSlot.
/// Types are forbidden because Type does not inherit from Value (any more).
int SlotMachine::getSlot(const Value *V) {
assert( V && "Can't get slot for null Value" );
assert(V && "Can't get slot for null Value");
assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
"Can't insert a non-GlobalValue Constant into SlotMachine");
@ -1574,21 +1574,21 @@ int SlotMachine::getSlot(const Value *V) {
// Find the type plane in the module map
TypedPlanes::const_iterator MI = mMap.find(VTy);
if ( TheFunction ) {
if (TheFunction) {
// Lookup the type in the function map too
TypedPlanes::const_iterator FI = fMap.find(VTy);
// If there is a corresponding type plane in the function map
if ( FI != fMap.end() ) {
if (FI != fMap.end()) {
// Lookup the Value in the function map
ValueMap::const_iterator FVI = FI->second.map.find(V);
// If the value doesn't exist in the function map
if ( FVI == FI->second.map.end() ) {
if (FVI == FI->second.map.end()) {
// Look up the value in the module map.
if (MI == mMap.end()) return -1;
ValueMap::const_iterator MVI = MI->second.map.find(V);
// If we didn't find it, it wasn't inserted
if (MVI == MI->second.map.end()) return -1;
assert( MVI != MI->second.map.end() && "Value not found");
assert(MVI != MI->second.map.end() && "Value not found");
// We found it only at the module level
return MVI->second;
@ -1622,16 +1622,16 @@ int SlotMachine::getSlot(const Value *V) {
/// ask for a Value that hasn't previously been inserted with createSlot.
/// Types are forbidden because Type does not inherit from Value (any more).
int SlotMachine::getSlot(const Type *Ty) {
assert( Ty && "Can't get slot for null Type" );
assert(Ty && "Can't get slot for null Type");
// Check for uninitialized state and do lazy initialization
this->initialize();
if ( TheFunction ) {
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() ) {
if (FTI == fTypes.map.end()) {
TypeMap::const_iterator MTI = mTypes.map.find(Ty);
// If we didn't find it, it wasn't inserted
if (MTI == mTypes.map.end())
@ -1662,7 +1662,7 @@ int SlotMachine::getSlot(const Type *Ty) {
// inserted. Note that the logic here parallels getSlot but instead
// of asserting when the Value* isn't found, it inserts the value.
unsigned SlotMachine::createSlot(const Value *V) {
assert( V && "Can't insert a null Value to SlotMachine");
assert(V && "Can't insert a null Value to SlotMachine");
assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
"Can't insert a non-GlobalValue Constant into SlotMachine");
@ -1674,22 +1674,22 @@ unsigned SlotMachine::createSlot(const Value *V) {
// Look up the type plane for the Value's type from the module map
TypedPlanes::const_iterator MI = mMap.find(VTy);
if ( TheFunction ) {
if (TheFunction) {
// Get the type plane for the Value's type from the function map
TypedPlanes::const_iterator FI = fMap.find(VTy);
// If there is a corresponding type plane in the function map
if ( FI != fMap.end() ) {
if (FI != fMap.end()) {
// Lookup the Value in the function map
ValueMap::const_iterator FVI = FI->second.map.find(V);
// If the value doesn't exist in the function map
if ( FVI == FI->second.map.end() ) {
if (FVI == FI->second.map.end()) {
// If there is no corresponding type plane in the module map
if ( MI == mMap.end() )
if (MI == mMap.end())
return insertValue(V);
// Look up the value in the module map
ValueMap::const_iterator MVI = MI->second.map.find(V);
// If we didn't find it, it wasn't inserted
if ( MVI == MI->second.map.end() )
if (MVI == MI->second.map.end())
return insertValue(V);
else
// We found it only at the module level
@ -1697,7 +1697,7 @@ unsigned SlotMachine::createSlot(const Value *V) {
// else the value exists in the function map
} else {
if ( MI == mMap.end() )
if (MI == mMap.end())
return FVI->second;
else
// Return the slot number as the module's contribution to
@ -1709,14 +1709,14 @@ unsigned SlotMachine::createSlot(const Value *V) {
// else there is not a corresponding type plane in the function map
} else {
// If the type plane doesn't exists at the module level
if ( MI == mMap.end() ) {
if (MI == mMap.end()) {
return insertValue(V);
// else type plane exists at the module level, examine it
} else {
// Look up the value in the module's map
ValueMap::const_iterator MVI = MI->second.map.find(V);
// If we didn't find it there either
if ( MVI == MI->second.map.end() )
if (MVI == MI->second.map.end())
// Return the slot number as the module's contribution to
// the type plane plus the index of the function map insertion.
return MI->second.next_slot + insertValue(V);
@ -1729,10 +1729,10 @@ unsigned SlotMachine::createSlot(const Value *V) {
// N.B. Can only get here if !TheFunction
// If the module map's type plane is not for the Value's type
if ( MI != mMap.end() ) {
if (MI != mMap.end()) {
// Lookup the value in the module's map
ValueMap::const_iterator MVI = MI->second.map.find(V);
if ( MVI != MI->second.map.end() )
if (MVI != MI->second.map.end())
return MVI->second;
}
@ -1743,17 +1743,17 @@ unsigned SlotMachine::createSlot(const Value *V) {
// inserted. Note that the logic here parallels getSlot but instead
// of asserting when the Value* isn't found, it inserts the value.
unsigned SlotMachine::createSlot(const Type *Ty) {
assert( Ty && "Can't insert a null Type to SlotMachine");
assert(Ty && "Can't insert a null Type to SlotMachine");
if ( TheFunction ) {
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() ) {
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() )
if (MTI == mTypes.map.end())
return insertValue(Ty);
else
// We found it only at the module level
@ -1772,7 +1772,7 @@ unsigned SlotMachine::createSlot(const Type *Ty) {
// Lookup the type in the module's map
TypeMap::const_iterator MTI = mTypes.map.find(Ty);
if ( MTI != mTypes.map.end() )
if (MTI != mTypes.map.end())
return MTI->second;
return insertValue(Ty);
@ -1780,14 +1780,14 @@ unsigned SlotMachine::createSlot(const Type *Ty) {
// Low level insert function. Minimal checking is done. This
// function is just for the convenience of createSlot (above).
unsigned SlotMachine::insertValue(const Value *V ) {
unsigned SlotMachine::insertValue(const Value *V) {
assert(V && "Can't insert a null Value into SlotMachine!");
assert(!isa<Constant>(V) || isa<GlobalValue>(V) &&
"Can't insert a non-GlobalValue Constant into SlotMachine");
// 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() ) {
if (V->getType() == Type::VoidTy || V->hasName()) {
SC_DEBUG("ignored value " << *V << "\n");
return 0; // FIXME: Wrong return value
}
@ -1795,14 +1795,14 @@ unsigned SlotMachine::insertValue(const Value *V ) {
const Type *VTy = V->getType();
unsigned DestSlot = 0;
if ( TheFunction ) {
TypedPlanes::iterator I = fMap.find( VTy );
if ( I == fMap.end() )
if (TheFunction) {
TypedPlanes::iterator I = fMap.find(VTy);
if (I == fMap.end())
I = fMap.insert(std::make_pair(VTy,ValuePlane())).first;
DestSlot = I->second.map[V] = I->second.next_slot++;
} else {
TypedPlanes::iterator I = mMap.find( VTy );
if ( I == mMap.end() )
TypedPlanes::iterator I = mMap.find(VTy);
if (I == mMap.end())
I = mMap.insert(std::make_pair(VTy,ValuePlane())).first;
DestSlot = I->second.map[V] = I->second.next_slot++;
}
@ -1818,12 +1818,12 @@ unsigned SlotMachine::insertValue(const Value *V ) {
// Low level insert function. Minimal checking is done. This
// function is just for the convenience of createSlot (above).
unsigned SlotMachine::insertValue(const Type *Ty ) {
unsigned SlotMachine::insertValue(const Type *Ty) {
assert(Ty && "Can't insert a null Type into SlotMachine!");
unsigned DestSlot = 0;
if ( TheFunction ) {
if (TheFunction) {
DestSlot = fTypes.map[Ty] = fTypes.next_slot++;
} else {
DestSlot = fTypes.map[Ty] = fTypes.next_slot++;