Implement CodeGen/CBackend/2005-02-14-VolatileOperations.ll

Volatile loads and stores need to emit volatile pointer operations in C.

llvm-svn: 20177
This commit is contained in:
Chris Lattner 2005-02-14 16:47:52 +00:00
parent 907f3d8b67
commit ef836a918e

View File

@ -1655,12 +1655,27 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
void CWriter::visitLoadInst(LoadInst &I) {
Out << "*";
if (I.isVolatile()) {
Out << "((volatile ";
printType(Out, I.getOperand(0)->getType());
Out << ")";
}
writeOperand(I.getOperand(0));
if (I.isVolatile())
Out << ")";
}
void CWriter::visitStoreInst(StoreInst &I) {
Out << "*";
if (I.isVolatile()) {
Out << "((volatile ";
printType(Out, I.getPointerOperand()->getType());
Out << ")";
}
writeOperand(I.getPointerOperand());
if (I.isVolatile()) Out << ")";
Out << " = ";
writeOperand(I.getOperand(0));
}