[llvm-commits] [llvm-gcc-4.2] r75447 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp

Owen Anderson resistor at mac.com
Sun Jul 12 21:10:16 PDT 2009


Author: resistor
Date: Sun Jul 12 23:10:16 2009
New Revision: 75447

URL: http://llvm.org/viewvc/llvm-project?rev=75447&view=rev
Log:
Update for LLVM API change.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=75447&r1=75446&r2=75447&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sun Jul 12 23:10:16 2009
@@ -279,7 +279,7 @@
     else
       // Non constant values, e.g. arguments, are not at global scope.
       // When PCH is read, only global scope values are used.
-      ValuesForPCH.push_back(Constant::getNullValue(Type::Int32Ty));
+      ValuesForPCH.push_back(getGlobalContext().getNullValue(Type::Int32Ty));
   }
 
   // Create string table.
@@ -1250,7 +1250,7 @@
     // This global should be zero initialized.  Reconvert the type in case the
     // forward def of the global and the real def differ in type (e.g. declared
     // as 'int A[]', and defined as 'int A[100]').
-    Init = Constant::getNullValue(ConvertType(TREE_TYPE(decl)));
+    Init = getGlobalContext().getNullValue(ConvertType(TREE_TYPE(decl)));
   } else {
     assert((TREE_CONSTANT(DECL_INITIAL(decl)) || 
             TREE_CODE(DECL_INITIAL(decl)) == STRING_CST) &&

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=75447&r1=75446&r2=75447&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Jul 12 23:10:16 2009
@@ -1146,7 +1146,8 @@
     // it is dead.  This allows us to insert allocas in order without having to
     // scan for an insertion point. Use BitCast for int -> int
     AllocaInsertionPoint = CastInst::Create(Instruction::BitCast,
-      Constant::getNullValue(Type::Int32Ty), Type::Int32Ty, "alloca point");
+      getGlobalContext().getNullValue(Type::Int32Ty),
+      Type::Int32Ty, "alloca point");
     // Insert it as the first instruction in the entry block.
     Fn->begin()->getInstList().insert(Fn->begin()->begin(),
                                       AllocaInsertionPoint);
@@ -1312,7 +1313,7 @@
   const Type *ElTy =
     cast<PointerType>(DestLoc.Ptr->getType())->getElementType();
   if (ElTy->isSingleValueType()) {
-    StoreInst *St = Builder.CreateStore(Constant::getNullValue(ElTy),
+    StoreInst *St = Builder.CreateStore(getGlobalContext().getNullValue(ElTy),
                                         DestLoc.Ptr, DestLoc.Volatile);
     St->setAlignment(DestLoc.getAlignment());
   } else if (const StructType *STy = dyn_cast<StructType>(ElTy)) {
@@ -1601,7 +1602,7 @@
       // before initialization doesn't get garbage results to follow.
       const Type *T = cast<PointerType>(AI->getType())->getElementType();
       EmitTypeGcroot(AI, decl);
-      Builder.CreateStore(Constant::getNullValue(T), AI);
+      Builder.CreateStore(getGlobalContext().getNullValue(T), AI);
     }
   
   if (TheDebugInfo) {
@@ -1963,7 +1964,7 @@
         if (!TypeList) {
           // Catch-all - push a null pointer.
           Args.push_back(
-            Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty))
+           getGlobalContext().getNullValue(PointerType::getUnqual(Type::Int8Ty))
           );
         } else {
           // Add the type infos.
@@ -1989,8 +1990,8 @@
         tree catch_all_type = lang_eh_catch_all();
         if (catch_all_type == NULL_TREE)
           // Use a C++ style null catch-all object.
-          Catch_All =
-            Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty));
+          Catch_All = getGlobalContext().getNullValue(
+                                          PointerType::getUnqual(Type::Int8Ty));
         else
           // This language has a type that catches all others.
           Catch_All = Emit(catch_all_type, 0);
@@ -2193,7 +2194,7 @@
   } else {
     // This is a bitfield reference.
     if (!LV.BitSize)
-      return Constant::getNullValue(Ty);
+      return getGlobalContext().getNullValue(Ty);
 
     const Type *ValTy = cast<PointerType>(LV.Ptr->getType())->getElementType();
     unsigned ValSizeInBits = ValTy->getPrimitiveSizeInBits();
@@ -3168,7 +3169,7 @@
     ICmpInst::Predicate pred = TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0))) ?
       ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE;
     Value *Cmp = Builder.CreateICmp(pred, Op, 
-                             Constant::getNullValue(Op->getType()), "abscond");
+                    getGlobalContext().getNullValue(Op->getType()), "abscond");
     return Builder.CreateSelect(Cmp, Op, OpN, "abs");
   }
 
@@ -3224,7 +3225,8 @@
 Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree exp) {
   Value *V = Emit(TREE_OPERAND(exp, 0), 0);
   if (V->getType() != Type::Int1Ty) 
-    V = Builder.CreateICmpNE(V, Constant::getNullValue(V->getType()), "toBool");
+    V = Builder.CreateICmpNE(V,
+          getGlobalContext().getNullValue(V->getType()), "toBool");
   V = Builder.CreateNot(V, (V->getName()+"not").c_str());
   return CastToUIntType(V, ConvertType(TREE_TYPE(exp)));
 }
@@ -3382,9 +3384,11 @@
   
   // This is a truth operation like the strict &&,||,^^.  Convert to bool as
   // a test against zero
-  LHS = Builder.CreateICmpNE(LHS, Constant::getNullValue(LHS->getType()),
+  LHS = Builder.CreateICmpNE(LHS, 
+                             getGlobalContext().getNullValue(LHS->getType()),
                              "toBool");
-  RHS = Builder.CreateICmpNE(RHS, Constant::getNullValue(RHS->getType()),
+  RHS = Builder.CreateICmpNE(RHS, 
+                             getGlobalContext().getNullValue(RHS->getType()),
                              "toBool");
   
   Value *Res = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS);
@@ -4965,9 +4969,10 @@
     Result = Builder.CreateAdd(Result, ConstantInt::get(Result->getType(), 1));
     Result = CastToUIntType(Result, ConvertType(TREE_TYPE(exp)));
     Value *Cond =
-      Builder.CreateICmpEQ(Amt, Constant::getNullValue(Amt->getType()));
+      Builder.CreateICmpEQ(Amt, 
+                           getGlobalContext().getNullValue(Amt->getType()));
     Result = Builder.CreateSelect(Cond,
-                                  Constant::getNullValue(Result->getType()),
+                           getGlobalContext().getNullValue(Result->getType()),
                                   Result);
     return true;
   }
@@ -5445,7 +5450,7 @@
     {
       const Type *Ty = ConvertType(TREE_TYPE(exp));
       if (Ty != Type::VoidTy)
-        Result = Constant::getNullValue(Ty);
+        Result = getGlobalContext().getNullValue(Ty);
       return true;
     }
 #endif  // FIXME: Should handle these GCC extensions eventually.
@@ -5510,7 +5515,7 @@
 }
 
 bool TreeToLLVM::EmitBuiltinConstantP(tree exp, Value *&Result) {
-  Result = Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
+  Result = getGlobalContext().getNullValue(ConvertType(TREE_TYPE(exp)));
   return true;
 }
 
@@ -5625,7 +5630,7 @@
   unsigned DstAlign = getPointerAlignment(Dst);
 
   Value *DstV = Emit(Dst, 0);
-  Value *Val = Constant::getNullValue(Type::Int32Ty);
+  Value *Val = getGlobalContext().getNullValue(Type::Int32Ty);
   Value *Len = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
   EmitMemSet(DstV, Val, Len, DstAlign);
   return true;
@@ -5671,7 +5676,7 @@
   
   // Default to highly local read.
   if (ReadWrite == 0)
-    ReadWrite = Constant::getNullValue(Type::Int32Ty);
+    ReadWrite = getGlobalContext().getNullValue(Type::Int32Ty);
   if (Locality == 0)
     Locality = ConstantInt::get(Type::Int32Ty, 3);
   
@@ -6776,7 +6781,7 @@
     std::vector<Value *> BuildVecOps;
     
     // Insert zero initializers for any uninitialized values.
-    Constant *Zero = Constant::getNullValue(PTy->getElementType());
+    Constant *Zero = getGlobalContext().getNullValue(PTy->getElementType());
     BuildVecOps.resize(cast<VectorType>(Ty)->getNumElements(), Zero);
 
     // Insert all of the elements here.
