remove dead code, the outputConstants function is now only called at module scope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34085 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-02-09 07:53:20 +00:00
parent ba6de4b1cf
commit 8dcd81cc0e
2 changed files with 6 additions and 14 deletions

View File

@ -826,7 +826,7 @@ BytecodeWriter::BytecodeWriter(std::vector<unsigned char> &o, const Module *M)
outputModuleInfoBlock(M); outputModuleInfoBlock(M);
// Output module level constants, used for global variable initializers // Output module level constants, used for global variable initializers
outputConstants(false); outputConstants();
// Do the whole module now! Process each function at a time... // Do the whole module now! Process each function at a time...
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
@ -904,30 +904,22 @@ static inline bool hasNullValue(const Type *Ty) {
return Ty != Type::LabelTy && Ty != Type::VoidTy && !isa<OpaqueType>(Ty); return Ty != Type::LabelTy && Ty != Type::VoidTy && !isa<OpaqueType>(Ty);
} }
void BytecodeWriter::outputConstants(bool isFunction) { void BytecodeWriter::outputConstants() {
BytecodeBlock CPool(BytecodeFormat::ConstantPoolBlockID, *this, BytecodeBlock CPool(BytecodeFormat::ConstantPoolBlockID, *this,
true /* Elide block if empty */); true /* Elide block if empty */);
unsigned NumPlanes = Table.getNumPlanes(); unsigned NumPlanes = Table.getNumPlanes();
if (isFunction) // Output module-level string constants before any other constants.
// Output the type plane before any constants! outputConstantStrings();
outputTypes(Table.getModuleTypeLevel());
else
// Output module-level string constants before any other constants.
outputConstantStrings();
for (unsigned pno = 0; pno != NumPlanes; pno++) { for (unsigned pno = 0; pno != NumPlanes; pno++) {
const std::vector<const Value*> &Plane = Table.getPlane(pno); const std::vector<const Value*> &Plane = Table.getPlane(pno);
if (!Plane.empty()) { // Skip empty type planes... if (!Plane.empty()) { // Skip empty type planes...
unsigned ValNo = 0; unsigned ValNo = 0;
if (isFunction) // Don't re-emit module constants
ValNo += Table.getModuleLevel(pno);
if (hasNullValue(Plane[0]->getType())) { if (hasNullValue(Plane[0]->getType())) {
// Skip zero initializer // Skip zero initializer
if (ValNo == 0) ValNo = 1;
ValNo = 1;
} }
// Write out constants in the plane // Write out constants in the plane

View File

@ -35,7 +35,7 @@ public:
BytecodeWriter(std::vector<unsigned char> &o, const Module *M); BytecodeWriter(std::vector<unsigned char> &o, const Module *M);
private: private:
void outputConstants(bool isFunction); void outputConstants();
void outputConstantStrings(); void outputConstantStrings();
void outputFunction(const Function *F); void outputFunction(const Function *F);
void outputCompactionTable(); void outputCompactionTable();