diff options
| author | Graham Hunter <graham.hunter@arm.com> | 2019-06-18 10:11:56 +0000 |
|---|---|---|
| committer | Graham Hunter <graham.hunter@arm.com> | 2019-06-18 10:11:56 +0000 |
| commit | 43854e3ccc7fb9fa2cbe37529a72f77ca512bb86 (patch) | |
| tree | 3d8e9fffe51fc8b98b23a09d22a7070b339c9672 /llvm/lib/AsmParser | |
| parent | 6658bfb171afa65ca11bd729fcc0301d5d09543e (diff) | |
| download | bcm5719-llvm-43854e3ccc7fb9fa2cbe37529a72f77ca512bb86.tar.gz bcm5719-llvm-43854e3ccc7fb9fa2cbe37529a72f77ca512bb86.zip | |
[SVE][IR] Scalable Vector IR Type with pr42210 fix
Recommit of D32530 with a few small changes:
- Stopped recursively walking through aggregates in
the verifier, so that we don't impose too much
overhead on large modules under LTO (see PR42210).
- Changed tests to match; the errors are slightly
different since they only report the array or
struct that actually contains a scalable vector,
rather than all aggregates which contain one in
a nested member.
- Corrected an older comment
Reviewers: thakis, rengolin, sdesmalen
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D63321
llvm-svn: 363658
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/LLLexer.cpp | 1 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/LLToken.h | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index dc8ff7f1315..a9099711be4 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -707,6 +707,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(xchg); KEYWORD(nand); KEYWORD(max); KEYWORD(min); KEYWORD(umax); KEYWORD(umin); + KEYWORD(vscale); KEYWORD(x); KEYWORD(blockaddress); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index b6f982bc3fb..0a9a09e644d 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2743,7 +2743,18 @@ bool LLParser::ParseStructBody(SmallVectorImpl<Type*> &Body) { /// Type /// ::= '[' APSINTVAL 'x' Types ']' /// ::= '<' APSINTVAL 'x' Types '>' +/// ::= '<' 'vscale' 'x' APSINTVAL 'x' Types '>' bool LLParser::ParseArrayVectorType(Type *&Result, bool isVector) { + bool Scalable = false; + + if (isVector && Lex.getKind() == lltok::kw_vscale) { + Lex.Lex(); // consume the 'vscale' + if (ParseToken(lltok::kw_x, "expected 'x' after vscale")) + return true; + + Scalable = true; + } + if (Lex.getKind() != lltok::APSInt || Lex.getAPSIntVal().isSigned() || Lex.getAPSIntVal().getBitWidth() > 64) return TokError("expected number in address space"); @@ -2770,7 +2781,7 @@ bool LLParser::ParseArrayVectorType(Type *&Result, bool isVector) { return Error(SizeLoc, "size too large for vector"); if (!VectorType::isValidElementType(EltTy)) return Error(TypeLoc, "invalid vector element type"); - Result = VectorType::get(EltTy, unsigned(Size)); + Result = VectorType::get(EltTy, unsigned(Size), Scalable); } else { if (!ArrayType::isValidElementType(EltTy)) return Error(TypeLoc, "invalid array element type"); diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h index a1e70932178..6256c14b9d6 100644 --- a/llvm/lib/AsmParser/LLToken.h +++ b/llvm/lib/AsmParser/LLToken.h @@ -37,6 +37,7 @@ enum Kind { bar, // | colon, // : + kw_vscale, kw_x, kw_true, kw_false, |

