[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Reid Spencer reid at x10sys.com
Tue Dec 5 11:15:56 PST 2006



Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.284 -> 1.285
---
Log message:

Remove various old upgrade hacks that are no longer needed.


---
Diffs of the changes:  (+1 -41)

 llvmAsmParser.y |   42 +-----------------------------------------
 1 files changed, 1 insertion(+), 41 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.284 llvm/lib/AsmParser/llvmAsmParser.y:1.285
--- llvm/lib/AsmParser/llvmAsmParser.y:1.284	Sun Dec  3 23:20:06 2006
+++ llvm/lib/AsmParser/llvmAsmParser.y	Tue Dec  5 13:15:41 2006
@@ -1629,17 +1629,6 @@
     if (!isa<PointerType>($3->getType()))
       GEN_ERROR("GetElementPtr requires a pointer operand!");
 
-    // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
-    // indices to uint struct indices for compatibility.
-    generic_gep_type_iterator<std::vector<Value*>::iterator>
-      GTI = gep_type_begin($3->getType(), $4->begin(), $4->end()),
-      GTE = gep_type_end($3->getType(), $4->begin(), $4->end());
-    for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI)
-      if (isa<StructType>(*GTI))        // Only change struct indices
-        if (ConstantInt *CUI = dyn_cast<ConstantInt>((*$4)[i]))
-          if (CUI->getType() == Type::UByteTy)
-            (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
-
     const Type *IdxTy =
       GetElementPtrInst::getIndexedType($3->getType(), *$4, true);
     if (!IdxTy)
@@ -1669,25 +1658,7 @@
     if ($3->getType() != $5->getType())
       GEN_ERROR("Binary operator types must match!");
     CHECK_FOR_ERROR;
-
-    // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
-    // To retain backward compatibility with these early compilers, we emit a
-    // cast to the appropriate integer type automatically if we are in the
-    // broken case.  See PR424 for more information.
-    if (!isa<PointerType>($3->getType())) {
-      $$ = ConstantExpr::get($1, $3, $5);
-    } else {
-      const Type *IntPtrTy = 0;
-      switch (CurModule.CurrentModule->getPointerSize()) {
-      case Module::Pointer32: IntPtrTy = Type::IntTy; break;
-      case Module::Pointer64: IntPtrTy = Type::LongTy; break;
-      default: GEN_ERROR("invalid pointer binary constant expr!");
-      }
-      $$ = ConstantExpr::get($1, ConstantExpr::getCast($3, IntPtrTy),
-                             ConstantExpr::getCast($5, IntPtrTy));
-      $$ = ConstantExpr::getCast($$, $3->getType());
-    }
-    CHECK_FOR_ERROR
+    $$ = ConstantExpr::get($1, $3, $5);
   }
   | LogicalOps '(' ConstVal ',' ConstVal ')' {
     if ($3->getType() != $5->getType())
@@ -2800,17 +2771,6 @@
     if (!isa<PointerType>($2->get()))
       GEN_ERROR("getelementptr insn requires pointer operand!");
 
-    // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
-    // indices to uint struct indices for compatibility.
-    generic_gep_type_iterator<std::vector<Value*>::iterator>
-      GTI = gep_type_begin($2->get(), $4->begin(), $4->end()),
-      GTE = gep_type_end($2->get(), $4->begin(), $4->end());
-    for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI)
-      if (isa<StructType>(*GTI))        // Only change struct indices
-        if (ConstantInt *CUI = dyn_cast<ConstantInt>((*$4)[i]))
-          if (CUI->getType() == Type::UByteTy)
-            (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
-
     if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))
       GEN_ERROR("Invalid getelementptr indices for type '" +
                      (*$2)->getDescription()+ "'!");






More information about the llvm-commits mailing list