Load & StoreInst no longer derive from MemAccessInst, so we don't have

to handle indexing anymore

llvm-svn: 3484
This commit is contained in:
Chris Lattner 2002-08-22 22:48:55 +00:00
parent 62b42ce764
commit 030effa42c
2 changed files with 7 additions and 7 deletions

View File

@ -1638,7 +1638,7 @@ MemoryInst : MALLOC Types {
if (!isa<PointerType>($2->get()))
ThrowException("Can't load from nonpointer type: " +
(*$2)->getDescription());
if (LoadInst::getIndexedType(*$2, *$4) == 0)
if (GetElementPtrInst::getIndexedType(*$2, *$4) == 0)
ThrowException("Invalid indices for load instruction!");
Value *Src = getVal(*$2, $3);
@ -1661,7 +1661,7 @@ MemoryInst : MALLOC Types {
if (!isa<PointerType>($4->get()))
ThrowException("Can't store to a nonpointer type: " +
(*$4)->getDescription());
const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
const Type *ElTy = GetElementPtrInst::getIndexedType(*$4, *$6);
if (ElTy == 0)
ThrowException("Can't store into that field list!");
if (ElTy != $2->getType())

View File

@ -847,10 +847,8 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
} else { // Performing array indexing. Just skip the 0
++I;
}
} else if (HasImplicitAddress) {
}
for (; I != E; ++I)
if ((*I)->getType() == Type::UIntTy) {
Out << "[";
@ -862,11 +860,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
}
void CWriter::visitLoadInst(LoadInst &I) {
printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
Out << "*";
writeOperand(I.getOperand(0));
}
void CWriter::visitStoreInst(StoreInst &I) {
printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
Out << "*";
writeOperand(I.getPointerOperand());
Out << " = ";
writeOperand(I.getOperand(0));
}