[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp InstructionWriter.cpp ConstantWriter.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Oct 16 21:03:41 PDT 2003


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.40 -> 1.41
InstructionWriter.cpp updated: 1.31 -> 1.32
ConstantWriter.cpp updated: 1.23 -> 1.24

---
Log message:

Eliminate some extraneous code in SlotCalculator::insertVal().

Rename SlotCalculator::getValSlot() to SlotCalculator::getSlot(),
       SlotCalculator::insertValue() to SlotCalculator::getOrCreateSlot(),
       SlotCalculator::insertVal() to SlotCalculator::insertValue(), and
       SlotCalculator::doInsertVal() to SlotCalculator::doInsertValue().


---
Diffs of the changes:  (+26 -26)

Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.40 llvm/lib/Bytecode/Writer/Writer.cpp:1.41
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.40	Thu Oct 16 13:28:50 2003
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Thu Oct 16 21:02:39 2003
@@ -105,7 +105,7 @@
   output_vbr(NC, Out);
 
   // Output the Type ID Number...
-  int Slot = Table.getValSlot(Plane.front()->getType());
+  int Slot = Table.getSlot(Plane.front()->getType());
   assert (Slot != -1 && "Type in constant pool but not in function!!");
   output_vbr((unsigned)Slot, Out);
 
@@ -174,7 +174,7 @@
   
   // Output the types for the global variables in the module...
   for (Module::const_giterator I = M->gbegin(), End = M->gend(); I != End;++I) {
-    int Slot = Table.getValSlot(I->getType());
+    int Slot = Table.getSlot(I->getType());
     assert(Slot != -1 && "Module global vars is broken!");
 
     // Fields: bit0 = isConstant, bit1 = hasInitializer, bit2,3=Linkage,
@@ -185,21 +185,21 @@
 
     // If we have an initializer, output it now.
     if (I->hasInitializer()) {
-      Slot = Table.getValSlot((Value*)I->getInitializer());
+      Slot = Table.getSlot((Value*)I->getInitializer());
       assert(Slot != -1 && "No slot for global var initializer!");
       output_vbr((unsigned)Slot, Out);
     }
   }
-  output_vbr((unsigned)Table.getValSlot(Type::VoidTy), Out);
+  output_vbr((unsigned)Table.getSlot(Type::VoidTy), Out);
 
   // Output the types of the functions in this module...
   for (Module::const_iterator I = M->begin(), End = M->end(); I != End; ++I) {
-    int Slot = Table.getValSlot(I->getType());
+    int Slot = Table.getSlot(I->getType());
     assert(Slot != -1 && "Module const pool is broken!");
     assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
     output_vbr((unsigned)Slot, Out);
   }
-  output_vbr((unsigned)Table.getValSlot(Type::VoidTy), Out);
+  output_vbr((unsigned)Table.getSlot(Type::VoidTy), Out);
 
   align32(Out);
 }
@@ -248,13 +248,13 @@
     // Symtab block header: [num entries][type id number]
     output_vbr(MST.type_size(TI->first), Out);
 
