[llvm-commits] [dragonegg] r126747 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Tue Mar 1 07:43:49 PST 2011


Author: baldrick
Date: Tue Mar  1 09:43:49 2011
New Revision: 126747

URL: http://llvm.org/viewvc/llvm-project?rev=126747&view=rev
Log:
Have a few places that really want to fold constants use the TargetFolder
directly.  This is in case someone switches the builder to use a NoFolder.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126747&r1=126746&r2=126747&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Mar  1 09:43:49 2011
@@ -608,9 +608,8 @@
     // If a previous proto existed with the wrong type, replace any uses of it
     // with the actual function and delete the proto.
     if (FnEntry) {
-      FnEntry->replaceAllUsesWith(
-        Builder.getFolder().CreateBitCast(Fn, FnEntry->getType())
-      );
+      FnEntry->replaceAllUsesWith
+        (TheFolder->CreateBitCast(Fn, FnEntry->getType()));
       changeLLVMConstant(FnEntry, Fn);
       FnEntry->eraseFromParent();
     }
@@ -1724,7 +1723,7 @@
     ConstantInt::get(Type::getInt32Ty(Context), DECL_SOURCE_LINE(decl));
   Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl));
   const Type *SBP = Type::getInt8PtrTy(Context);
-  file = Builder.getFolder().CreateBitCast(file, SBP);
+  file = TheFolder->CreateBitCast(file, SBP);
 
   // There may be multiple annotate attributes. Pass return of lookup_attr
   //  to successive lookups.
@@ -4067,7 +4066,7 @@
 //TODO    Constant *lineNo = ConstantInt::get(Type::getInt32Ty, LOCATION_LINE(locus));
 //TODO    Constant *file = ConvertMetadataStringToGV(LOCATION_FILE(locus));
 //TODO    const Type *SBP= Type::getInt8PtrTy(Context);
-//TODO    file = Builder.getFolder().CreateBitCast(file, SBP);
+//TODO    file = TheFolder->CreateBitCast(file, SBP);
 //TODO
 //TODO    // Get arguments.
 //TODO    tree arglist = CALL_EXPR_ARGS(stmt);
@@ -4823,9 +4822,9 @@
                " using zero");
       ReadWrite = 0;
     } else {
-      ReadWrite = Builder.getFolder().CreateIntCast(cast<Constant>(ReadWrite),
-                                                    Type::getInt32Ty(Context),
-                                                    /*isSigned*/false);
+      ReadWrite = TheFolder->CreateIntCast(cast<Constant>(ReadWrite),
+                                           Type::getInt32Ty(Context),
+                                           /*isSigned*/false);
     }
 
     if (gimple_call_num_args(stmt) > 2) {
@@ -4837,9 +4836,9 @@
         warning(0, "invalid third argument to %<__builtin_prefetch%>; using 3");
         Locality = 0;
       } else {
-        Locality = Builder.getFolder().CreateIntCast(cast<Constant>(Locality),
-                                                     Type::getInt32Ty(Context),
-                                                     /*isSigned*/false);
+        Locality = TheFolder->CreateIntCast(cast<Constant>(Locality),
+                                            Type::getInt32Ty(Context),
+                                            /*isSigned*/false);
       }
     }
   }





More information about the llvm-commits mailing list