[MIRParser] Add parser support for 'true' and 'false' i1s.

We already output true and false in the printer, but the parser isn't able to
read it.

Differential Revision: https://reviews.llvm.org/D47424

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Amara Emerson
2018-06-05 00:17:13 +00:00
parent 9d75364cfa
commit b86b9032fd
2 changed files with 16 additions and 2 deletions
+5 -2
View File
@@ -1373,8 +1373,11 @@ bool MIParser::parseTypedImmediateOperand(MachineOperand &Dest) {
auto Loc = Token.location();
lex();
if (Token.isNot(MIToken::IntegerLiteral))
return error("expected an integer literal");
if (Token.isNot(MIToken::IntegerLiteral)) {
if (Token.isNot(MIToken::Identifier) ||
!(Token.range() == "true" || Token.range() == "false"))
return error("expected an integer literal");
}
const Constant *C = nullptr;
if (parseIRConstant(Loc, C))
return true;
@@ -0,0 +1,11 @@
# RUN: llc -run-pass none -o - %s | FileCheck %s
# Parse an i1 being a 'true' or 'false'
---
name: i1_true_false
body: |
bb.0:
; CHECK: %0:_(s1) = G_CONSTANT i1 true
; CHECK: %1:_(s1) = G_CONSTANT i1 false
%0:_(s1) = G_CONSTANT i1 true
%1:_(s1) = G_CONSTANT i1 false
...