summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-08 17:45:59 +0000
committerChris Lattner <sabre@nondot.org>2003-09-08 17:45:59 +0000
commit504f9242c340c326fab4bba00c6d201840dc2c54 (patch)
tree0c5ac58e41a23f47bd117009658a5a7de8fb2e1c /llvm/lib
parent6c0497da747936d2771a201ebb664a051debda8f (diff)
downloadbcm5719-llvm-504f9242c340c326fab4bba00c6d201840dc2c54.tar.gz
bcm5719-llvm-504f9242c340c326fab4bba00c6d201840dc2c54.zip
Add support for volatile loads/stores
llvm-svn: 8393
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp5
-rw-r--r--llvm/lib/VMCore/iMemory.cpp22
2 files changed, 24 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index b9b2e8fe9e7..f849fe1cd90 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -771,6 +771,11 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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();
diff --git a/llvm/lib/VMCore/iMemory.cpp b/llvm/lib/VMCore/iMemory.cpp
index 559c15efe12..68a628bcb9b 100644
--- a/llvm/lib/VMCore/iMemory.cpp
+++ b/llvm/lib/VMCore/iMemory.cpp
@@ -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 @@ FreeInst::FreeInst(Value *Ptr, Instruction *InsertBefore)
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));
OpenPOWER on IntegriCloud