[llvm-commits] [llvm-gcc-4.2] r134948 - in /llvm-gcc-4.2/trunk/gcc: config/alpha/llvm-alpha.cpp config/arm/llvm-arm-target.h config/arm/llvm-arm.cpp config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp config/mips/llvm-mips.cpp config/rs6000/llvm-rs6000.cpp config/rs6000/rs6000.h llvm-abi-default.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-internal.h llvm-types.cpp

Bill Wendling isanbard at gmail.com
Mon Jul 11 18:15:03 PDT 2011


Author: void
Date: Mon Jul 11 20:15:03 2011
New Revision: 134948

URL: http://llvm.org/viewvc/llvm-project?rev=134948&view=rev
Log:
Revert r134895 and r134894 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, line 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134895 into '.':
U    gcc/config/rs6000/llvm-rs6000.cpp
U    gcc/config/rs6000/rs6000.h
U    gcc/config/mips/llvm-mips.cpp
--- Reverse-merging r134894 into '.':
U    gcc/llvm-backend.cpp
U    gcc/llvm-convert.cpp
U    gcc/llvm-internal.h
U    gcc/llvm-types.cpp
U    gcc/llvm-abi-default.cpp
U    gcc/llvm-abi.h
U    gcc/config/alpha/llvm-alpha.cpp
U    gcc/config/i386/llvm-i386.cpp
U    gcc/config/i386/llvm-i386-target.h
G    gcc/config/rs6000/llvm-rs6000.cpp
U    gcc/config/arm/llvm-arm-target.h
U    gcc/config/arm/llvm-arm.cpp


Modified:
    llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
    llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h
    llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
    llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp
    llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
    llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-abi.h
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-internal.h
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp Mon Jul 11 20:15:03 2011
@@ -102,7 +102,7 @@
                                       unsigned FnCode,
                                       const MemRef *DestLoc,
                                       Value *&Result,