@@ -6954,7 +6959,7 @@
 
 Constant *TreeConstantToLLVM::ConvertVECTOR_CST(tree exp) {
   if (!TREE_VECTOR_CST_ELTS(exp))
-    return Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
+    return getGlobalContext().getNullValue(ConvertType(TREE_TYPE(exp)));
 
   std::vector<Constant*> Elts;
   for (tree elt = TREE_VECTOR_CST_ELTS(exp); elt; elt = TREE_CHAIN(elt))
@@ -6963,7 +6968,7 @@
   // The vector should be zero filled if insufficient elements are provided.
   if (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp))) {
     tree EltType = TREE_TYPE(TREE_TYPE(exp));
-    Constant *Zero = Constant::getNullValue(ConvertType(EltType));
+    Constant *Zero = getGlobalContext().getNullValue(ConvertType(EltType));
     while (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp)))
       Elts.push_back(Zero);
   }
@@ -7016,7 +7021,7 @@
       Elts.resize(ConstantSize);
     } else {
       // Fill the end of the string with nulls.
-      Constant *C = Constant::getNullValue(ElTy);
+      Constant *C = getGlobalContext().getNullValue(ElTy);
       for (; Len != ConstantSize; ++Len)
         Elts.push_back(C);
     }
@@ -7090,7 +7095,7 @@
   // when array is filled during program initialization.
   if (CONSTRUCTOR_ELTS(exp) == 0 ||
       VEC_length(constructor_elt, CONSTRUCTOR_ELTS(exp)) == 0)  // All zeros?
-    return Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
+    return getGlobalContext().getNullValue(ConvertType(TREE_TYPE(exp)));
 
   switch (TREE_CODE(TREE_TYPE(exp))) {
   default: 
@@ -7197,7 +7202,7 @@
   //       of an array.  This can occur in cases where we have an array of
   //       unions, and the various unions had different pieces init'd.
   const Type *ElTy = SomeVal->getType();
-  Constant *Filler = Constant::getNullValue(ElTy);
+  Constant *Filler = getGlobalContext().getNullValue(ElTy);
   bool AllEltsSameType = true;
   for (unsigned i = 0, e = ResultElts.size(); i != e; ++i) {
     if (ResultElts[i] == 0)
@@ -7282,7 +7287,8 @@
     const Type *PadTy = Type::Int8Ty;
     if (AlignedEltOffs-EltOffs != 1)
       PadTy = ArrayType::get(PadTy, AlignedEltOffs-EltOffs);
-    ResultElts.insert(ResultElts.begin()+i, Constant::getNullValue(PadTy));
+    ResultElts.insert(ResultElts.begin()+i, 
+                      getGlobalContext().getNullValue(PadTy));
     ++e;  // One extra element to scan.
   }
 
@@ -7366,7 +7372,7 @@
     if (GCCFieldOffsetInBits/8-NextFieldByteStart != 1)
       FillTy = ArrayType::get(FillTy,
                               GCCFieldOffsetInBits/8-NextFieldByteStart);
-    ResultElts.push_back(Constant::getNullValue(FillTy));
+    ResultElts.push_back(getGlobalContext().getNullValue(FillTy));
 
     NextFieldByteStart = GCCFieldOffsetInBits/8;
     
@@ -7552,7 +7558,7 @@
     const Type *FillTy = Type::Int8Ty;
     if (GCCStructSize - NextFieldByteStart != 1)
       FillTy = ArrayType::get(FillTy, GCCStructSize - NextFieldByteStart);
-    ResultElts.push_back(Constant::getNullValue(FillTy));
+    ResultElts.push_back(getGlobalContext().getNullValue(FillTy));
     NextFieldByteStart = GCCStructSize;
   
     // At this point, we know that our struct should have the right size.
@@ -7659,7 +7665,7 @@
         FillTy = Type::Int8Ty;
       else
         FillTy = ArrayType::get(Type::Int8Ty, UnionSize - InitSize);
-      Elts.push_back(Constant::getNullValue(FillTy));
+      Elts.push_back(getGlobalContext().getNullValue(FillTy));
     }
   }
   return ConstantStruct::get(Elts, false);
@@ -7907,7 +7913,7 @@
 
     Constant *Ops[] = {
       StructAddrLV,
-      Constant::getNullValue(Type::Int32Ty),
+      getGlobalContext().getNullValue(Type::Int32Ty),
       ConstantInt::get(Type::Int32Ty, MemberIndex)
     };
     FieldPtr = TheFolder->CreateGetElementPtr(StructAddrLV, Ops+1, 2);





More information about the llvm-commits mailing list