mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[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:
@@ -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
|
||||
...
|
||||
Reference in New Issue
Block a user