diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-11-28 18:57:02 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-11-28 18:57:02 +0000 |
commit | 17d277b7346b6cfcd236e5c12a34f25cf7c72a73 (patch) | |
tree | 6d6418ce9193cad0dc6b4f8b5d2223a9bde30587 /llvm/lib/CodeGen/MIRParser/MIParser.cpp | |
parent | 50e6e545872366dc68e005320564a67a68ecdc33 (diff) | |
download | bcm5719-llvm-17d277b7346b6cfcd236e5c12a34f25cf7c72a73.tar.gz bcm5719-llvm-17d277b7346b6cfcd236e5c12a34f25cf7c72a73.zip |
[mir] Print/Parse both MOLoad and MOStore when they occur together.
Summary:
They're not always mutually exclusive. read-modify-write atomics are both
at the same time. One example of this is the SWP instructions on AArch64.
Another example is GlobalISel's G_ATOMICRMW_* generic instructions which
will be added in a later patch.
Reviewers: arphaman, aemerson
Reviewed By: aemerson
Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D40157
llvm-svn: 319202
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MIParser.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 10dbaf7045e..9b5539a7ca7 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -2280,6 +2280,12 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) { Flags |= MachineMemOperand::MOStore; lex(); + // Optional 'store' for operands that both load and store. + if (Token.is(MIToken::Identifier) && Token.stringValue() == "store") { + Flags |= MachineMemOperand::MOStore; + lex(); + } + // Optional synchronization scope. SyncScope::ID SSID; if (parseOptionalScope(MF.getFunction()->getContext(), SSID)) @@ -2302,7 +2308,11 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) { MachinePointerInfo Ptr = MachinePointerInfo(); if (Token.is(MIToken::Identifier)) { - const char *Word = Flags & MachineMemOperand::MOLoad ? "from" : "into"; + const char *Word = + ((Flags & MachineMemOperand::MOLoad) && + (Flags & MachineMemOperand::MOStore)) + ? "on" + : Flags & MachineMemOperand::MOLoad ? "from" : "into"; if (Token.stringValue() != Word) return error(Twine("expected '") + Word + "'"); lex(); |