-                                      Type *ResultType,
+                                      const Type *ResultType,
                                       std::vector<Value*> &Ops) {
   switch (FnCode) {
   case ALPHA_BUILTIN_UMULH: {

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm-target.h Mon Jul 11 20:15:03 2011
@@ -48,16 +48,16 @@
 #ifdef LLVM_ABI_H
 
 extern bool
-llvm_arm_should_pass_aggregate_in_mixed_regs(tree, Type *Ty,
+llvm_arm_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty,
                                              CallingConv::ID&,
-                                             std::vector<Type*>&);
+                                             std::vector<const Type*>&);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E)    \
    llvm_arm_should_pass_aggregate_in_mixed_regs((T), (TY), (CC), (E))
 
 struct DefaultABIClient;
 extern bool
-llvm_arm_try_pass_aggregate_custom(tree, std::vector<Type*>&,
+llvm_arm_try_pass_aggregate_custom(tree, std::vector<const Type*>&,
 				   CallingConv::ID&,
 				   struct DefaultABIClient*);
 
@@ -65,8 +65,8 @@
   llvm_arm_try_pass_aggregate_custom((T), (E), (CC), (C))
 
 extern
-bool llvm_arm_aggregate_partially_passed_in_regs(std::vector<Type*>&,
-                                                 std::vector<Type*>&,
+bool llvm_arm_aggregate_partially_passed_in_regs(std::vector<const Type*>&,
+                                                 std::vector<const Type*>&,
                                                  CallingConv::ID&);
 
 #define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, CC)   \

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Mon Jul 11 20:15:03 2011
@@ -246,13 +246,13 @@
                                       unsigned FnCode,
                                       const MemRef *DestLoc,
                                       Value *&Result,
-                                      Type *ResultType,
+                                      const Type *ResultType,
                                       std::vector<Value*> &Ops) {
   neon_datatype datatype = neon_datatype_unspecified;
   bool isRounded = false;
   Intrinsic::ID intID = Intrinsic::not_intrinsic;
   Function *intFn;
-  Type* intOpTypes[2];
+  const Type* intOpTypes[2];
 
   if (FnCode < ARM_BUILTIN_NEON_BASE)
     return false;
@@ -1415,7 +1415,7 @@
 
     const VectorType *VTy = dyn_cast<const VectorType>(ResultType);
     assert(VTy && "expected a vector type for vabdl result");
-    llvm::Type *DTy = VectorType::getTruncatedElementVectorType(VTy);
+    const llvm::Type *DTy = VectorType::getTruncatedElementVectorType(VTy);
     intFn = Intrinsic::getDeclaration(TheModule, intID, &DTy, 1);
     Ops[0] = Builder.CreateCall2(intFn, Ops[0], Ops[1]);
     Result = Builder.CreateZExt(Ops[0], ResultType);
@@ -1445,7 +1445,7 @@
 
     const VectorType *VTy = dyn_cast<const VectorType>(ResultType);
     assert(VTy && "expected a vector type for vabal result");
-    llvm::Type *DTy = VectorType::getTruncatedElementVectorType(VTy);
+    const llvm::Type *DTy = VectorType::getTruncatedElementVectorType(VTy);
     intFn = Intrinsic::getDeclaration(TheModule, intID, &DTy, 1);
     Ops[1] = Builder.CreateCall2(intFn, Ops[1], Ops[2]);
     Ops[1] = Builder.CreateZExt(Ops[1], ResultType);
@@ -2033,7 +2033,7 @@
   case NEON_BUILTIN_vld4: {
     const StructType *STy = dyn_cast<const StructType>(ResultType);
     assert(STy && "expected a struct type");
-    Type *VTy = STy->getElementType(0);
+    const Type *VTy = STy->getElementType(0);
     switch (neon_code) {
     case NEON_BUILTIN_vld2: intID = Intrinsic::arm_neon_vld2; break;
     case NEON_BUILTIN_vld3: intID = Intrinsic::arm_neon_vld3; break;
@@ -2062,9 +2062,9 @@
   case NEON_BUILTIN_vld2_lane:
   case NEON_BUILTIN_vld3_lane:
   case NEON_BUILTIN_vld4_lane: {
-    StructType *STy = dyn_cast<StructType>(ResultType);
+    const StructType *STy = dyn_cast<const StructType>(ResultType);
     assert(STy && "expected a struct type");
-    VectorType *VTy = dyn_cast<VectorType>(STy->getElementType(0));
+    const VectorType *VTy = dyn_cast<const VectorType>(STy->getElementType(0));
     assert(VTy && "expected a vector type");
     if (!isValidLane(Ops[2], VTy->getNumElements()))
       return UnexpectedError("%Hinvalid lane number", exp, Result);
@@ -2105,9 +2105,9 @@
   case NEON_BUILTIN_vld2_dup:
   case NEON_BUILTIN_vld3_dup:
   case NEON_BUILTIN_vld4_dup: {
-    StructType *STy = dyn_cast<StructType>(ResultType);
+    const StructType *STy = dyn_cast<const StructType>(ResultType);
     assert(STy && "expected a struct type");
-    VectorType *VTy = dyn_cast<VectorType>(STy->getElementType(0));
+    const VectorType *VTy = dyn_cast<const VectorType>(STy->getElementType(0));
     assert(VTy && "expected a vector type");
     intOpTypes[0] = VTy;
 
@@ -2168,7 +2168,7 @@
   }
 
   case NEON_BUILTIN_vst1: {
-    Type *VTy = Ops[1]->getType();
+    const Type *VTy = Ops[1]->getType();
     intID = Intrinsic::arm_neon_vst1;
     intFn = Intrinsic::getDeclaration(TheModule, intID, &VTy, 1);
     Type *VPTy = PointerType::getUnqual(Type::getInt8Ty(Context));
@@ -2184,7 +2184,7 @@
   case NEON_BUILTIN_vst4: {
     const StructType *STy = dyn_cast<const StructType>(Ops[1]->getType());
     assert(STy && "expected a struct type");
-    Type *VTy = STy->getElementType(0);
+    const Type *VTy = STy->getElementType(0);
     switch (neon_code) {
     case NEON_BUILTIN_vst2: intID = Intrinsic::arm_neon_vst2; break;
     case NEON_BUILTIN_vst3: intID = Intrinsic::arm_neon_vst3; break;
@@ -2224,9 +2224,9 @@
   case NEON_BUILTIN_vst2_lane:
   case NEON_BUILTIN_vst3_lane:
   case NEON_BUILTIN_vst4_lane: {
-    StructType *STy = dyn_cast<StructType>(Ops[1]->getType());
+    const StructType *STy = dyn_cast<const StructType>(Ops[1]->getType());
     assert(STy && "expected a struct type");
-    VectorType *VTy = dyn_cast<VectorType>(STy->getElementType(0));
+    const VectorType *VTy = dyn_cast<const VectorType>(STy->getElementType(0));
     assert(VTy && "expected a vector type");
     if (!isValidLane(Ops[2], VTy->getNumElements()))
       return UnexpectedError("%Hinvalid lane number", exp, Result);
@@ -2521,11 +2521,11 @@
 // Walk over an LLVM Type that we know is a homogeneous aggregate and
 // push the proper LLVM Types that represent the register types to pass
 // that struct member in.
-static void push_elts(const Type *Ty, std::vector<Type*> &Elts)
+static void push_elts(const Type *Ty, std::vector<const Type*> &Elts)
 {
   for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end();
        I != E; ++I) {
-    Type *STy = *I;
+    const Type *STy = *I;
     if (const VectorType *VTy = dyn_cast<VectorType>(STy)) {
       switch (VTy->getBitWidth())
       {
@@ -2538,8 +2538,8 @@
         default:
           assert (0 && "invalid vector type");
       }
-    } else if (ArrayType *ATy = dyn_cast<ArrayType>(STy)) {
-      Type *ETy = ATy->getElementType();
+    } else if (const ArrayType *ATy = dyn_cast<ArrayType>(STy)) {
+      const Type *ETy = ATy->getElementType();
 
       for (uint64_t i = ATy->getNumElements(); i > 0; --i)
         Elts.push_back(ETy);
@@ -2550,7 +2550,7 @@
   }
 }
 
-static unsigned count_num_words(std::vector<Type*> &ScalarElts) {
+static unsigned count_num_words(std::vector<const Type*> &ScalarElts) {
   unsigned NumWords = 0;
   for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) {
     const Type *Ty = ScalarElts[i];
@@ -2574,7 +2574,7 @@
 // the IL a bit more explicit about how arguments are handled.
 extern bool
 llvm_arm_try_pass_aggregate_custom(tree type,
-                                   std::vector<Type*>& ScalarElts,
+                                   std::vector<const Type*>& ScalarElts,
 				   CallingConv::ID& CC,
 				   struct DefaultABIClient* C) {
   if (CC != CallingConv::ARM_AAPCS && CC != CallingConv::C)
@@ -2596,14 +2596,14 @@
 
   // First, build a type that will be bitcast to the original one and
   // from where elements will be extracted.
-  std::vector<Type*> Elts;
-  Type* Int32Ty = Type::getInt32Ty(getGlobalContext());
+  std::vector<const Type*> Elts;
+  const Type* Int32Ty = Type::getInt32Ty(getGlobalContext());
   const unsigned NumRegularArgs = Size / 4;
   for (unsigned i = 0; i < NumRegularArgs; ++i) {
     Elts.push_back(Int32Ty);
   }
   const unsigned RestSize = Size % 4;
-  llvm::Type *RestType = NULL;
+  const llvm::Type *RestType = NULL;
   if (RestSize> 2) {
     RestType = Type::getInt32Ty(getGlobalContext());
   } else if (RestSize > 1) {
@@ -2641,9 +2641,9 @@
 // for parameter passing. This only applies to AAPCS-VFP "homogeneous
 // aggregates" as specified in 4.3.5 of the AAPCS spec.
 bool
-llvm_arm_should_pass_aggregate_in_mixed_regs(tree TreeType, Type *Ty,
+llvm_arm_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type *Ty,
                                              CallingConv::ID &CC,
-                                             std::vector<Type*> &Elts) {
+                                             std::vector<const Type*> &Elts) {
   if (!llvm_arm_should_pass_or_return_aggregate_in_regs(TreeType, CC))
     return false;
 
@@ -2686,7 +2686,7 @@
 // count_num_registers_uses - Simulate argument passing reg allocation in SPRs.
 // Caller is expected to zero out SPRs.  Returns true if all of ScalarElts fit
 // in registers.
-static bool count_num_registers_uses(std::vector<Type*> &ScalarElts,
+static bool count_num_registers_uses(std::vector<const Type*> &ScalarElts,
                                      bool *SPRs) {
   for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) {
     const Type *Ty = ScalarElts[i];
@@ -2734,8 +2734,8 @@
 // part of the aggregate, return true. That means the aggregate should instead
 // be passed in memory.
 bool
-llvm_arm_aggregate_partially_passed_in_regs(std::vector<Type*> &Elts,
-                                            std::vector<Type*> &ScalarElts,
+llvm_arm_aggregate_partially_passed_in_regs(std::vector<const Type*> &Elts,
+                                            std::vector<const Type*> &ScalarElts,
                                             CallingConv::ID &CC) {
   // Homogeneous aggregates are an AAPCS-VFP feature.
   if ((CC != CallingConv::ARM_AAPCS_VFP) ||
@@ -2763,7 +2763,7 @@
 
   // Walk Ty and push LLVM types corresponding to register types onto
   // Elts.
-  std::vector<Type*> Elts;
+  std::vector<const Type*> Elts;
   const Type *Ty = ConvertType(TreeType);
   push_elts(Ty, Elts);
 

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Mon Jul 11 20:15:03 2011
@@ -225,18 +225,18 @@
   llvm_x86_should_pass_aggregate_as_fca(X, TY)
 #endif
 
-extern bool llvm_x86_should_pass_aggregate_in_memory(tree, Type *);
+extern bool llvm_x86_should_pass_aggregate_in_memory(tree, const Type *);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY, CC)     \
   llvm_x86_should_pass_aggregate_in_memory(X, TY)
 
 
 extern bool
-llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree, Type *Ty,
-                                                std::vector<Type*>&);
+llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty,
+                                                std::vector<const Type*>&);
 extern bool
-llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree, Type *Ty,
-                                                std::vector<Type*>&);
+llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty,
+                                                std::vector<const Type*>&);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E)       \
   (TARGET_64BIT ?                                                    \
@@ -244,8 +244,8 @@
    llvm_x86_32_should_pass_aggregate_in_mixed_regs((T), (TY), (E)))
 
 extern
-bool llvm_x86_64_aggregate_partially_passed_in_regs(std::vector<Type*>&,
-                                                    std::vector<Type*>&);
+bool llvm_x86_64_aggregate_partially_passed_in_regs(std::vector<const Type*>&,
+                                                    std::vector<const Type*>&);
 
 #define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, CC)       \
   (TARGET_64BIT ?                                                     \

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Jul 11 20:15:03 2011
@@ -95,7 +95,7 @@
                                       unsigned FnCode,
                                       const MemRef *DestLoc,
                                       Value *&Result,
-                                      Type *ResultType,
+                                      const Type *ResultType,
                                       std::vector<Value*> &Ops) {
   switch (FnCode) {
   default: break;
@@ -1108,8 +1108,8 @@
    It also returns a vector of types that correspond to the registers used
    for parameter passing. This is only called for x86-32. */
 bool
-llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree TreeType, Type *Ty,
-                                                std::vector<Type*> &Elts){
+llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type *Ty,
+                                                std::vector<const Type*> &Elts){
   // If this is a small fixed size type, investigate it.
   HOST_WIDE_INT SrcSize = int_size_in_bytes(TreeType);
   if (SrcSize <= 0 || SrcSize > 16)
@@ -1125,7 +1125,7 @@
   if (!STy || STy->isPacked()) return false;
 
   for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
-    Type *EltTy = STy->getElementType(i);
+    const Type *EltTy = STy->getElementType(i);
     // 32 and 64-bit integers are fine, as are float and double.  Long double
     // (which can be picked as the type for a union of 16 bytes) is not fine, 
     // as loads and stores of it get only 10 bytes.
@@ -1165,7 +1165,7 @@
 
 /* Target hook for llvm-abi.h. It returns true if an aggregate of the
    specified type should be passed in memory. */
-bool llvm_x86_should_pass_aggregate_in_memory(tree TreeType, Type *Ty) {
+bool llvm_x86_should_pass_aggregate_in_memory(tree TreeType, const Type *Ty) {
   if (llvm_x86_should_pass_aggregate_as_fca(TreeType, Ty))
     return false;
 
@@ -1178,7 +1178,7 @@
     return false;
 
   if (!TARGET_64BIT) {
-    std::vector<Type*> Elts;
+    std::vector<const Type*> Elts;
     return !llvm_x86_32_should_pass_aggregate_in_mixed_regs(TreeType, Ty, Elts);
   }
   return llvm_x86_64_should_pass_aggregate_in_memory(TreeType, Mode);
@@ -1186,7 +1186,7 @@
 
 /* count_num_registers_uses - Return the number of GPRs and XMMs parameter
    register used so far.  Caller is responsible for initializing outputs. */
-static void count_num_registers_uses(std::vector<Type*> &ScalarElts,
+static void count_num_registers_uses(std::vector<const Type*> &ScalarElts,
                                      unsigned &NumGPRs, unsigned &NumXMMs) {
   for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) {
     const Type *Ty = ScalarElts[i];
@@ -1220,8 +1220,8 @@
    part of the aggregate, return true. That means the aggregate should instead
    be passed in memory. */
 bool
-llvm_x86_64_aggregate_partially_passed_in_regs(std::vector<Type*> &Elts,
-                                               std::vector<Type*> &ScalarElts) {
+llvm_x86_64_aggregate_partially_passed_in_regs(std::vector<const Type*> &Elts,
+                                         std::vector<const Type*> &ScalarElts) {
   // Counting number of GPRs and XMMs used so far. According to AMD64 ABI
   // document: "If there are no registers available for any eightbyte of an
   // argument, the whole  argument is passed on the stack." X86-64 uses 6
@@ -1266,8 +1266,8 @@
    It also returns a vector of types that correspond to the registers used
    for parameter passing. This is only called for x86-64. */
 bool
-llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree TreeType, Type *Ty,
-                                                std::vector<Type*> &Elts){
+llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type *Ty,
+                                                std::vector<const Type*> &Elts){
   if (llvm_x86_should_pass_aggregate_as_fca(TreeType, Ty))
     return false;
 
@@ -1633,7 +1633,7 @@
 /// llvm_x86_64_should_pass_aggregate_in_mixed_regs code.
 void
 llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, const Type *Ty,
-                                            std::vector<Type*> &Elts){
+                                            std::vector<const Type*> &Elts){
   enum x86_64_reg_class Class[MAX_CLASSES];
   enum machine_mode Mode = ix86_getNaturalModeForType(TreeType);
   HOST_WIDE_INT Bytes =
@@ -1774,7 +1774,7 @@
     return NULL;
 
   const StructType *STy = cast<StructType>(Ty);
-  std::vector<Type *> ElementTypes;
+  std::vector<const Type *> ElementTypes;
 
   // Special handling for _Complex.
   if (llvm_x86_should_not_return_complex_in_memory(type)) {
@@ -1783,7 +1783,7 @@
     return StructType::get(Context, ElementTypes, STy->isPacked());
   } 
 
-  std::vector<Type*> GCCElts;
+  std::vector<const Type*> GCCElts;
   llvm_x86_64_get_multiple_return_reg_classes(type, Ty, GCCElts);
   return StructType::get(Context, GCCElts, false);
 }

Modified: llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp Mon Jul 11 20:15:03 2011
@@ -67,7 +67,7 @@
   const Type *Ty = ConvertType(type);
 
   const StructType *STy = cast<StructType>(Ty);
-  std::vector<Type *> ElementTypes;
+  std::vector<const Type *> ElementTypes;
 
   // Special handling for _Complex.
   if (llvm_mips_should_not_return_complex_in_memory(type)) {

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Mon Jul 11 20:15:03 2011
@@ -94,7 +94,7 @@
                                       unsigned FnCode,
                                       const MemRef *DestLoc,
                                       Value *&Result,
-                                      Type *ResultType,
+                                      const Type *ResultType,
                                       std::vector<Value*> &Ops) {
   switch (FnCode) {
   default: break;
@@ -391,7 +391,7 @@
   return false;
 }
 
-static unsigned count_num_registers_uses(std::vector<Type*> &ScalarElts) {
+static unsigned count_num_registers_uses(std::vector<const Type*> &ScalarElts) {
   unsigned NumGPRs = 0;
   for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) {
     if (NumGPRs >= 8)
@@ -423,7 +423,7 @@
 /// arguments are always passed in general purpose registers, never in
 /// Floating-point registers or vector registers.
 bool llvm_rs6000_try_pass_aggregate_custom(tree type,
-					   std::vector<Type*> &ScalarElts,
+					   std::vector<const Type*> &ScalarElts,
 					   const CallingConv::ID &CC,
 					   struct DefaultABIClient* C) {
   if (!isSVR4ABI())
@@ -432,8 +432,8 @@
   // Eight GPR's are availabe for parameter passing.
   const unsigned NumArgRegs = 8;
   unsigned NumGPR = count_num_registers_uses(ScalarElts);
-  Type *Ty = ConvertType(type);
-  Type* Int32Ty = Type::getInt32Ty(getGlobalContext());
+  const Type *Ty = ConvertType(type);
+  const Type* Int32Ty = Type::getInt32Ty(getGlobalContext());
   if (Ty->isSingleValueType()) {
     if (Ty->isIntegerTy()) {
       unsigned TypeSize = Ty->getPrimitiveSizeInBits();
@@ -469,7 +469,7 @@
   if (TREE_CODE(type) == COMPLEX_TYPE) {
     unsigned SrcSize = int_size_in_bytes(type);
     unsigned NumRegs = (SrcSize + 3) / 4;
-    std::vector<Type*> Elts;
+    std::vector<const Type*> Elts;
 
     // This looks very strange, but matches the old code.
     if (SrcSize == 8) {
@@ -505,7 +505,7 @@
 
 /* Target hook for llvm-abi.h. It returns true if an aggregate of the
    specified type should be passed using the byval mechanism. */
-bool llvm_rs6000_should_pass_aggregate_byval(tree TreeType, Type *Ty) {
+bool llvm_rs6000_should_pass_aggregate_byval(tree TreeType, const Type *Ty) {
   /* FIXME byval not implemented for ppc64. */
   if (TARGET_64BIT)
     return false;
@@ -554,8 +554,8 @@
    It also returns a vector of types that correspond to the registers used
    for parameter passing. */
 bool 
-llvm_rs6000_should_pass_aggregate_in_mixed_regs(tree TreeType, Type* Ty,
-                                              std::vector<Type*>&Elts) {
+llvm_rs6000_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type* Ty,
+                                              std::vector<const Type*>&Elts) {
   // FIXME there are plenty of ppc64 cases that need this.
   if (TARGET_64BIT)
     return false;

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Mon Jul 11 20:15:03 2011
@@ -3490,14 +3490,14 @@
 #ifdef LLVM_ABI_H
 
 extern bool llvm_rs6000_try_pass_aggregate_custom(tree,
-						  std::vector<Type*>&,
+						  std::vector<const Type*>&,
 						  const CallingConv::ID &,
 						  struct DefaultABIClient*);
 
 #define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C)	\
   llvm_rs6000_try_pass_aggregate_custom((T), (E), (CC), (C))
 
-extern bool llvm_rs6000_should_pass_aggregate_byval(tree, Type *);
+extern bool llvm_rs6000_should_pass_aggregate_byval(tree, const Type *);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY, CC)     \
   llvm_rs6000_should_pass_aggregate_byval((X), (TY))
@@ -3508,8 +3508,8 @@
 #define LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(X)            \
   llvm_rs6000_should_pass_vector_in_integer_regs((X))
 
-extern bool llvm_rs6000_should_pass_aggregate_in_mixed_regs(tree, Type*, 
-                                              std::vector<Type*>&);
+extern bool llvm_rs6000_should_pass_aggregate_in_mixed_regs(tree, const Type*, 
+                                              std::vector<const Type*>&);
 
 /* FIXME this is needed for 64-bit  */
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp Mon Jul 11 20:15:03 2011
@@ -9,7 +9,7 @@
 /// on the client that indicate how its pieces should be handled.  This
 /// handles things like returning structures via hidden parameters.
 void DefaultABI::HandleReturnType(tree type, tree fn, bool isBuiltin,
-                                  std::vector<Type*> &ScalarElts) {
+                                  std::vector<const Type*> &ScalarElts) {
   unsigned Offset = 0;
   const Type *Ty = ConvertType(type);
   if (Ty->isVectorTy()) {
@@ -53,7 +53,7 @@
 
     // FIXME: should return the hidden first argument for some targets
     // (e.g. ELF i386).
-    PointerType *PTy = Ty->getPointerTo();
+    const PointerType *PTy = Ty->getPointerTo();
     C.HandleAggregateShadowResult(PTy, false);
     ScalarElts.push_back(PTy);
   }
@@ -64,21 +64,21 @@
 /// argument and invokes methods on the client that indicate how its pieces
 /// should be handled.  This handles things like decimating structures into
 /// their fields.
-void DefaultABI::HandleArgument(tree type, std::vector<Type*> &ScalarElts,
+void DefaultABI::HandleArgument(tree type, std::vector<const Type*> &ScalarElts,
 				Attributes *Attributes) {
   unsigned Size = 0;
   bool DontCheckAlignment = false;
-  Type *Ty = ConvertType(type);
+  const Type *Ty = ConvertType(type);
   // Figure out if this field is zero bits wide, e.g. {} or [0 x int].  Do
   // not include variable sized fields here.
-  std::vector<Type*> Elts;
+  std::vector<const Type*> Elts;
   if (Ty->isVoidTy()) {
     // Handle void explicitly as a {} type.
-    Type *OpTy = StructType::get(getGlobalContext());
+    const Type *OpTy = StructType::get(getGlobalContext());
     C.HandleScalarArgument(OpTy, type);
     ScalarElts.push_back(OpTy);
   } else if (isPassedByInvisibleReference(type)) { // variable size -> by-ref.
-    Type *PtrTy = Ty->getPointerTo();
+    const Type *PtrTy = Ty->getPointerTo();
     C.HandleByInvisibleReferenceArgument(PtrTy, type);
     ScalarElts.push_back(PtrTy);
   } else if (Ty->isVectorTy()) {
@@ -134,7 +134,7 @@
     for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
       if (TREE_CODE(Field) == FIELD_DECL) {
 	const tree Ftype = getDeclaredType(Field);
-	Type *FTy = ConvertType(Ftype);
+	const Type *FTy = ConvertType(Ftype);
 	unsigned FNo = GET_LLVM_FIELD_INDEX(Field);
 	assert(FNo != ~0U && "Case not handled yet!");
 
@@ -174,7 +174,7 @@
 }
 
 /// HandleUnion - Handle a UNION_TYPE or QUAL_UNION_TYPE tree.
-void DefaultABI::HandleUnion(tree type, std::vector<Type*> &ScalarElts) {
+void DefaultABI::HandleUnion(tree type, std::vector<const Type*> &ScalarElts) {
   if (TYPE_TRANSPARENT_UNION(type)) {
     tree Field = TYPE_FIELDS(type);
     assert(Field && "Transparent union must have some elements!");
@@ -218,7 +218,7 @@
 /// integer registers, convert it to a structure containing ints and pass all
 /// of the struct elements in.  If Size is set we pass only that many bytes.
 void DefaultABI::PassInIntegerRegisters(tree type,
-					std::vector<Type*> &ScalarElts,
+					std::vector<const Type*> &ScalarElts,
 					unsigned origSize,
 					bool DontCheckAlignment) {
   unsigned Size;
@@ -240,8 +240,8 @@
   unsigned ArraySize = Size / ElementSize;
 
   // Put as much of the aggregate as possible into an array.
-  Type *ATy = NULL;
-  Type *ArrayElementType = NULL;
+  const Type *ATy = NULL;
+  const Type *ArrayElementType = NULL;
   if (ArraySize) {
     Size = Size % ElementSize;
     ArrayElementType = (UseInt64 ?
@@ -252,7 +252,7 @@
 
   // Pass any leftover bytes as a separate element following the array.
   unsigned LastEltRealSize = 0;
-  llvm::Type *LastEltTy = 0;
+  const llvm::Type *LastEltTy = 0;
   if (Size > 4) {
     LastEltTy = Type::getInt64Ty(getGlobalContext());
   } else if (Size > 2) {
@@ -267,7 +267,7 @@
       LastEltRealSize = Size;
   }
 
-  std::vector<Type*> Elts;
+  std::vector<const Type*> Elts;
   if (ATy)
     Elts.push_back(ATy);
   if (LastEltTy)
@@ -298,13 +298,13 @@
 /// mixed integer, floating point, and vector registers, convert it to a
 /// structure containing the specified struct elements in.
 void DefaultABI::PassInMixedRegisters(const Type *Ty,
-				      std::vector<Type*> &OrigElts,
-				      std::vector<Type*> &ScalarElts) {
+				      std::vector<const Type*> &OrigElts,
+				      std::vector<const Type*> &ScalarElts) {
   // We use VoidTy in OrigElts to mean "this is a word in the aggregate
   // that occupies storage but has no useful information, and is not passed
   // anywhere".  Happens on x86-64.
-  std::vector<Type*> Elts(OrigElts);
-  Type* wordType = getTargetData().getPointerSize() == 4 ?
+  std::vector<const Type*> Elts(OrigElts);
+  const Type* wordType = getTargetData().getPointerSize() == 4 ?
     Type::getInt32Ty(getGlobalContext()) : Type::getInt64Ty(getGlobalContext());
   for (unsigned i=0, e=Elts.size(); i!=e; ++i)
     if (OrigElts[i]->isVoidTy())

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Jul 11 20:15:03 2011
@@ -407,31 +407,31 @@
   /// on the client that indicate how its pieces should be handled.  This
   /// handles things like returning structures via hidden parameters.
   void HandleReturnType(tree type, tree fn, bool isBuiltin,
-                        std::vector<Type*> &ScalarElts);
+                        std::vector<const Type*> &ScalarElts);
 
   /// HandleArgument - This is invoked by the target-independent code for each
   /// argument type passed into the function.  It potentially breaks down the
   /// argument and invokes methods on the client that indicate how its pieces
   /// should be handled.  This handles things like decimating structures into
   /// their fields.
-  void HandleArgument(tree type, std::vector<Type*> &ScalarElts,
+  void HandleArgument(tree type, std::vector<const Type*> &ScalarElts,
                       Attributes *Attributes = NULL);
 
   /// HandleUnion - Handle a UNION_TYPE or QUAL_UNION_TYPE tree.
   ///
-  void HandleUnion(tree type, std::vector<Type*> &ScalarElts);
+  void HandleUnion(tree type, std::vector<const Type*> &ScalarElts);
 
   /// PassInIntegerRegisters - Given an aggregate value that should be passed in
   /// integer registers, convert it to a structure containing ints and pass all
   /// of the struct elements in.  If Size is set we pass only that many bytes.
-  void PassInIntegerRegisters(tree type, std::vector<Type*> &ScalarElts,
+  void PassInIntegerRegisters(tree type, std::vector<const Type*> &ScalarElts,
                               unsigned origSize, bool DontCheckAlignment);
 
   /// PassInMixedRegisters - Given an aggregate value that should be passed in
   /// mixed integer, floating point, and vector registers, convert it to a
   /// structure containing the specified struct elements in.
-  void PassInMixedRegisters(const Type *Ty, std::vector<Type*> &OrigElts,
-                            std::vector<Type*> &ScalarElts);
+  void PassInMixedRegisters(const Type *Ty, std::vector<const Type*> &OrigElts,
+                            std::vector<const Type*> &ScalarElts);
 };
 
 #endif /* LLVM_ABI_H */

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=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Jul 11 20:15:03 2011
@@ -915,7 +915,8 @@
   LLVMContext &Context = getGlobalContext();
   
   const Type *FPTy =
-    FunctionType::get(Type::getVoidTy(Context), std::vector<Type*>(), false);
+    FunctionType::get(Type::getVoidTy(Context),
+                      std::vector<const Type*>(), false);
   FPTy = FPTy->getPointerTo();
   
   for (unsigned i = 0, e = Tors.size(); i != e; ++i) {

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=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 11 20:15:03 2011
@@ -381,8 +381,8 @@
         // bytes, but only 10 are copied.  If the object is really a union
         // we might need the other bytes.  We must also be careful to use
         // the smaller alignment.
-        Type *SBP = Type::getInt8PtrTy(Context);
-        Type *IntPtr = getTargetData().getIntPtrType(Context);
+        const Type *SBP = Type::getInt8PtrTy(Context);
+        const Type *IntPtr = getTargetData().getIntPtrType(Context);
         Value *Ops[5] = {
           Builder.CreateCast(Instruction::BitCast, Loc, SBP),
           Builder.CreateCast(Instruction::BitCast, AI, SBP),
@@ -392,7 +392,7 @@
                            LLVM_BYVAL_ALIGNMENT(type)),
           ConstantInt::get(Type::getInt1Ty(Context), false)
         };
-        Type *ArgTypes[3] = {SBP, SBP, IntPtr };
+        const Type *ArgTypes[3] = {SBP, SBP, IntPtr };
         Builder.CreateCall(Intrinsic::getDeclaration(TheModule, 
                                                      Intrinsic::memcpy,
                                                      ArgTypes, 3), Ops, Ops+5);
@@ -434,13 +434,13 @@
 
 // isPassedByVal - Return true if an aggregate of the specified type will be
 // passed in memory byval.
-static bool isPassedByVal(tree type, Type *Ty,
-                          std::vector<Type*> &ScalarArgs,
+static bool isPassedByVal(tree type, const Type *Ty,
+                          std::vector<const Type*> &ScalarArgs,
                           CallingConv::ID &CC) {
   if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type, Ty, CC))
     return true;
 
-  std::vector<Type*> Args;
+  std::vector<const Type*> Args;
   if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, CC, Args) &&
       LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(Args, ScalarArgs,
                                               CC))
@@ -677,7 +677,7 @@
   DefaultABI ABIConverter(Client);
 
   // Scalar arguments processed so far.
-  std::vector<Type*> ScalarArgs;
+  std::vector<const Type*> ScalarArgs;
 
   // Handle the DECL_RESULT.
   ABIConverter.HandleReturnType(TREE_TYPE(TREE_TYPE(FnDecl)), FnDecl,
@@ -693,7 +693,7 @@
     const char *Name = "unnamed_arg";
     if (DECL_NAME(Args)) Name = IDENTIFIER_POINTER(DECL_NAME(Args));
 
-    Type *ArgTy = ConvertType(TREE_TYPE(Args));
+    const Type *ArgTy = ConvertType(TREE_TYPE(Args));
     bool isInvRef = isPassedByInvisibleReference(TREE_TYPE(Args));
     if (isInvRef ||
         (ArgTy->isVectorTy() &&
@@ -1655,8 +1655,8 @@
 
 Value *TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size,
                               unsigned Align) {
-  Type *SBP = Type::getInt8PtrTy(Context);
-  Type *IntPtr = TD.getIntPtrType(Context);
+  const Type *SBP = Type::getInt8PtrTy(Context);
+  const Type *IntPtr = TD.getIntPtrType(Context);
   Value *Ops[5] = {
     BitCastToType(DestPtr, SBP),
     BitCastToType(SrcPtr, SBP),
@@ -1665,7 +1665,7 @@
     ConstantInt::get(Type::getInt1Ty(Context), false)
   };
 
-  Type *ArgTypes[3] = {SBP, SBP, IntPtr };
+  const Type *ArgTypes[3] = {SBP, SBP, IntPtr };
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memcpy,
                                                ArgTypes, 3), Ops, Ops+5);
   return Ops[0];
@@ -1673,8 +1673,8 @@
 
 Value *TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size,
                                unsigned Align) {
-  Type *SBP = Type::getInt8PtrTy(Context);
-  Type *IntPtr = TD.getIntPtrType(Context);
+  const Type *SBP = Type::getInt8PtrTy(Context);
+  const Type *IntPtr = TD.getIntPtrType(Context);
   Value *Ops[5] = {
     BitCastToType(DestPtr, SBP),
     BitCastToType(SrcPtr, SBP),
@@ -1682,7 +1682,7 @@
     ConstantInt::get(Type::getInt32Ty(Context), Align),
     ConstantInt::get(Type::getInt1Ty(Context), false)
   };
-  Type *ArgTypes[3] = {SBP, SBP, IntPtr };
+  const Type *ArgTypes[3] = {SBP, SBP, IntPtr };
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memmove,
                                                ArgTypes, 3), Ops, Ops+5);
@@ -1691,8 +1691,8 @@
 
 Value *TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size,
                               unsigned Align) {
-  Type *SBP = Type::getInt8PtrTy(Context);
-  Type *IntPtr = TD.getIntPtrType(Context);
+  const Type *SBP = Type::getInt8PtrTy(Context);
+  const Type *IntPtr = TD.getIntPtrType(Context);
   Value *Ops[5] = {
     BitCastToType(DestPtr, SBP),
     CastToSIntType(SrcVal, Type::getInt8Ty(Context)),
@@ -1701,7 +1701,7 @@
     ConstantInt::get(Type::getInt1Ty(Context), false)
   };
 
-  Type *ArgTypes[2] = {SBP, IntPtr };
+  const Type *ArgTypes[2] = {SBP, IntPtr };
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memset,
                                                ArgTypes, 2), Ops, Ops+5);
   return Ops[0];
@@ -3034,7 +3034,7 @@
   DefaultABI ABIConverter(Client);
 
   // Handle the result, including struct returns.
-  std::vector<Type*> ScalarArgs;
+  std::vector<const Type*> ScalarArgs;
   ABIConverter.HandleReturnType(TREE_TYPE(exp),
                                 fndecl ? fndecl : exp,
                                 fndecl ? DECL_BUILT_IN(fndecl) : false,
@@ -4354,7 +4354,7 @@
   }
 
   // Turn this into a 'tmp = call Ty asm "", "={reg}"()'.
-  FunctionType *FTy = FunctionType::get(Ty, std::vector<Type*>(),false);
+  FunctionType *FTy = FunctionType::get(Ty, std::vector<const Type*>(),false);
 
   const char *Name = extractRegisterName(decl);
   int RegNum = decode_reg_name(Name);
@@ -4370,7 +4370,7 @@
 /// that copies the value out of the specified register.
 Value *TreeToLLVM::EmitMoveOfRegVariableToRightReg(Instruction *I, tree var) {
   // Create a 'call void asm sideeffect "", "{reg}"(Ty %RHS)'.
-  Type *Ty = I->getType();
+  const Type *Ty = I->getType();
 
   // If there was an error, return something bogus.
   if (ValidateRegisterVariable(var)) {
@@ -4379,7 +4379,7 @@
     return 0;   // Just don't copy something into DestLoc.
   }
 
-  std::vector<Type*> ArgTys;
+  std::vector<const Type*> ArgTys;
   ArgTys.push_back(Ty);
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), 
                                         ArgTys, false);
@@ -4392,7 +4392,7 @@
   Call->setDoesNotThrow();
   // Create another asm with the same reg, this time producing an output.
   // Turn this into a 'tmp = call Ty asm "", "={reg}"()'.
-  FunctionType *FTy2 = FunctionType::get(Ty, std::vector<Type*>(),
+  FunctionType *FTy2 = FunctionType::get(Ty, std::vector<const Type*>(),
                                         false);
   InlineAsm *IA2 = InlineAsm::get(FTy2, "", "={"+std::string(Name)+"}",
                                  true);
@@ -4409,8 +4409,8 @@
     return;
 
   // Turn this into a 'call void asm sideeffect "", "{reg}"(Ty %RHS)'.
-  std::vector<Type*> ArgTys;
-  Type* Ty = ConvertType(TREE_TYPE(decl));
+  std::vector<const Type*> ArgTys;
+  const Type* Ty = ConvertType(TREE_TYPE(decl));
   if (LLVM_IS_DECL_MMX_REGISTER(decl))
     Ty = Type::getX86_MMXTy(Context);
   ArgTys.push_back(Ty);
@@ -4869,14 +4869,14 @@
   }
 
   std::vector<Value*> CallOps;
-  std::vector<Type*> CallArgTypes;
+  std::vector<const Type*> CallArgTypes;
   std::string NewAsmStr = ConvertInlineAsmStr(exp, NumOutputs+NumInputs);
   std::string ConstraintStr;
   bool HasSideEffects = ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp);
 
   // StoreCallResultAddr - The pointer to store the result of the call through.
   SmallVector<Value *, 4> StoreCallResultAddrs;
-  SmallVector<Type *, 4> CallResultTypes;
+  SmallVector<const Type *, 4> CallResultTypes;
   SmallVector<bool, 4> CallResultIsSigned;
   SmallVector<std::pair<bool, unsigned>, 4> OutputLocations;
 
@@ -4936,7 +4936,8 @@
     }
 
     LValue Dest = EmitLV(Operand);
-    Type *DestValTy = cast<PointerType>(Dest.Ptr->getType())->getElementType();
+    const Type *DestValTy =
+      cast<PointerType>(Dest.Ptr->getType())->getElementType();
 
     assert(!Dest.isBitfield() && "Cannot assign into a bitfield!");
     if (!AllowsMem && DestValTy->isSingleValueType()) {// Reg dest -> asm return
@@ -5076,7 +5077,7 @@
         }
       }
 
-      Type* AdjTy = LLVM_ADJUST_MMX_INLINE_PARAMETER_TYPE(
+      const Type* AdjTy = LLVM_ADJUST_MMX_INLINE_PARAMETER_TYPE(
                               Constraint, Op->getType());
       if (AdjTy != Op->getType())
         Op = BitCastToType(Op, AdjTy);
@@ -5157,7 +5158,9 @@
   case 0: CallResultType = Type::getVoidTy(Context); break;
   case 1: CallResultType = CallResultTypes[0]; break;
   default:
-    CallResultType = StructType::get(Context, CallResultTypes);
+    std::vector<const Type*> TmpVec(CallResultTypes.begin(),
+                                    CallResultTypes.end());
+    CallResultType = StructType::get(Context, TmpVec);
     break;
   }
 
@@ -5305,7 +5308,7 @@
                                                  Value *&Result) {
 #ifdef LLVM_TARGET_INTRINSIC_LOWER
   // Get the result type and operand line in an easy to consume format.
-  Type *ResultType = ConvertType(TREE_TYPE(TREE_TYPE(fndecl)));
+  const Type *ResultType = ConvertType(TREE_TYPE(TREE_TYPE(fndecl)));
   std::vector<Value*> Operands;
   for (tree Op = TREE_OPERAND(exp, 1); Op; Op = TREE_CHAIN(Op)) {
     tree OpVal = TREE_VALUE(Op);
@@ -5349,13 +5352,13 @@
 
 Value *
 TreeToLLVM::BuildBinaryAtomicBuiltin(tree exp, Intrinsic::ID id) {
-  Type *ResultTy = ConvertType(TREE_TYPE(exp));
+  const Type *ResultTy = ConvertType(TREE_TYPE(exp));
   tree arglist = TREE_OPERAND(exp, 1);
   Value* C[2] = {
     Emit(TREE_VALUE(arglist), 0),
     Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
   };
-  Type* Ty[2];
+  const Type* Ty[2];
   Ty[0] = ResultTy;
   Ty[1] = ResultTy->getPointerTo();
   C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -5388,14 +5391,14 @@
 
 Value *
 TreeToLLVM::BuildCmpAndSwapAtomicBuiltin(tree exp, tree type, bool isBool) {
-  Type *ResultTy = ConvertType(type);
+  const Type *ResultTy = ConvertType(type);
   tree arglist = TREE_OPERAND(exp, 1);
   Value* C[3] = {
     Emit(TREE_VALUE(arglist), 0),
     Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0),
     Emit(TREE_VALUE(TREE_CHAIN(TREE_CHAIN(arglist))), 0)
   };
-  Type* Ty[2];
+  const Type* Ty[2];
   Ty[0] = ResultTy;
   Ty[1] = ResultTy->getPointerTo();
   C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -5568,7 +5571,7 @@
     };
 
     // Grab the current return type.
-    Type* Ty;
+    const Type* Ty;
     Ty = ConvertType(TREE_TYPE(exp));
 
     // Manually coerce the arg to the correct pointer type.
@@ -5764,7 +5767,7 @@
     // Get arguments.
     tree arglist = TREE_OPERAND(exp, 1);
     Value *ExprVal = Emit(TREE_VALUE(arglist), 0);
-    Type *Ty = ExprVal->getType();
+    const Type *Ty = ExprVal->getType();
     Value *StrVal = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
 
     SmallVector<Value *, 4> Args;
@@ -5924,13 +5927,13 @@
   case BUILT_IN_ADD_AND_FETCH_1:
   case BUILT_IN_ADD_AND_FETCH_2:
   case BUILT_IN_ADD_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -5971,13 +5974,13 @@
   case BUILT_IN_SUB_AND_FETCH_1:
   case BUILT_IN_SUB_AND_FETCH_2:
   case BUILT_IN_SUB_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -6018,13 +6021,13 @@
   case BUILT_IN_OR_AND_FETCH_1:
   case BUILT_IN_OR_AND_FETCH_2:
   case BUILT_IN_OR_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -6065,13 +6068,13 @@
   case BUILT_IN_AND_AND_FETCH_1:
   case BUILT_IN_AND_AND_FETCH_2:
   case BUILT_IN_AND_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -6112,13 +6115,13 @@
   case BUILT_IN_XOR_AND_FETCH_1:
   case BUILT_IN_XOR_AND_FETCH_2:
   case BUILT_IN_XOR_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -6159,13 +6162,13 @@
   case BUILT_IN_NAND_AND_FETCH_1:
   case BUILT_IN_NAND_AND_FETCH_2:
   case BUILT_IN_NAND_AND_FETCH_4: {
-    Type *ResultTy = ConvertType(TREE_TYPE(exp));
+    const Type *ResultTy = ConvertType(TREE_TYPE(exp));
     tree arglist = TREE_OPERAND(exp, 1);
     Value* C[2] = {
       Emit(TREE_VALUE(arglist), 0),
       Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0)
     };
-    Type* Ty[2];
+    const Type* Ty[2];
     Ty[0] = ResultTy;
     Ty[1] = ResultTy->getPointerTo();
     C[0] = Builder.CreateBitCast(C[0], Ty[1]);
@@ -6290,7 +6293,7 @@
   // varying type. Make sure that we specify the actual type for "iAny"
   // by passing it as the 3rd and 4th parameters. This isn't needed for
   // most intrinsics, but is needed for ctpop, cttz, ctlz.
-  Type *Ty = InVal->getType();
+  const Type *Ty = InVal->getType();
   Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, &Ty, 1),
                               InVal);
   return true;
@@ -6298,7 +6301,7 @@
 
 Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) {
   Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-  Type* Ty = Amt->getType();
+  const Type* Ty = Amt->getType();
 
   return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                       Intrinsic::sqrt, &Ty, 1),
@@ -6312,7 +6315,7 @@
 
   Value *Val = Emit(TREE_VALUE(ArgList), 0);
   Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0);
-  Type *Ty = Val->getType();
+  const Type *Ty = Val->getType();
   Pow = CastToSIntType(Pow, Type::getInt32Ty(Context));
 
   SmallVector<Value *,2> Args;
@@ -6330,7 +6333,7 @@
 
   Value *Val = Emit(TREE_VALUE(ArgList), 0);
   Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0);
-  Type *Ty = Val->getType();
+  const Type *Ty = Val->getType();
 
   SmallVector<Value *,2> Args;
   Args.push_back(Val);
@@ -7076,7 +7079,7 @@
 Value *TreeToLLVM::EmitFieldAnnotation(Value *FieldPtr, tree FieldDecl) {
   tree AnnotateAttr = lookup_attribute("annotate", DECL_ATTRIBUTES(FieldDecl));
 
-  Type *SBP = Type::getInt8PtrTy(Context);
+  const Type *SBP = Type::getInt8PtrTy(Context);
 
   Function *Fn = Intrinsic::getDeclaration(TheModule,
                                            Intrinsic::ptr_annotation,

Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Jul 11 20:15:03 2011
@@ -129,7 +129,7 @@
 public:
   TypeConverter() : RecursionStatus(CS_Normal) {}
   
-  Type *ConvertType(tree_node *type);
+  const Type *ConvertType(tree_node *type);
 
   /// GCCTypeOverlapsWithLLVMTypePadding - Return true if the specified GCC type
   /// has any data that overlaps with structure padding in the specified LLVM
@@ -140,11 +140,11 @@
   /// ConvertFunctionType - Convert the specified FUNCTION_TYPE or METHOD_TYPE
   /// tree to an LLVM type.  This does the same thing that ConvertType does, but
   /// it also returns the function's LLVM calling convention and attributes.
-  FunctionType *ConvertFunctionType(tree_node *type,
-                                    tree_node *decl,
-                                    tree_node *static_chain,
-                                    CallingConv::ID &CallingConv,
-                                    AttrListPtr &PAL);
+  const FunctionType *ConvertFunctionType(tree_node *type,
+                                          tree_node *decl,
+                                          tree_node *static_chain,
+                                          CallingConv::ID &CallingConv,
+                                          AttrListPtr &PAL);
   
   /// ConvertArgListToFnType - Given a DECL_ARGUMENTS list on an GCC tree,
   /// return the LLVM type corresponding to the function.  This is useful for
@@ -156,8 +156,8 @@
                                              AttrListPtr &PAL);
   
 private:
-  Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
-  Type *ConvertUNION(tree_node *type, tree_node *orig_type);
+  const Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
+  const Type *ConvertUNION(tree_node *type, tree_node *orig_type);
   bool DecodeStructFields(tree_node *Field, StructTypeConversionInfo &Info);
   void DecodeStructBitField(tree_node *Field, StructTypeConversionInfo &Info);
   void SelectUnionMember(tree_node *type, StructTypeConversionInfo &Info);
@@ -167,7 +167,7 @@
 
 /// ConvertType - Convert the specified tree type to an LLVM type.
 ///
-inline Type *ConvertType(tree_node *type) {
+inline const Type *ConvertType(tree_node *type) {
   return TheTypeConverter->ConvertType(type);
 }
 
@@ -615,7 +615,7 @@
                             unsigned FnCode,
                             const MemRef *DestLoc,
                             Value *&Result,
-                            Type *ResultType,
+                            const Type *ResultType,
                             std::vector<Value*> &Ops);
 
 public:

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=134948&r1=134947&r2=134948&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jul 11 20:15:03 2011
@@ -59,8 +59,8 @@
 // a map.
 
 // Collection of LLVM Types
-static std::vector<Type *> LTypes;
-typedef DenseMap<Type *, unsigned> LTypesMapTy;
+static std::vector<const Type *> LTypes;
+typedef DenseMap<const Type *, unsigned> LTypesMapTy;
 static LTypesMapTy LTypesMap;
 
 static LLVMContext &Context = getGlobalContext();
@@ -72,7 +72,7 @@
   (TYPE_CHECK (NODE)->type.symtab.llvm = index)
 
 // Note down LLVM type for GCC tree node.
-static Type * llvm_set_type(tree Tr, Type *Ty) {
+static const Type * llvm_set_type(tree Tr, const Type *Ty) {
 #ifndef NDEBUG
   // For x86 long double, llvm records the size of the data (80) while
   // gcc's TYPE_SIZE including alignment padding.  getTypeAllocSizeInBits
@@ -107,12 +107,12 @@
   return Ty;
 }
 
-#define SET_TYPE_LLVM(NODE, TYPE) llvm_set_type(NODE, TYPE)
+#define SET_TYPE_LLVM(NODE, TYPE) (const Type *)llvm_set_type(NODE, TYPE)
 
 // Get LLVM Type for the GCC tree node based on LTypes vector index.
 // When GCC tree node is initialized, it has 0 as the index value. This is
 // why all recorded indexes are offset by 1. 
-extern "C" Type *llvm_get_type(unsigned Index) {
+extern "C" const Type *llvm_get_type(unsigned Index) {
   if (Index == 0)
     return NULL;
   assert ((Index - 1) < LTypes.size() && "Invalid LLVM Type index");
@@ -120,10 +120,10 @@
 }
 
 #define GET_TYPE_LLVM(NODE) \
-  llvm_get_type( TYPE_CHECK (NODE)->type.symtab.llvm)
+  (const Type *)llvm_get_type( TYPE_CHECK (NODE)->type.symtab.llvm)
 
 // Erase type from LTypes vector
-static void llvmEraseLType(Type *Ty) {
+static void llvmEraseLType(const Type *Ty) {
   LTypesMapTy::iterator I = LTypesMap.find(Ty);
 
   if (I != LTypesMap.end()) {
@@ -161,7 +161,7 @@
     return;
 
   // Convert the LTypes list to a list of pointers.
-  std::vector<Type*> PTys;
+  std::vector<const Type*> PTys;
   for (unsigned i = 0, e = LTypes.size(); i != e; ++i) {
     // Cannot form pointer to void.  Use i8 as a sentinel.
     if (LTypes[i]->isVoidTy())
@@ -488,7 +488,7 @@
 //                      Main Type Conversion Routines
 //===----------------------------------------------------------------------===//
 
-Type *TypeConverter::ConvertType(tree orig_type) {
+const Type *TypeConverter::ConvertType(tree orig_type) {
   if (orig_type == error_mark_node) return Type::getInt32Ty(Context);
   
   // LLVM doesn't care about variants such as const, volatile, or restrict.
@@ -504,7 +504,7 @@
   case QUAL_UNION_TYPE:
   case UNION_TYPE:  return ConvertRECORD(type, orig_type);
   case BOOLEAN_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type))
+    if (const Type *Ty = GET_TYPE_LLVM(type))
       return Ty;
     return SET_TYPE_LLVM(type,
                      IntegerType::get(Context, TREE_INT_CST_LOW(TYPE_SIZE(type))));
@@ -513,25 +513,25 @@
     // Use of an enum that is implicitly declared?
     if (TYPE_SIZE(orig_type) == 0) {
       // If we already compiled this type, use the old type.
-      if (Type *Ty = GET_TYPE_LLVM(orig_type))
+      if (const Type *Ty = GET_TYPE_LLVM(orig_type))
         return Ty;
 
       // Just mark it as a named type for now.
-      Type *Ty = StructType::createNamed(Context, 
-                                         GetTypeName("enum.", orig_type));
+      const Type *Ty = StructType::createNamed(Context, 
+                                               GetTypeName("enum.", orig_type));
       return SET_TYPE_LLVM(orig_type, Ty);
     }
     // FALL THROUGH.
     type = orig_type;
   case INTEGER_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type)) return Ty;
+    if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
     // The ARM port defines __builtin_neon_xi as a 511-bit type because GCC's
     // type precision field has only 9 bits.  Treat this as a special case.
     int precision = TYPE_PRECISION(type) == 511 ? 512 : TYPE_PRECISION(type);
     return SET_TYPE_LLVM(type, IntegerType::get(Context, precision));
   }
   case REAL_TYPE:
-    if (Type *Ty = GET_TYPE_LLVM(type)) return Ty;
+    if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
     switch (TYPE_PRECISION(type)) {
     default:
       fprintf(stderr, "Unknown FP type!\n");
@@ -557,13 +557,13 @@
     }
     
   case COMPLEX_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type)) return Ty;
-    Type *Ty = ConvertType(TREE_TYPE(type));
+    if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
+    const Type *Ty = ConvertType(TREE_TYPE(type));
     return SET_TYPE_LLVM(type, StructType::get(Ty, Ty, NULL));
   }
   case VECTOR_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type)) return Ty;
-    Type *Ty = ConvertType(TREE_TYPE(type));
+    if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
+    const Type *Ty = ConvertType(TREE_TYPE(type));
     Ty = VectorType::get(Ty, TYPE_VECTOR_SUBPARTS(type));
     return SET_TYPE_LLVM(type, Ty);
   }
@@ -576,7 +576,7 @@
     if (RecursionStatus == CS_Struct)
       RecursionStatus = CS_StructPtr;
     
-    Type *Ty = ConvertType(TREE_TYPE(type));
+    const Type *Ty = ConvertType(TREE_TYPE(type));
     
     RecursionStatus = SavedCS;
     
@@ -587,7 +587,7 @@
    
   case METHOD_TYPE:
   case FUNCTION_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type))
+    if (const Type *Ty = GET_TYPE_LLVM(type))
       return Ty;
       
     // No declaration to pass through, passing NULL.
@@ -597,7 +597,7 @@
                                                    CallingConv, PAL));
   }
   case ARRAY_TYPE: {
-    if (Type *Ty = GET_TYPE_LLVM(type))
+    if (const Type *Ty = GET_TYPE_LLVM(type))
       return Ty;
 
     uint64_t ElementSize;
@@ -665,13 +665,13 @@
 namespace {
   class FunctionTypeConversion : public DefaultABIClient {
     const Type *&RetTy;
-    std::vector<Type*> &ArgTypes;
+    std::vector<const Type*> &ArgTypes;
     CallingConv::ID &CallingConv;
     bool isShadowRet;
     bool KNRPromotion;
     unsigned Offset;
   public:
-    FunctionTypeConversion(const Type *&retty, std::vector<Type*> &AT,
+    FunctionTypeConversion(const Type *&retty, std::vector<const Type*> &AT,
                            CallingConv::ID &CC, bool KNR)
       : RetTy(retty), ArgTypes(AT), CallingConv(CC), KNRPromotion(KNR), Offset(0) {
       CallingConv = CallingConv::C;
@@ -704,7 +704,7 @@
     }
 
     /// HandleShadowResult - Handle an aggregate or scalar shadow argument.
-    void HandleShadowResult(PointerType *PtrArgTy, bool RetPtr) {
+    void HandleShadowResult(const PointerType *PtrArgTy, bool RetPtr) {
       // This function either returns void or the shadow argument,
       // depending on the target.
       RetTy = RetPtr ? PtrArgTy : Type::getVoidTy(Context);
@@ -720,7 +720,8 @@
     /// returns an aggregate value by using a "shadow" first parameter, which is
     /// a pointer to the aggregate, of type PtrArgTy.  If RetPtr is set to true,
     /// the pointer argument itself is returned from the function.
-    void HandleAggregateShadowResult(PointerType *PtrArgTy, bool RetPtr) {
+    void HandleAggregateShadowResult(const PointerType *PtrArgTy,
+                                       bool RetPtr) {
       HandleShadowResult(PtrArgTy, RetPtr);
     }
 
@@ -728,15 +729,15 @@
     /// returns a scalar value by using a "shadow" first parameter, which is a
     /// pointer to the scalar, of type PtrArgTy.  If RetPtr is set to true,
     /// the pointer argument itself is returned from the function.
-    void HandleScalarShadowResult(PointerType *PtrArgTy, bool RetPtr) {
+    void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) {
       HandleShadowResult(PtrArgTy, RetPtr);
     }
 
-    void HandlePad(llvm::Type *LLVMTy) {
+    void HandlePad(const llvm::Type *LLVMTy) {
       HandleScalarArgument(LLVMTy, 0, 0);
     }
 
-    void HandleScalarArgument(llvm::Type *LLVMTy, tree type,
+    void HandleScalarArgument(const llvm::Type *LLVMTy, tree type,
                               unsigned RealSize = 0) {
       if (KNRPromotion) {
         if (type == float_type_node)
@@ -751,7 +752,7 @@
 
     /// HandleByInvisibleReferenceArgument - This callback is invoked if a pointer
     /// (of type PtrTy) to the argument is passed rather than the argument itself.
-    void HandleByInvisibleReferenceArgument(llvm::Type *PtrTy, tree type) {
+    void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type) {
       ArgTypes.push_back(PtrTy);
     }
 
@@ -764,7 +765,7 @@
 
     /// HandleFCAArgument - This callback is invoked if the aggregate function
     /// argument is a first class aggregate passed by value.
-    void HandleFCAArgument(llvm::Type *LLVMTy,
+    void HandleFCAArgument(const llvm::Type *LLVMTy,
                            tree type ATTRIBUTE_UNUSED) {
       ArgTypes.push_back(LLVMTy);
     }
@@ -797,7 +798,7 @@
 ConvertArgListToFnType(tree type, tree Args, tree static_chain,
                        CallingConv::ID &CallingConv, AttrListPtr &PAL) {
   tree ReturnType = TREE_TYPE(type);
-  std::vector<Type*> ArgTys;
+  std::vector<const Type*> ArgTys;
   const Type *RetTy = Type::getVoidTy(Context);
 
   FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/);
@@ -807,7 +808,7 @@
   TARGET_ADJUST_LLVM_CC(CallingConv, type);
 #endif
   
-  std::vector<Type*> ScalarArgs;
+  std::vector<const Type*> ScalarArgs;
   // Builtins are always prototyped, so this isn't one.
   ABIConverter.HandleReturnType(ReturnType, current_function_decl, false,
                                 ScalarArgs);
@@ -864,11 +865,11 @@
   return FunctionType::get(RetTy, ArgTys, false);
 }
 
-FunctionType *TypeConverter::
+const FunctionType *TypeConverter::
 ConvertFunctionType(tree type, tree decl, tree static_chain,
                     CallingConv::ID &CallingConv, AttrListPtr &PAL) {
   const Type *RetTy = Type::getVoidTy(Context);
-  std::vector<Type *> ArgTypes;
+  std::vector<const Type *> ArgTypes;
   bool isVarArg = false;
   FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/);
   DefaultABI ABIConverter(Client);
@@ -878,7 +879,7 @@
   TARGET_ADJUST_LLVM_CC(CallingConv, type);
 #endif
 
-  std::vector<Type*> ScalarArgs;
+  std::vector<const Type*> ScalarArgs;
   ABIConverter.HandleReturnType(TREE_TYPE(type), current_function_decl,
                                 decl ? DECL_BUILT_IN(decl) : false,
                                 ScalarArgs);
@@ -972,7 +973,7 @@
   for (; Args && TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)){
     tree ArgTy = TREE_VALUE(Args);
     if (!isPassedByInvisibleReference(ArgTy))
-      if (StructType *STy = dyn_cast<StructType>(ConvertType(ArgTy)))
+      if (const StructType *STy = dyn_cast<StructType>(ConvertType(ArgTy)))
         if (STy->isOpaque()) {
           // If we are passing an opaque struct by value, we don't know how many
           // arguments it will turn into.  Because we can't handle this yet,
@@ -1648,7 +1649,7 @@
       // If Field has user defined alignment and it does not match Ty alignment
       // then convert to a packed struct and try again.
       if (TYPE_USER_ALIGN(DECL_BIT_FIELD_TYPE(Field))) {
-        Type *Ty = ConvertType(getDeclaredType(Field));
+        const Type *Ty = ConvertType(getDeclaredType(Field));
         if (TYPE_ALIGN(DECL_BIT_FIELD_TYPE(Field)) !=
             8 * Info.getTypeAlignment(Ty))
           return false;
@@ -1665,7 +1666,7 @@
   assert((StartOffsetInBits & 7) == 0 && "Non-bit-field has non-byte offset!");
   uint64_t StartOffsetInBytes = StartOffsetInBits/8;
 
-  Type *Ty = ConvertType(getDeclaredType(Field));
+  const Type *Ty = ConvertType(getDeclaredType(Field));
 
   // If this field is packed then the struct may need padding fields
   // before this field.
@@ -1874,7 +1875,7 @@
         TREE_INT_CST_LOW(DECL_SIZE(Field)) == 0)
       continue;
 
-    Type *TheTy = ConvertType(TheGccTy);
+    const Type *TheTy = ConvertType(TheGccTy);
     unsigned Size  = Info.getTypeSize(TheTy);
     unsigned Align = Info.getTypeAlignment(TheTy);
 
@@ -1938,9 +1939,9 @@
 //
 // For LLVM purposes, we build a new type for B-within-D that 
 // has the correct size and layout for that usage.
-Type *TypeConverter::ConvertRECORD(tree type, tree orig_type) {
+const Type *TypeConverter::ConvertRECORD(tree type, tree orig_type) {
   bool IsStruct = TREE_CODE(type) == RECORD_TYPE;
-  if (StructType *Ty = cast_or_null<StructType>(GET_TYPE_LLVM(type))) {
+  if (const StructType *Ty = cast_or_null<StructType>(GET_TYPE_LLVM(type))) {
     // If we already compiled this type, and if it was not a forward
     // definition that is now defined, use the old type.
     if (!Ty->isOpaque() || TYPE_SIZE(type) == 0)
@@ -2059,7 +2060,7 @@
       } else {
         uint64_t FieldOffsetInBits = getFieldOffsetInBits(Field);
         tree FieldType = getDeclaredType(Field);
-        Type *FieldTy = ConvertType(FieldType);
+        const Type *FieldTy = ConvertType(FieldType);
 
         // If this is a bitfield, we may want to adjust the FieldOffsetInBits
         // to produce safe code.  In particular, bitfields will be
@@ -2100,7 +2101,7 @@
   if (IsStruct)
     RestoreOriginalFields(type);
 
-  StructType *ResultTy = cast<StructType>(GET_TYPE_LLVM(type));
+  const StructType *ResultTy = cast<StructType>(GET_TYPE_LLVM(type));
   Info->fillInLLVMType((StructType*)ResultTy);
   StructTypeInfoMap[type] = Info;
   





More information about the llvm-commits mailing list