[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 14 08:48:04 PST 2005



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.220 -> 1.221
---
Log message:

Implement CodeGen/CBackend/2005-02-14-VolatileOperations.ll
Volatile loads and stores need to emit volatile pointer operations in C.


---
Diffs of the changes:  (+15 -0)

 Writer.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.220 llvm/lib/Target/CBackend/Writer.cpp:1.221
--- llvm/lib/Target/CBackend/Writer.cpp:1.220	Mon Jan 31 00:19:57 2005
+++ llvm/lib/Target/CBackend/Writer.cpp	Mon Feb 14 10:47:52 2005
@@ -1655,12 +1655,27 @@
 
 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));
 }






More information about the llvm-commits mailing list