Index: src/IceInstX8632.h |
diff --git a/src/IceInstX8632.h b/src/IceInstX8632.h |
index ed4924f135783200490d2421ca95122858775bf2..cfb2f66ce56adfb579c619c61dd39a89781a98ab 100644 |
--- a/src/IceInstX8632.h |
+++ b/src/IceInstX8632.h |
@@ -1031,6 +1031,26 @@ protected: |
// with optimizations. |
HasSideEffects = Locked; |
} |
+ // emitPrefix() and emitSuffix() are a workaround for an apparent |
+ // llvm-mc bug in which "lock" is considered a separate instruction |
+ // and may be placed in a different bundle from the instruction |
+ // being locked, e.g.: |
+ // 1e: lock nop |
+ // 20: cmpxchg ... |
jvoung (off chromium)
2015/02/23 17:58:36
Weird, I thought it would have been fixed by:
htt
Jim Stichnoth
2015/02/23 21:38:19
Aha! The szbuild.py was running llvm-mc with just
|
+ // The workaround is to emit an explicit bundle_lock/bundle_unlock |
+ // for instructions with a lock prefix. |
+ void emitPrefix(Ostream &Str) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ if (Locked) |
+ Str << "\t.bundle_lock\n"; |
+ } |
+ void emitSuffix(Ostream &Str) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ if (Locked) |
+ Str << "\n\t.bundle_unlock"; |
+ } |
~InstX8632Lockable() override {} |
}; |