forked from OSchip/llvm-project
Load & StoreInst no longer derive from MemAccessInst, so we don't have
to handle indexing anymore llvm-svn: 3484
This commit is contained in:
parent
62b42ce764
commit
030effa42c
|
|
@ -1638,7 +1638,7 @@ MemoryInst : MALLOC Types {
|
||||||
if (!isa<PointerType>($2->get()))
|
if (!isa<PointerType>($2->get()))
|
||||||
ThrowException("Can't load from nonpointer type: " +
|
ThrowException("Can't load from nonpointer type: " +
|
||||||
(*$2)->getDescription());
|
(*$2)->getDescription());
|
||||||
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
if (GetElementPtrInst::getIndexedType(*$2, *$4) == 0)
|
||||||
ThrowException("Invalid indices for load instruction!");
|
ThrowException("Invalid indices for load instruction!");
|
||||||
|
|
||||||
Value *Src = getVal(*$2, $3);
|
Value *Src = getVal(*$2, $3);
|
||||||
|
|
@ -1661,7 +1661,7 @@ MemoryInst : MALLOC Types {
|
||||||
if (!isa<PointerType>($4->get()))
|
if (!isa<PointerType>($4->get()))
|
||||||
ThrowException("Can't store to a nonpointer type: " +
|
ThrowException("Can't store to a nonpointer type: " +
|
||||||
(*$4)->getDescription());
|
(*$4)->getDescription());
|
||||||
const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
|
const Type *ElTy = GetElementPtrInst::getIndexedType(*$4, *$6);
|
||||||
if (ElTy == 0)
|
if (ElTy == 0)
|
||||||
ThrowException("Can't store into that field list!");
|
ThrowException("Can't store into that field list!");
|
||||||
if (ElTy != $2->getType())
|
if (ElTy != $2->getType())
|
||||||
|
|
|
||||||
|
|
@ -847,10 +847,8 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
||||||
} else { // Performing array indexing. Just skip the 0
|
} else { // Performing array indexing. Just skip the 0
|
||||||
++I;
|
++I;
|
||||||
}
|
}
|
||||||
} else if (HasImplicitAddress) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; I != E; ++I)
|
for (; I != E; ++I)
|
||||||
if ((*I)->getType() == Type::UIntTy) {
|
if ((*I)->getType() == Type::UIntTy) {
|
||||||
Out << "[";
|
Out << "[";
|
||||||
|
|
@ -862,11 +860,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWriter::visitLoadInst(LoadInst &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) {
|
void CWriter::visitStoreInst(StoreInst &I) {
|
||||||
printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
|
Out << "*";
|
||||||
|
writeOperand(I.getPointerOperand());
|
||||||
Out << " = ";
|
Out << " = ";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue