summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-06 18:26:36 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-06 18:26:36 +0000
commite86d51533d43a6d73692ddb16a061af263912ae5 (patch)
treebdb0a5557dd3ba1c198e4c86ccbd1bdb60ad1067 /llvm/lib/CodeGen
parentec105872056880da9689cfffdb296e32ca1ba876 (diff)
downloadbcm5719-llvm-e86d51533d43a6d73692ddb16a061af263912ae5.tar.gz
bcm5719-llvm-e86d51533d43a6d73692ddb16a061af263912ae5.zip
MIR Parser: Report an error when parsing duplicate memory operand flags.
llvm-svn: 244240
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 36460b3f3eb..f8a6200cc67 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1059,6 +1059,7 @@ bool MIParser::getUint64(uint64_t &Result) {
}
bool MIParser::parseMemoryOperandFlag(unsigned &Flags) {
+ const unsigned OldFlags = Flags;
switch (Token.kind()) {
case MIToken::kw_volatile:
Flags |= MachineMemOperand::MOVolatile;
@@ -1069,11 +1070,14 @@ bool MIParser::parseMemoryOperandFlag(unsigned &Flags) {
case MIToken::kw_invariant:
Flags |= MachineMemOperand::MOInvariant;
break;
- // TODO: report an error when we specify the same flag more than once.
// TODO: parse the target specific memory operand flags.
default:
llvm_unreachable("The current token should be a memory operand flag");
}
+ if (OldFlags == Flags)
+ // We know that the same flag is specified more than once when the flags
+ // weren't modified.
+ return error("duplicate '" + Token.stringValue() + "' memory operand flag");
lex();
return false;
}
OpenPOWER on IntegriCloud