[TRITON][LANG] Added support for bitcast

This commit is contained in:
Philippe Tillet
2020-02-09 20:09:27 -05:00
committed by Philippe Tillet
parent 7a40077bfd
commit d22cf4f717
8 changed files with 42 additions and 3 deletions

View File

@@ -664,6 +664,17 @@ QualType Parser::ParseTypeName() {
Expr* Parser::ParseCastExpr() {
auto tok = ts_.Next();
// bitcast
if (tok->tag_ == Token::BITCAST) {
ts_.Expect('<');
auto type = ParseTypeName();
ts_.Expect('>');
ts_.Expect('(');
auto operand = ParseExpr();
ts_.Expect(')');
return UnaryOp::New(Token::BITCAST, operand, type);
}
// semantic cast
if (tok->tag_ == '(' && IsTypeName(ts_.Peek())) {
auto type = ParseTypeName();
ts_.Expect(')');