[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp LevelRaise.cpp TransformInternals.cpp TransformInternals.h

Misha Brukman brukman at cs.uiuc.edu
Thu Apr 21 16:46:06 PDT 2005



Changes in directory llvm/lib/Transforms:

ExprTypeConvert.cpp updated: 1.103 -> 1.104
LevelRaise.cpp updated: 1.105 -> 1.106
TransformInternals.cpp updated: 1.47 -> 1.48
TransformInternals.h updated: 1.25 -> 1.26
---
Log message:

Remove trailing whitespace


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

 ExprTypeConvert.cpp    |   62 ++++++++++++++++++++++++-------------------------
 LevelRaise.cpp         |   40 +++++++++++++++----------------
 TransformInternals.cpp |    8 +++---
 TransformInternals.h   |    6 ++--
 4 files changed, 58 insertions(+), 58 deletions(-)


Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.103 llvm/lib/Transforms/ExprTypeConvert.cpp:1.104
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.103	Tue Feb  1 22:43:37 2005
+++ llvm/lib/Transforms/ExprTypeConvert.cpp	Thu Apr 21 18:45:55 2005
@@ -1,10 +1,10 @@
 //===- ExprTypeConvert.cpp - Code to change an LLVM Expr Type -------------===//
-// 
+//
 //                     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 the part of level raising that checks to see if it is
@@ -69,7 +69,7 @@
   // here...
   uint64_t Offset = OffsetVal * OldTypeSize;
   uint64_t Scale  = ScaleVal  * OldTypeSize;
-  
+
   // In order to be successful, both the scale and the offset must be a multiple
   // of the requested data type's size.
   //
@@ -145,7 +145,7 @@
   // Expression type must be holdable in a register.
   if (!Ty->isFirstClassType())
     return false;
-  
+
   ValueTypeCache::iterator CTMI = CTMap.find(V);
   if (CTMI != CTMap.end()) return CTMI->second == Ty;
 
@@ -154,7 +154,7 @@
   //
   if (isa<Constant>(V) && !isa<GlobalValue>(V))
     return true;
-  
+
   CTMap[V] = Ty;
   if (V->getType() == Ty) return true;  // Expression already correct type!
 
@@ -170,7 +170,7 @@
     // We also do not allow conversion of a cast that casts from a ptr to array
     // of X to a *X.  For example: cast [4 x %List *] * %val to %List * *
     //
-    if (const PointerType *SPT = 
+    if (const PointerType *SPT =
         dyn_cast<PointerType>(I->getOperand(0)->getType()))
       if (const PointerType *DPT = dyn_cast<PointerType>(I->getType()))
         if (const ArrayType *AT = dyn_cast<ArrayType>(SPT->getElementType()))
@@ -200,7 +200,7 @@
     if (!ExpressionConvertibleToType(LI->getPointerOperand(),
                                      PointerType::get(Ty), CTMap, TD))
       return false;
-    break;                                     
+    break;
   }
   case Instruction::PHI: {
     PHINode *PN = cast<PHINode>(I);
@@ -227,7 +227,7 @@
     //   %t2 = cast %List * * %t1 to %List *
     // into
     //   %t2 = getelementptr %Hosp * %hosp, ubyte 4           ; <%List *>
-    // 
+    //
     GetElementPtrInst *GEP = cast<GetElementPtrInst>(I);
     const PointerType *PTy = dyn_cast<PointerType>(Ty);
     if (!PTy) return false;  // GEP must always return a pointer...
@@ -283,9 +283,9 @@
     // and want to convert it into something like this:
     //     getelemenptr [[int] *] * %reg115, long %reg138      ; [int]**
     //
-    if (GEP->getNumOperands() == 2 && 
+    if (GEP->getNumOperands() == 2 &&
         PTy->getElementType()->isSized() &&
-        TD.getTypeSize(PTy->getElementType()) == 
+        TD.getTypeSize(PTy->getElementType()) ==
         TD.getTypeSize(GEP->getType()->getElementType())) {
       const PointerType *NewSrcTy = PointerType::get(PVTy);
       if (!ExpressionConvertibleToType(I->getOperand(0), NewSrcTy, CTMap, TD))
@@ -329,7 +329,7 @@
 }
 
 
-Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty, 
+Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
                                      ValueMapCache &VMC, const TargetData &TD) {
   if (V->getType() == Ty) return V;  // Already where we need to be?
 
@@ -364,7 +364,7 @@
   Instruction *Res;     // Result of conversion
 
   ValueHandle IHandle(VMC, I);  // Prevent I from being removed!
-  
+
   Constant *Dummy = Constant::getNullValue(Ty);
 
   switch (I->getOpcode()) {
@@ -373,7 +373,7 @@
     Res = new CastInst(I->getOperand(0), Ty, Name);
     VMC.NewCasts.insert(ValueHandle(VMC, Res));
     break;
-    
+
   case Instruction::Add:
   case Instruction::Sub:
     Res = BinaryOperator::create(cast<BinaryOperator>(I)->getOpcode(),
@@ -436,7 +436,7 @@
     //   %t2 = cast %List * * %t1 to %List *
     // into
     //   %t2 = getelementptr %Hosp * %hosp, ubyte 4           ; <%List *>
-    // 
+    //
     GetElementPtrInst *GEP = cast<GetElementPtrInst>(I);
 
     // Check to see if there are zero elements that we can remove from the
@@ -461,7 +461,7 @@
 
     if (Res == 0 && GEP->getNumOperands() == 2 &&
         GEP->getType() == PointerType::get(Type::SByteTy)) {
-      
+
       // Otherwise, we can convert a GEP from one form to the other iff the
       // current gep is of the form 'getelementptr sbyte*, unsigned N
       // and we could convert this to an appropriate GEP for the new type.
@@ -475,7 +475,7 @@
       std::vector<Value*> Indices;
       const Type *ElTy = ConvertibleToGEP(NewSrcTy, I->getOperand(1),
                                           Indices, TD, &It);
-      if (ElTy) {        
+      if (ElTy) {
         assert(ElTy == PVTy && "Internal error, setup wrong!");
         Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
                                     Indices, Name);
@@ -625,7 +625,7 @@
     // We also do not allow conversion of a cast that casts from a ptr to array
     // of X to a *X.  For example: cast [4 x %List *] * %val to %List * *
     //
-    if (const PointerType *SPT = 
+    if (const PointerType *SPT =
         dyn_cast<PointerType>(I->getOperand(0)->getType()))
       if (const PointerType *DPT = dyn_cast<PointerType>(I->getType()))
         if (const ArrayType *AT = dyn_cast<ArrayType>(SPT->getElementType()))
@@ -645,7 +645,7 @@
           CTMap[I] = RetTy;
           return true;
         }
-        // We have to return failure here because ValueConvertibleToType could 
+        // We have to return failure here because ValueConvertibleToType could
         // have polluted our map
         return false;
       }
@@ -681,7 +681,7 @@
 
     if (const PointerType *PT = dyn_cast<PointerType>(Ty)) {
       LoadInst *LI = cast<LoadInst>(I);
-      
+
       const Type *LoadedTy = PT->getElementType();
 
       // They could be loading the first element of a composite type...
@@ -733,7 +733,7 @@
           assert(Offset == 0 && "Offset changed!");
           if (ElTy == 0)    // Element at offset zero in struct doesn't exist!
             return false;   // Can only happen for {}*
-          
+
           if (ElTy == Ty)   // Looks like the 0th element of structure is
             return true;    // compatible!  Accept now!
 
@@ -763,7 +763,7 @@
       }
 
       // Must move the same amount of data...
-      if (!ElTy->isSized() || 
+      if (!ElTy->isSized() ||
           TD.getTypeSize(ElTy) != TD.getTypeSize(I->getOperand(0)->getType()))
         return false;
 
@@ -801,7 +801,7 @@
           CST = ConstantSInt::get(Index->getType(), DataSize);
         else
           CST = ConstantUInt::get(Index->getType(), DataSize);
-                                  
+
         TempScale = BinaryOperator::create(Instruction::Mul, Index, CST);
         Index = TempScale;
       }
@@ -854,7 +854,7 @@
       // the call provides...
       //
       if (NumArgs < FTy->getNumParams()) return false;
-      
+
       // Unless this is a vararg function type, we cannot provide more arguments
       // than are desired...
       //
@@ -878,7 +878,7 @@
       //
       return ValueConvertibleToType(I, FTy->getReturnType(), CTMap, TD);
     }
-    
+
     const PointerType *MPtr = cast<PointerType>(I->getOperand(0)->getType());
     const FunctionType *FTy = cast<FunctionType>(MPtr->getElementType());
     if (!FTy->isVarArg()) return false;
@@ -941,7 +941,7 @@
   ValueHandle IHandle(VMC, I);
 
   const Type *NewTy = NewVal->getType();
-  Constant *Dummy = (NewTy != Type::VoidTy) ? 
+  Constant *Dummy = (NewTy != Type::VoidTy) ?
                   Constant::getNullValue(NewTy) : 0;
 
   switch (I->getOpcode()) {
@@ -1025,7 +1025,7 @@
         Src = new GetElementPtrInst(Src, Indices, Name+".idx", I);
       }
     }
-    
+
     Res = new LoadInst(Src, Name);
     assert(Res->getType()->isFirstClassType() && "Load of structure or array!");
     break;
@@ -1042,13 +1042,13 @@
         //
         const Type *ElTy =
           cast<PointerType>(VMCI->second->getType())->getElementType();
-        
+
         Value *SrcPtr = VMCI->second;
 
         if (ElTy != NewTy) {
           // We check that this is a struct in the initial scan...
           const StructType *SElTy = cast<StructType>(ElTy);
-          
+
           std::vector<Value*> Indices;
           Indices.push_back(Constant::getNullValue(Type::UIntTy));
 
@@ -1135,7 +1135,7 @@
       // anything that is a pointer type...
       //
       BasicBlock::iterator It = I;
-    
+
       // Check to see if the second argument is an expression that can
       // be converted to the appropriate size... if so, allow it.
       //
@@ -1143,7 +1143,7 @@
       const Type *ElTy = ConvertibleToGEP(NewVal->getType(), I->getOperand(1),
                                           Indices, TD, &It);
       assert(ElTy != 0 && "GEP Conversion Failure!");
-      
+
       Res = new GetElementPtrInst(NewVal, Indices, Name);
     } else {
       // Convert a getelementptr ulong * %reg123, uint %N
@@ -1271,7 +1271,7 @@
 
   //DEBUG(std::cerr << "VH DELETING: " << (void*)I << " " << I);
 
-  for (User::op_iterator OI = I->op_begin(), OE = I->op_end(); 
+  for (User::op_iterator OI = I->op_begin(), OE = I->op_end();
        OI != OE; ++OI)
     if (Instruction *U = dyn_cast<Instruction>(OI)) {
       *OI = 0;


Index: llvm/lib/Transforms/LevelRaise.cpp
diff -u llvm/lib/Transforms/LevelRaise.cpp:1.105 llvm/lib/Transforms/LevelRaise.cpp:1.106
--- llvm/lib/Transforms/LevelRaise.cpp:1.105	Sat Mar  5 13:05:18 2005
+++ llvm/lib/Transforms/LevelRaise.cpp	Thu Apr 21 18:45:55 2005
@@ -1,10 +1,10 @@
 //===- LevelRaise.cpp - Code to change LLVM to higher level ---------------===//
-// 
+//
 //                     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 the 'raising' part of the LevelChange API.  This is
@@ -37,7 +37,7 @@
 static Statistic<>
 NumLoadStorePeepholes("raise", "Number of load/store peepholes");
 
-static Statistic<> 
+static Statistic<>
 NumGEPInstFormed("raise", "Number of other getelementptr's formed");
 
 static Statistic<>
@@ -138,14 +138,14 @@
 
   PRINT_PEEPHOLE2("cast-add-to-gep:in", *Src, CI);
 
-  // If we have a getelementptr capability... transform all of the 
+  // If we have a getelementptr capability... transform all of the
   // add instruction uses into getelementptr's.
   while (!CI.use_empty()) {
     BinaryOperator *I = cast<BinaryOperator>(*CI.use_begin());
     assert((I->getOpcode() == Instruction::Add ||
-            I->getOpcode() == Instruction::Sub) && 
+            I->getOpcode() == Instruction::Sub) &&
            "Use is not a valid add instruction!");
-    
+
     // Get the value added to the cast result pointer...
     Value *OtherPtr = I->getOperand((I->getOperand(0) == &CI) ? 1 : 0);
 
@@ -156,7 +156,7 @@
     // one index (from code above), so we just need to negate the pointer index
     // long value.
     if (I->getOpcode() == Instruction::Sub) {
-      Instruction *Neg = BinaryOperator::createNeg(GEP->getOperand(1), 
+      Instruction *Neg = BinaryOperator::createNeg(GEP->getOperand(1),
                                        GEP->getOperand(1)->getName()+".neg", I);
       GEP->setOperand(1, Neg);
     }
@@ -276,7 +276,7 @@
       ConvertedTypes[CI] = CI->getType();  // Make sure the cast doesn't change
       if (ExpressionConvertibleToType(Src, DestTy, ConvertedTypes, TD)) {
         PRINT_PEEPHOLE3("CAST-SRC-EXPR-CONV:in ", *Src, *CI, *BB->getParent());
-          
+
         DEBUG(std::cerr << "\nCONVERTING SRC EXPR TYPE:\n");
         { // ValueMap must be destroyed before function verified!
           ValueMapCache ValueMap;
@@ -284,7 +284,7 @@
 
           if (Constant *CPV = dyn_cast<Constant>(E))
             CI->replaceAllUsesWith(CPV);
-          
+
           PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", *E);
           DEBUG(std::cerr << "DONE CONVERTING SRC EXPR TYPE: \n"
                           << *BB->getParent());
@@ -376,7 +376,7 @@
             if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) {
               // Check for a zero element struct type... if we have one, bail.
               if (CurSTy->getNumElements() == 0) break;
-            
+
               // Grab the first element of the struct type, which must lie at
               // offset zero in the struct.
               //
@@ -390,13 +390,13 @@
 
             // Did we find what we're looking for?
             if (ElTy->isLosslesslyConvertibleTo(DestPointedTy)) break;
-            
+
             // Nope, go a level deeper.
             ++Depth;
             CurCTy = dyn_cast<CompositeType>(ElTy);
             ElTy = 0;
           }
-          
+
           // Did we find what we were looking for? If so, do the transformation
           if (ElTy) {
             PRINT_PEEPHOLE1("cast-for-first:in", *CI);
@@ -411,7 +411,7 @@
             // the old src value.
             //
             CI->setOperand(0, GEP);
-            
+
             PRINT_PEEPHOLE2("cast-for-first:out", *GEP, *CI);
             ++NumGEPInstFormed;
             return true;
@@ -422,12 +422,12 @@
   } else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
     Value *Val     = SI->getOperand(0);
     Value *Pointer = SI->getPointerOperand();
-    
+
     // Peephole optimize the following instructions:
     // %t = cast <T1>* %P to <T2> * ;; If T1 is losslessly convertible to T2
     // store <T2> %V, <T2>* %t
     //
-    // Into: 
+    // Into:
     // %t = cast <T2> %V to <T1>
     // store <T1> %t2, <T1>* %P
     //
@@ -460,12 +460,12 @@
     Value *Pointer = LI->getOperand(0);
     const Type *PtrElType =
       cast<PointerType>(Pointer->getType())->getElementType();
-    
+
     // Peephole optimize the following instructions:
     // %Val = cast <T1>* to <T2>*    ;; If T1 is losslessly convertible to T2
     // %t = load <T2>* %P
     //
-    // Into: 
+    // Into:
     // %t = load <T1>* %P
     // %Val = cast <T1> to <T2>
     //
@@ -483,7 +483,7 @@
 
             // Create the new load instruction... loading the pre-casted value
             LoadInst *NewLI = new LoadInst(CastSrc, LI->getName(), BI);
-            
+
             // Insert the new T cast instruction... stealing old T's name
             CastInst *NCI = new CastInst(NewLI, LI->getType(), CI->getName());
 
@@ -540,7 +540,7 @@
                            std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
       ++BI;
       ReplaceInstWithInst(CI, NewCall);
-      
+
       ++NumVarargCallChanges;
       return true;
     }
@@ -559,7 +559,7 @@
     for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) {
       DEBUG(std::cerr << "LevelRaising: " << *BI);
       if (dceInstruction(BI) || doConstantPropagation(BI)) {
-        Changed = true; 
+        Changed = true;
         ++NumDCEorCP;
         DEBUG(std::cerr << "***\t\t^^-- Dead code eliminated!\n");
       } else if (PeepholeOptimize(BB, BI)) {


Index: llvm/lib/Transforms/TransformInternals.cpp
diff -u llvm/lib/Transforms/TransformInternals.cpp:1.47 llvm/lib/Transforms/TransformInternals.cpp:1.48
--- llvm/lib/Transforms/TransformInternals.cpp:1.47	Sat Jan  8 13:48:40 2005
+++ llvm/lib/Transforms/TransformInternals.cpp	Thu Apr 21 18:45:55 2005
@@ -1,10 +1,10 @@
 //===- TransformInternals.cpp - Implement shared functions for transforms -===//
-// 
+//
 //                     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 defines shared functions used by the different components of the
@@ -30,10 +30,10 @@
   for (i = 0; i < SL->MemberOffsets.size()-1; ++i)
     if (Offset >= SL->MemberOffsets[i] && Offset < SL->MemberOffsets[i+1])
       break;
-  
+
   assert(Offset >= SL->MemberOffsets[i] &&
          (i == SL->MemberOffsets.size()-1 || Offset < SL->MemberOffsets[i+1]));
-  
+
   // Make sure to save the current index...
   Indices.push_back(ConstantUInt::get(Type::UIntTy, i));
   Offset = SL->MemberOffsets[i];


Index: llvm/lib/Transforms/TransformInternals.h
diff -u llvm/lib/Transforms/TransformInternals.h:1.25 llvm/lib/Transforms/TransformInternals.h:1.26
--- llvm/lib/Transforms/TransformInternals.h:1.25	Fri Jan 28 18:37:36 2005
+++ llvm/lib/Transforms/TransformInternals.h	Thu Apr 21 18:45:55 2005
@@ -1,10 +1,10 @@
 //===-- TransformInternals.h - Shared functions for Transforms --*- C++ -*-===//
-// 
+//
 //                     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 header file declares shared functions used by the different components
@@ -56,7 +56,7 @@
 //  ValueHandle Class - Smart pointer that occupies a slot on the users USE list
 //  that prevents it from being destroyed.  This "looks" like an Instruction
 //  with Opcode UserOp1.
-// 
+//
 class ValueMapCache;
 class ValueHandle : public Instruction {
   Use Op;






More information about the llvm-commits mailing list