summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorGraham Hunter <graham.hunter@arm.com>2019-05-29 12:22:54 +0000
committerGraham Hunter <graham.hunter@arm.com>2019-05-29 12:22:54 +0000
commitf4fc01f8dd3a5dfd2060d1ad0df6b90e8351ddf7 (patch)
tree56875bf42be9322f947178d01385a813ea566f46 /llvm/lib/AsmParser
parent4c5a0d1683e1bc5d0e12de8806b37ffbdc8c5904 (diff)
downloadbcm5719-llvm-f4fc01f8dd3a5dfd2060d1ad0df6b90e8351ddf7.tar.gz
bcm5719-llvm-f4fc01f8dd3a5dfd2060d1ad0df6b90e8351ddf7.zip
[SVE][IR] Scalable Vector IR Type
* Adds a 'scalable' flag to VectorType * Adds an 'ElementCount' class to VectorType to pass (possibly scalable) vector lengths, with overloaded operators. * Modifies existing helper functions to use ElementCount * Adds support for serializing/deserializing to/from both textual and bitcode IR formats * Extends the verifier to reject global variables of scalable types * Updates documentation See the latest version of the RFC here: http://lists.llvm.org/pipermail/llvm-dev/2018-July/124396.html Reviewers: rengolin, lattner, echristo, chandlerc, hfinkel, rkruppe, samparker, SjoerdMeijer, greened, sebpop Reviewed By: hfinkel, sebpop Differential Revision: https://reviews.llvm.org/D32530 llvm-svn: 361953
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp1
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp13
-rw-r--r--llvm/lib/AsmParser/LLToken.h1
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 28a8480e7d3..95646675cb2 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -2721,7 +2721,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");
@@ -2748,7 +2759,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,
OpenPOWER on IntegriCloud