summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Verifier.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-08-09 23:02:53 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-08-09 23:02:53 +0000
commit59b66883eacbc62a09c09f08bcbfdce7af46cf31 (patch)
tree94bf465b6c6ec54c89d295d0422be1d6cc3613c6 /llvm/lib/VMCore/Verifier.cpp
parente95fcf7860d7de015a4fd2b41eb785340c32f875 (diff)
downloadbcm5719-llvm-59b66883eacbc62a09c09f08bcbfdce7af46cf31.tar.gz
bcm5719-llvm-59b66883eacbc62a09c09f08bcbfdce7af46cf31.zip
Representation of 'atomic load' and 'atomic store' in IR.
llvm-svn: 137170
Diffstat (limited to 'llvm/lib/VMCore/Verifier.cpp')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index ffb92a7d051..415c85e142d 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -1297,6 +1297,15 @@ void Verifier::visitLoadInst(LoadInst &LI) {
Type *ElTy = PTy->getElementType();
Assert2(ElTy == LI.getType(),
"Load result type does not match pointer operand type!", &LI, ElTy);
+ if (LI.isAtomic()) {
+ Assert1(LI.getOrdering() != Release && LI.getOrdering() != AcquireRelease,
+ "Load cannot have Release ordering", &LI);
+ Assert1(LI.getAlignment() != 0,
+ "Atomic load must specify explicit alignment", &LI);
+ } else {
+ Assert1(LI.getSynchScope() == CrossThread,
+ "Non-atomic load cannot have SynchronizationScope specified", &LI);
+ }
visitInstruction(LI);
}
@@ -1307,6 +1316,15 @@ void Verifier::visitStoreInst(StoreInst &SI) {
Assert2(ElTy == SI.getOperand(0)->getType(),
"Stored value type does not match pointer operand type!",
&SI, ElTy);
+ if (SI.isAtomic()) {
+ Assert1(SI.getOrdering() != Acquire && SI.getOrdering() != AcquireRelease,
+ "Store cannot have Acquire ordering", &SI);
+ Assert1(SI.getAlignment() != 0,
+ "Atomic store must specify explicit alignment", &SI);
+ } else {
+ Assert1(SI.getSynchScope() == CrossThread,
+ "Non-atomic store cannot have SynchronizationScope specified", &SI);
+ }
visitInstruction(SI);
}
OpenPOWER on IntegriCloud