From 03e692a51b14e6c11772789e238c3fd2cfd6b0a3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 20 Oct 2001 09:32:59 +0000 Subject: [PATCH] Add support for And, XOR, and Or llvm-svn: 924 --- lib/AsmParser/Lexer.l | 3 +++ lib/AsmParser/llvmAsmParser.y | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 5bbe672882a..e9996b28295 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -162,6 +162,9 @@ sub { RET_TOK(BinaryOpVal, Sub, SUB); } mul { RET_TOK(BinaryOpVal, Mul, MUL); } div { RET_TOK(BinaryOpVal, Div, DIV); } rem { RET_TOK(BinaryOpVal, Rem, REM); } +and { RET_TOK(BinaryOpVal, And, AND); } +or { RET_TOK(BinaryOpVal, Or , OR ); } +xor { RET_TOK(BinaryOpVal, Xor, XOR); } setne { RET_TOK(BinaryOpVal, SetNE, SETNE); } seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); } diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index e5fad6c1865..128d4797758 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -195,6 +195,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { // Check that the number is within bounds... if (Num <= CurMeth.Types.size()) return CurMeth.Types[Num]; + break; } case 1: { // Is it a named definition? string Name(D.Name); @@ -716,7 +717,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) { // Binary Operators %type BinaryOps // all the binary operators -%token ADD SUB MUL DIV REM +%token ADD SUB MUL DIV REM AND OR XOR %token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators // Memory Instructions @@ -751,7 +752,7 @@ EINT64VAL : EUINT64VAL { // RET, BR, & SWITCH because they end basic blocks and are treated specially. // UnaryOps : NOT -BinaryOps : ADD | SUB | MUL | DIV | REM +BinaryOps : ADD | SUB | MUL | DIV | REM | AND | OR | XOR BinaryOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE ShiftOps : SHL | SHR