aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/SlotCalculator.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2005-04-21 21:48:46 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2005-04-21 21:48:46 +0000
commit23c6d2cb795ba0e7f132648ced6531a8abaa0d96 (patch)
treed29e3ba7bb0ac67ead047013cdd52bd91d3ccb0d /lib/Bytecode/Writer/SlotCalculator.cpp
parent8a96c53d36f2b94492fc06568c0e75d5180345b6 (diff)
* Remove trailing whitespace
* Convert tabs to spaces git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/SlotCalculator.cpp')
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index d1af03eae4..d7645f9045 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -1,10 +1,10 @@
//===-- SlotCalculator.cpp - Calculate what slots values land in ----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements a useful analysis step to figure out what numbered slots
@@ -150,7 +150,7 @@ void SlotCalculator::processModule() {
TypePlane &Plane = Table[plane];
unsigned FirstNonStringID = 0;
for (unsigned i = 0, e = Plane.size(); i != e; ++i)
- if (isa<ConstantAggregateZero>(Plane[i]) ||
+ if (isa<ConstantAggregateZero>(Plane[i]) ||
(isa<ConstantArray>(Plane[i]) &&
cast<ConstantArray>(Plane[i])->isString())) {
// Check to see if we have to shuffle this string around. If not,
@@ -158,7 +158,7 @@ void SlotCalculator::processModule() {
if (i != FirstNonStringID) {
// Swap the plane entries....
std::swap(Plane[i], Plane[FirstNonStringID]);
-
+
// Keep the NodeMap up to date.
NodeMap[Plane[i]] = i;
NodeMap[Plane[FirstNonStringID]] = FirstNonStringID;
@@ -167,14 +167,14 @@ void SlotCalculator::processModule() {
}
}
}
-
- // Scan all of the functions for their constants, which allows us to emit
- // more compact modules. This is optional, and is just used to compactify
+
+ // Scan all of the functions for their constants, which allows us to emit
+ // more compact modules. This is optional, and is just used to compactify
// the constants used by different functions together.
//
- // This functionality tends to produce smaller bytecode files. This should
- // not be used in the future by clients that want to, for example, build and
- // emit functions on the fly. For now, however, it is unconditionally
+ // This functionality tends to produce smaller bytecode files. This should
+ // not be used in the future by clients that want to, for example, build and
+ // emit functions on the fly. For now, however, it is unconditionally
// enabled.
ModuleContainsAllFunctionConstants = true;
@@ -183,7 +183,7 @@ void SlotCalculator::processModule() {
F != E; ++F) {
for (const_inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I){
for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op)
- if (isa<Constant>(I->getOperand(op)) &&
+ if (isa<Constant>(I->getOperand(op)) &&
!isa<GlobalValue>(I->getOperand(op)))
getOrCreateSlot(I->getOperand(op));
getOrCreateSlot(I->getType());
@@ -244,7 +244,7 @@ void SlotCalculator::processSymbolTable(const SymbolTable *ST) {
getOrCreateSlot(TI->second);
// Now do the values.
- for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
+ for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
PE = ST->plane_end(); PI != PE; ++PI)
for (SymbolTable::value_const_iterator VI = PI->second.begin(),
VE = PI->second.end(); VI != VE; ++VI)
@@ -258,7 +258,7 @@ void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) {
getOrCreateSlot(TI->second);
// Now do the constant values in all planes
- for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
+ for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
PE = ST->plane_end(); PI != PE; ++PI)
for (SymbolTable::value_const_iterator VI = PI->second.begin(),
VE = PI->second.end(); VI != VE; ++VI)
@@ -294,7 +294,7 @@ void SlotCalculator::incorporateFunction(const Function *F) {
// before any nonconstant values. This will be turned into the constant
// pool for the bytecode writer.
//
-
+
// Emit all of the constants that are being used by the instructions in
// the function...
constant_iterator CI = constant_begin(F);
@@ -303,10 +303,10 @@ void SlotCalculator::incorporateFunction(const Function *F) {
this->getOrCreateSlot(*CI);
++CI;
}
-
+
// If there is a symbol table, it is possible that the user has names for
// constants that are not being used. In this case, we will have problems
- // if we don't emit the constants now, because otherwise we will get
+ // if we don't emit the constants now, because otherwise we will get
// symbol table references to constants not in the output. Scan for these
// constants now.
//
@@ -380,7 +380,7 @@ void SlotCalculator::purgeFunction() {
NodeMap.erase(Plane.back()); // Erase from nodemap
Plane.pop_back(); // Shrink plane
}
-
+
Table.pop_back(); // Nuke the plane, we don't like it.
}
}
@@ -482,7 +482,7 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
getOrCreateCompactionTableSlot(TI->second);
// Now do the constants and global values
- for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
+ for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
PE = ST.plane_end(); PI != PE; ++PI)
for (SymbolTable::value_const_iterator VI = PI->second.begin(),
VE = PI->second.end(); VI != VE; ++VI)
@@ -503,14 +503,14 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
assert(Ty->getTypeID() != Type::LabelTyID);
getOrCreateCompactionTableSlot(Constant::getNullValue(Ty));
}
-
+
// Okay, now at this point, we have a legal compaction table. Since we want
// to emit the smallest possible binaries, do not compactify the type plane if
// it will not save us anything. Because we have not yet incorporated the
// function body itself yet, we don't know whether or not it's a good idea to
// compactify other planes. We will defer this decision until later.
TypeList &GlobalTypes = Types;
-
+
// All of the values types will be scrunched to the start of the types plane
// of the global table. Figure out just how many there are.
assert(!GlobalTypes.empty() && "No global types???");
@@ -530,7 +530,7 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
std::swap(CompactionTable, TmpCompactionTable);
TypeList TmpTypes;
std::swap(TmpTypes, CompactionTypes);
-
+
// Move each plane back over to the uncompactified plane
while (!TmpTypes.empty()) {
const Type *Ty = TmpTypes.back();
@@ -540,7 +540,7 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
// Find the global slot number for this type.
int TySlot = getSlot(Ty);
assert(TySlot != -1 && "Type doesn't exist in global table?");
-
+
// Now we know where to put the compaction table plane.
if (CompactionTable.size() <= unsigned(TySlot))
CompactionTable.resize(TySlot+1);
@@ -575,7 +575,7 @@ void SlotCalculator::pruneCompactionTable() {
if (GlobalSlot >= Table.size())
Table.resize(GlobalSlot+1);
TypePlane &GPlane = Table[GlobalSlot];
-
+
unsigned ModLevel = getModuleLevel(ctp);
unsigned NumFunctionObjs = CPlane.size()-ModLevel;
@@ -624,7 +624,7 @@ void SlotCalculator::pruneCompactionTable() {
}
/// Determine if the compaction table is actually empty. Because the
-/// compaction table always includes the primitive type planes, we
+/// compaction table always includes the primitive type planes, we
/// can't just check getCompactionTable().size() because it will never
/// be zero. Furthermore, the ModuleLevel factors into whether a given
/// plane is empty or not. This function does the necessary computation
@@ -640,7 +640,7 @@ bool SlotCalculator::CompactionTableIsEmpty() const {
// If the module level is non-zero then at least the
// first element of the plane is valid and therefore not empty.
unsigned End = getModuleLevel(i);
- if (End != 0)
+ if (End != 0)
return false;
}
}
@@ -699,8 +699,8 @@ int SlotCalculator::getOrCreateSlot(const Value *V) {
assert(CompactionNodeMap.empty() &&
"All needed constants should be in the compaction map already!");
- // Do not index the characters that make up constant strings. We emit
- // constant strings as special entities that don't require their
+ // Do not index the characters that make up constant strings. We emit
+ // constant strings as special entities that don't require their
// individual characters to be emitted.
if (!isa<ConstantArray>(C) || !cast<ConstantArray>(C)->isString()) {
// This makes sure that if a constant has uses (for example an array of
@@ -746,7 +746,7 @@ int SlotCalculator::insertValue(const Value *D, bool dontIgnore) {
return getOrCreateCompactionTableSlot(D);
}
- // If this node does not contribute to a plane, or if the node has a
+ // If this node does not contribute to a plane, or if the node has a
// name and we don't want names, then ignore the silly node... Note that types
// do need slot numbers so that we can keep track of where other values land.
//
@@ -823,7 +823,7 @@ int SlotCalculator::doInsertValue(const Value *D) {
} else {
Ty = Typ->getTypeID();
}
-
+
if (Table.size() <= Ty) // Make sure we have the type plane allocated...
Table.resize(Ty+1, TypePlane());
@@ -843,10 +843,10 @@ int SlotCalculator::doInsertValue(const Value *D) {
unsigned DestSlot = NodeMap[D] = Table[Ty].size();
Table[Ty].push_back(D);
- SC_DEBUG(" Inserting value [" << Ty << "] = " << D << " slot=" <<
+ SC_DEBUG(" Inserting value [" << Ty << "] = " << D << " slot=" <<
DestSlot << " [");
// G = Global, C = Constant, T = Type, F = Function, o = other
- SC_DEBUG((isa<GlobalVariable>(D) ? "G" : (isa<Constant>(D) ? "C" :
+ SC_DEBUG((isa<GlobalVariable>(D) ? "G" : (isa<Constant>(D) ? "C" :
(isa<Function>(D) ? "F" : "o"))));
SC_DEBUG("]\n");
return (int)DestSlot;