summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-11-11 21:57:16 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-11-11 21:57:16 +0000
commitf0f224d12dc474c144b1a1c1b6864ecc0b768a24 (patch)
tree45d1ac7149f0a42417cb1491b9c3d3dda344e941 /llvm/lib/AsmParser/LLParser.cpp
parent77f211c1aa2760cdf5f6f72cc490e95f6d0519d6 (diff)
downloadbcm5719-llvm-f0f224d12dc474c144b1a1c1b6864ecc0b768a24.tar.gz
bcm5719-llvm-f0f224d12dc474c144b1a1c1b6864ecc0b768a24.zip
[IR] Add support for empty tokens
When working with tokens, it is often the case that one has instructions which consume a token and produce a new token. Currently, we have no mechanism to represent an initial token state. Instead, we can create a notional "empty token" by inventing a new constant which captures the semantics we would like. This new constant is called ConstantTokenNone and is written textually as "token none". Differential Revision: http://reviews.llvm.org/D14581 llvm-svn: 252811
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index aabd9716118..2c6e8081c13 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -2622,6 +2622,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
case lltok::kw_null: ID.Kind = ValID::t_Null; break;
case lltok::kw_undef: ID.Kind = ValID::t_Undef; break;
case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
+ case lltok::kw_none: ID.Kind = ValID::t_None; break;
case lltok::lbrace: {
// ValID ::= '{' ConstVector '}'
@@ -4255,6 +4256,11 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
return Error(ID.Loc, "invalid type for null constant");
V = Constant::getNullValue(Ty);
return false;
+ case ValID::t_None:
+ if (!Ty->isTokenTy())
+ return Error(ID.Loc, "invalid type for none constant");
+ V = Constant::getNullValue(Ty);
+ return false;
case ValID::t_Constant:
if (ID.ConstantVal->getType() != Ty)
return Error(ID.Loc, "constant expression type mismatch");
OpenPOWER on IntegriCloud