diff options
author | Chris Lattner <sabre@nondot.org> | 2002-09-11 01:17:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-09-11 01:17:27 +0000 |
commit | 0235fe2b72af319a54c893887732b81df4c59906 (patch) | |
tree | 2a7c184510ca132222b71229b8388bc83d4b5d3d /lib | |
parent | dbd35c22e47364343bc8672f2ace63539a476a37 (diff) | |
download | external_llvm-0235fe2b72af319a54c893887732b81df4c59906.zip external_llvm-0235fe2b72af319a54c893887732b81df4c59906.tar.gz external_llvm-0235fe2b72af319a54c893887732b81df4c59906.tar.bz2 |
Recently changed getelementptr to use 'long' indexes for sequential types
instead of uints. This adds a translation scheme to be backwards compatible
with old .ll files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ee74367..34929c0 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1705,6 +1705,16 @@ MemoryInst : MALLOC Types { delete $4; delete $6; } | GETELEMENTPTR Types ValueRef IndexList { + for (unsigned i = 0, e = $4->size(); i != e; ++i) { + if ((*$4)[i]->getType() == Type::UIntTy) { + std::cerr << "WARNING: Use of uint type indexes to getelementptr " + << "instruction: replacing with casts to long type.\n"; + Instruction *I = new CastInst((*$4)[i], Type::LongTy); + CurBB->getInstList().push_back(I); + (*$4)[i] = I; + } + } + if (!isa<PointerType>($2->get())) ThrowException("getelementptr insn requires pointer operand!"); if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) |