-    Slot = Table.getValSlot(TI->first);
+    Slot = Table.getSlot(TI->first);
     assert(Slot != -1 && "Type in symtab, but not in table!");
     output_vbr((unsigned)Slot, Out);
 
     for (; I != End; ++I) {
       // Symtab entry: [def slot #][name]
-      Slot = Table.getValSlot(I->second);
+      Slot = Table.getSlot(I->second);
       assert(Slot != -1 && "Value in symtab but has no slot number!!");
       output_vbr((unsigned)Slot, Out);
       output(I->first, Out, false); // Don't force alignment...


Index: llvm/lib/Bytecode/Writer/InstructionWriter.cpp
diff -u llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.31 llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.32
--- llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.31	Sun Oct 12 22:32:07 2003
+++ llvm/lib/Bytecode/Writer/InstructionWriter.cpp	Thu Oct 16 21:02:40 2003
@@ -33,13 +33,13 @@
   output_vbr(NumArgs + (isa<CastInst>(I) || isa<VarArgInst>(I)), Out);
 
   for (unsigned i = 0; i < NumArgs; ++i) {
-    int Slot = Table.getValSlot(I->getOperand(i));
+    int Slot = Table.getSlot(I->getOperand(i));
     assert(Slot >= 0 && "No slot number for value!?!?");      
     output_vbr((unsigned)Slot, Out);
   }
 
   if (isa<CastInst>(I) || isa<VarArgInst>(I)) {
-    int Slot = Table.getValSlot(I->getType());
+    int Slot = Table.getSlot(I->getType());
     assert(Slot != -1 && "Cast/VarArg return type unknown?");
     output_vbr((unsigned)Slot, Out);
   }
@@ -72,7 +72,7 @@
 
   // The type for the function has already been emitted in the type field of the
   // instruction.  Just emit the slot # now.
-  int Slot = Table.getValSlot(I->getOperand(0));
+  int Slot = Table.getSlot(I->getOperand(0));
   assert(Slot >= 0 && "No slot number for value!?!?");      
   output_vbr((unsigned)Slot, Out);
 
@@ -84,12 +84,12 @@
 
   for (unsigned i = 1; i < NumArgs; ++i) {
     // Output Arg Type ID
-    Slot = Table.getValSlot(I->getOperand(i)->getType());
+    Slot = Table.getSlot(I->getOperand(i)->getType());
     assert(Slot >= 0 && "No slot number for value!?!?");      
     output_vbr((unsigned)Slot, Out);
 
     // Output arg ID itself
-    Slot = Table.getValSlot(I->getOperand(i));
+    Slot = Table.getSlot(I->getOperand(i));
     assert(Slot >= 0 && "No slot number for value!?!?");      
     output_vbr((unsigned)Slot, Out);
   }
@@ -176,7 +176,7 @@
 
   for (unsigned i = 0; i < NumOperands; ++i) {
     const Value *Def = I.getOperand(i);
-    int slot = Table.getValSlot(Def);
+    int slot = Table.getSlot(Def);
     assert(slot != -1 && "Broken bytecode!");
     if (slot > MaxOpSlot) MaxOpSlot = slot;
     if (i < 3) Slots[i] = slot;
@@ -204,7 +204,7 @@
   }
 
   unsigned Type;
-  int Slot = Table.getValSlot(Ty);
+  int Slot = Table.getSlot(Ty);
   assert(Slot != -1 && "Type not available!!?!");
   Type = (unsigned)Slot;
 
@@ -217,7 +217,7 @@
   if (isa<CastInst>(I) || isa<VarArgInst>(I)) {
     // Cast has to encode the destination type as the second argument in the
     // packet, or else we won't know what type to cast to!
-    Slots[1] = Table.getValSlot(I.getType());
+    Slots[1] = Table.getSlot(I.getType());
     assert(Slots[1] != -1 && "Cast return type unknown?");
     if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1];
     NumOperands++;


Index: llvm/lib/Bytecode/Writer/ConstantWriter.cpp
diff -u llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.23 llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.24
--- llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.23	Sun Oct 12 22:32:07 2003
+++ llvm/lib/Bytecode/Writer/ConstantWriter.cpp	Thu Oct 16 21:02:40 2003
@@ -20,7 +20,7 @@
   switch (T->getPrimitiveID()) {   // Handle derived types now.
   case Type::FunctionTyID: {
     const FunctionType *MT = cast<FunctionType>(T);
-    int Slot = Table.getValSlot(MT->getReturnType());
+    int Slot = Table.getSlot(MT->getReturnType());
     assert(Slot != -1 && "Type used but not available!!");
     output_vbr((unsigned)Slot, Out);
 
@@ -30,7 +30,7 @@
     // Output all of the arguments...
     FunctionType::ParamTypes::const_iterator I = MT->getParamTypes().begin();
     for (; I != MT->getParamTypes().end(); ++I) {
-      Slot = Table.getValSlot(*I);
+      Slot = Table.getSlot(*I);
       assert(Slot != -1 && "Type used but not available!!");
       output_vbr((unsigned)Slot, Out);
     }
@@ -43,7 +43,7 @@
 
   case Type::ArrayTyID: {
     const ArrayType *AT = cast<ArrayType>(T);
-    int Slot = Table.getValSlot(AT->getElementType());
+    int Slot = Table.getSlot(AT->getElementType());
     assert(Slot != -1 && "Type used but not available!!");
     output_vbr((unsigned)Slot, Out);
     //std::cerr << "Type slot = " << Slot << " Type = " << T->getName() << endl;
@@ -58,7 +58,7 @@
     // Output all of the element types...
     StructType::ElementTypes::const_iterator I = ST->getElementTypes().begin();
     for (; I != ST->getElementTypes().end(); ++I) {
-      int Slot = Table.getValSlot(*I);
+      int Slot = Table.getSlot(*I);
       assert(Slot != -1 && "Type used but not available!!");
       output_vbr((unsigned)Slot, Out);
     }
@@ -70,7 +70,7 @@
 
   case Type::PointerTyID: {
     const PointerType *PT = cast<PointerType>(T);
-    int Slot = Table.getValSlot(PT->getElementType());
+    int Slot = Table.getSlot(PT->getElementType());
     assert(Slot != -1 && "Type used but not available!!");
     output_vbr((unsigned)Slot, Out);
     break;
@@ -103,10 +103,10 @@
     output_vbr(CE->getOpcode(), Out);        // flags as an expr
     
     for (User::const_op_iterator OI = CE->op_begin(); OI != CE->op_end(); ++OI){
-      int Slot = Table.getValSlot(*OI);
+      int Slot = Table.getSlot(*OI);
       assert(Slot != -1 && "Unknown constant used in ConstantExpr!!");
       output_vbr((unsigned)Slot, Out);
-      Slot = Table.getValSlot((*OI)->getType());
+      Slot = Table.getSlot((*OI)->getType());
       output_vbr((unsigned)Slot, Out);
     }
     return false;
@@ -146,7 +146,7 @@
     assert(size == cast<ArrayType>(CPA->getType())->getNumElements()
            && "ConstantArray out of whack!");
     for (unsigned i = 0; i < size; i++) {
-      int Slot = Table.getValSlot(CPA->getOperand(i));
+      int Slot = Table.getSlot(CPA->getOperand(i));
       assert(Slot != -1 && "Constant used but not available!!");
       output_vbr((unsigned)Slot, Out);
     }
@@ -158,7 +158,7 @@
     const std::vector<Use> &Vals = CPS->getValues();
 
     for (unsigned i = 0; i < Vals.size(); ++i) {
-      int Slot = Table.getValSlot(Vals[i]);
+      int Slot = Table.getSlot(Vals[i]);
       assert(Slot != -1 && "Constant used but not available!!");
       output_vbr((unsigned)Slot, Out);
     }      
@@ -169,7 +169,7 @@
     const ConstantPointer *CPP = cast<ConstantPointer>(CPV);
     assert(!isa<ConstantPointerNull>(CPP) && "Null should be already emitted!");
     const ConstantPointerRef *CPR = cast<ConstantPointerRef>(CPP);
-    int Slot = Table.getValSlot((Value*)CPR->getValue());
+    int Slot = Table.getSlot((Value*)CPR->getValue());
     assert(Slot != -1 && "Global used but not available!!");
     output_vbr((unsigned)Slot, Out);
     break;





More information about the llvm-commits mailing list