[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp iMemory.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 8 12:47:02 PDT 2003


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.97 -> 1.98
iMemory.cpp updated: 1.30 -> 1.31

---
Log message:

Add support for volatile loads/stores


---
Diffs of the changes:

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.97 llvm/lib/VMCore/AsmWriter.cpp:1.98
--- llvm/lib/VMCore/AsmWriter.cpp:1.97	Wed Sep  3 12:56:43 2003
+++ llvm/lib/VMCore/AsmWriter.cpp	Mon Sep  8 12:45:57 2003
@@ -771,6 +771,11 @@
   if (I.hasName())
     Out << getLLVMName(I.getName()) << " = ";
 
+  // If this is a volatile load or store, print out the volatile marker
+  if ((isa<LoadInst>(I)  && cast<LoadInst>(I).isVolatile()) ||
+      (isa<StoreInst>(I) && cast<StoreInst>(I).isVolatile()))
+      Out << "volatile ";
+
   // Print out the opcode...
   Out << I.getOpcodeName();
 


Index: llvm/lib/VMCore/iMemory.cpp
diff -u llvm/lib/VMCore/iMemory.cpp:1.30 llvm/lib/VMCore/iMemory.cpp:1.31
--- llvm/lib/VMCore/iMemory.cpp:1.30	Tue Sep  2 01:45:34 2003
+++ llvm/lib/VMCore/iMemory.cpp	Mon Sep  8 12:45:57 2003
@@ -1,4 +1,4 @@
-//===-- iMemory.cpp - Implement Memory instructions --------------*- C++ -*--=//
+//===-- iMemory.cpp - Implement Memory instructions -----------------------===//
 //
 // This file implements the various memory related classes defined in iMemory.h
 //
@@ -58,18 +58,34 @@
 
 LoadInst::LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBef)
   : Instruction(cast<PointerType>(Ptr->getType())->getElementType(),
-                Load, Name, InsertBef) {
+                Load, Name, InsertBef), Volatile(false) {
   Operands.reserve(1);
   Operands.push_back(Use(Ptr, this));
 }
 
+LoadInst::LoadInst(Value *Ptr, const std::string &Name, bool isVolatile,
+                   Instruction *InsertBef)
+  : Instruction(cast<PointerType>(Ptr->getType())->getElementType(),
+                Load, Name, InsertBef), Volatile(isVolatile) {
+  Operands.reserve(1);
+  Operands.push_back(Use(Ptr, this));
+}
 
 //===----------------------------------------------------------------------===//
 //                           StoreInst Implementation
 //===----------------------------------------------------------------------===//
 
 StoreInst::StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore)
-  : Instruction(Type::VoidTy, Store, "", InsertBefore) {
+  : Instruction(Type::VoidTy, Store, "", InsertBefore), Volatile(false) {
+  
+  Operands.reserve(2);
+  Operands.push_back(Use(Val, this));
+  Operands.push_back(Use(Ptr, this));
+}
+
+StoreInst::StoreInst(Value *Val, Value *Ptr, bool isVolatile, 
+                     Instruction *InsertBefore)
+  : Instruction(Type::VoidTy, Store, "", InsertBefore), Volatile(isVolatile) {
   
   Operands.reserve(2);
   Operands.push_back(Use(Val, this));





More information about the llvm-commits mailing list