aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-14 16:47:52 +0000
committerChris Lattner <sabre@nondot.org>2005-02-14 16:47:52 +0000
commit9d30e22da0d6e59cab0813899adaf9e7c109cf5d (patch)
treecf93603d7bd7c574282de51077097634a4542e7b /lib/Target/CBackend/CBackend.cpp
parentee6cfda17cbecc23ffe03739ed5946c30561570d (diff)
Implement CodeGen/CBackend/2005-02-14-VolatileOperations.ll
Volatile loads and stores need to emit volatile pointer operations in C. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index cb831ae5d5..adac8e2f33 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -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));
}