diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-05 19:15:41 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-05 19:15:41 +0000 |
commit | c6e956e972878e471a4bef21a39d12edf84bd8a3 (patch) | |
tree | fa01987d35db2dd57da179e7fc3d9795df84d688 /lib | |
parent | 7858b336f23405a96ee25de1b9071aeaf270bd77 (diff) |
Remove various old upgrade hacks that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 6ae9ceb3f9..6606b3a103 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1629,17 +1629,6 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' { 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 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' { 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 @@ MemoryInst : MALLOC Types OptCAlign { 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()+ "'!"); |