mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
For PR797:
Rid the Assembly Parser of exceptions. This is a really gross hack but it will do until the Assembly Parser is re-written as a recursive descent. The basic premise is that wherever the old "ThrowException" function was called (new name: GenerateError) we set a flag (TriggerError). Every production checks that flag and calls YYERROR if it is set. Additionally, each call to ThrowException in the grammar is replaced with GEN_ERROR which calls GenerateError and then YYERROR immediately. This prevents the remaining production from continuing after an error condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fd90dd5d55
commit
61c83e023f
@ -19,30 +19,45 @@
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
class ParseException;
|
||||
class ParseError;
|
||||
|
||||
|
||||
// The useful interface defined by this file... Parse an ascii file, and return
|
||||
// the internal representation in a nice slice'n'dice'able representation. Note
|
||||
// that this does not verify that the generated LLVM is valid, so you should run
|
||||
// the verifier after parsing the file to check that it's ok.
|
||||
//
|
||||
Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException)
|
||||
Module *ParseAssemblyString(const char * AsmString, Module * M);// throw (ParseException)
|
||||
/// This function is the main interface to the LLVM Assembly Parse. It parses
|
||||
/// an ascii file that (presumably) contains LLVM Assembly code. It returns a
|
||||
/// Module (intermediate representation) with the corresponding features. Note
|
||||
/// that this does not verify that the generated Module is valid, so you should
|
||||
/// run the verifier after parsing the file to check that it is okay.
|
||||
/// @brief Parse LLVM Assembly from a file
|
||||
Module *ParseAssemblyFile(
|
||||
const std::string &Filename, ///< The name of the file to parse
|
||||
ParseError* Error = 0 ///< If not null, an object to return errors in.
|
||||
);
|
||||
|
||||
/// The function is a secondary interface to the LLVM Assembly Parse. It parses
|
||||
/// an ascii string that (presumably) contains LLVM Assembly code. It returns a
|
||||
/// Module (intermediate representation) with the corresponding features. Note
|
||||
/// that this does not verify that the generated Module is valid, so you should
|
||||
/// run the verifier after parsing the file to check that it is okay.
|
||||
/// @brief Parse LLVM Assembly from a string
|
||||
Module *ParseAssemblyString(
|
||||
const char * AsmString, ///< The string containing assembly
|
||||
Module * M, ///< A module to add the assembly too.
|
||||
ParseError* Error = 0 ///< If not null, an object to return errors in.
|
||||
);
|
||||
|
||||
//===------------------------------------------------------------------------===
|
||||
// Helper Classes
|
||||
//===------------------------------------------------------------------------===
|
||||
|
||||
// ParseException - For when an exceptional event is generated by the parser.
|
||||
// This class lets you print out the exception message
|
||||
//
|
||||
class ParseException {
|
||||
/// An instance of this class can be passed to ParseAssemblyFile or
|
||||
/// ParseAssemblyString functions in order to capture error information from
|
||||
/// the parser. It provides a standard way to print out the error message
|
||||
/// including the file name and line number where the error occurred.
|
||||
/// @brief An LLVM Assembly Parsing Error Object
|
||||
class ParseError {
|
||||
public:
|
||||
ParseException(const std::string &filename, const std::string &message,
|
||||
int LineNo = -1, int ColNo = -1);
|
||||
|
||||
ParseException(const ParseException &E);
|
||||
ParseError() : Filename("unknown"), Message("none"), LineNo(0), ColumnNo(0) {}
|
||||
ParseError(const ParseError &E);
|
||||
|
||||
// getMessage - Return the message passed in at construction time plus extra
|
||||
// information extracted from the options used to parse with...
|
||||
@ -57,6 +72,9 @@ public:
|
||||
return Filename;
|
||||
}
|
||||
|
||||
void setError(const std::string &filename, const std::string &message,
|
||||
int LineNo = -1, int ColNo = -1);
|
||||
|
||||
// getErrorLocation - Return the line and column number of the error in the
|
||||
// input source file. The source filename can be derived from the
|
||||
// ParserOptions in effect. If positional information is not applicable,
|
||||
@ -71,7 +89,7 @@ private :
|
||||
std::string Message;
|
||||
int LineNo, ColumnNo; // -1 if not relevant
|
||||
|
||||
ParseException &operator=(const ParseException &E); // objects by reference
|
||||
ParseError &operator=(const ParseError &E); // objects by reference
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define yylineno llvmAsmlineno
|
||||
|
||||
#line 20 "Lexer.cpp"
|
||||
/* A lexical scanner generated by flex */
|
||||
/* A lexical scanner generated by flex*/
|
||||
|
||||
/* Scanner skeleton version:
|
||||
* $Header$
|
||||
@ -28,6 +28,7 @@
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
||||
@ -41,7 +42,6 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Use prototypes in function declarations. */
|
||||
#define YY_USE_PROTOS
|
||||
@ -153,6 +153,15 @@ extern FILE *yyin, *yyout;
|
||||
|
||||
#define unput(c) yyunput( c, yytext_ptr )
|
||||
|
||||
/* Some routines like yy_flex_realloc() are emitted as static but are
|
||||
not called by all lexers. This generates warnings in some compilers,
|
||||
notably GCC. Arrange to suppress these. */
|
||||
#ifdef __GNUC__
|
||||
#define YY_MAY_BE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define YY_MAY_BE_UNUSED
|
||||
#endif
|
||||
|
||||
/* The following is because we cannot portably get our hands on size_t
|
||||
* (without autoconf's help, which isn't available because we want
|
||||
* flex-generated scanners to compile on their own).
|
||||
@ -259,7 +268,7 @@ YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
|
||||
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
|
||||
|
||||
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
|
||||
static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
|
||||
static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
|
||||
static void yy_flex_free YY_PROTO(( void * ));
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
@ -783,7 +792,7 @@ goto find_rule; \
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 1 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
#define INITIAL 0
|
||||
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
|
||||
//
|
||||
@ -798,7 +807,7 @@ char *yytext;
|
||||
//
|
||||
//===----------------------------------------------------------------------===*/
|
||||
#define YY_NEVER_INTERACTIVE 1
|
||||
#line 28 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 28 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
#include "ParserInternals.h"
|
||||
#include "llvm/Module.h"
|
||||
#include <list>
|
||||
@ -833,7 +842,7 @@ static uint64_t atoull(const char *Buffer) {
|
||||
Result *= 10;
|
||||
Result += *Buffer-'0';
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -852,7 +861,7 @@ static uint64_t HexIntToVal(const char *Buffer) {
|
||||
Result += C-'a'+10;
|
||||
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -890,7 +899,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
|
||||
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
|
||||
*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
|
||||
if (!AllowNull && !*BOut)
|
||||
ThrowException("String literal cannot accept \\00 escape!");
|
||||
GenerateError("String literal cannot accept \\00 escape!");
|
||||
|
||||
BIn[3] = Tmp; // Restore character
|
||||
BIn += 3; // Skip over handled chars
|
||||
@ -924,7 +933,7 @@ using namespace llvm;
|
||||
/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
|
||||
* it to deal with 64 bit numbers.
|
||||
*/
|
||||
#line 928 "Lexer.cpp"
|
||||
#line 937 "Lexer.cpp"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
@ -1072,13 +1081,13 @@ YY_MALLOC_DECL
|
||||
YY_DECL
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register char *yy_cp = NULL, *yy_bp = NULL;
|
||||
register int yy_act;
|
||||
|
||||
#line 179 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 179 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
|
||||
|
||||
#line 1082 "Lexer.cpp"
|
||||
#line 1091 "Lexer.cpp"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
@ -1171,477 +1180,477 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
{ /* beginning of action switch */
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 181 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 181 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore comments for now */ }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 183 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 183 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return BEGINTOK; }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 184 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 184 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ENDTOK; }
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 185 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 185 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TRUETOK; }
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 186 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 186 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return FALSETOK; }
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 187 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 187 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DECLARE; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 188 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 188 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return GLOBAL; }
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 189 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 189 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CONSTANT; }
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 190 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 190 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return INTERNAL; }
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 191 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 191 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return LINKONCE; }
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 192 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 192 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return WEAK; }
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 193 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 193 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return APPENDING; }
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 194 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 194 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERNAL; } /* Deprecated, turn into external */
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 195 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 195 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERNAL; }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 196 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 196 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return IMPLEMENTATION; }
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 197 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 197 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ZEROINITIALIZER; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 198 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 198 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DOTDOTDOT; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 199 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 199 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return UNDEF; }
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 200 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 200 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return NULL_TOK; }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 201 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TO; }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 202 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 202 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 203 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 203 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return NOT; } /* Deprecated, turned into XOR */
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 204 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TAIL; }
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 205 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 205 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TARGET; }
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 206 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 206 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TRIPLE; }
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 207 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 207 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DEPLIBS; }
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 208 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 208 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ENDIAN; }
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 209 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 209 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return POINTERSIZE; }
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 210 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 210 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return LITTLE; }
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 211 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 211 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return BIG; }
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 212 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 212 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VOLATILE; }
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 213 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 213 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ALIGN; }
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 214 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 214 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return SECTION; }
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 215 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 215 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return MODULE; }
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 216 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 216 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ASM_TOK; }
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 217 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 217 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return SIDEEFFECT; }
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 219 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 219 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CC_TOK; }
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 220 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 220 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CCC_TOK; }
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 221 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 221 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CSRETCC_TOK; }
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 222 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 222 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return FASTCC_TOK; }
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 223 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 223 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return COLDCC_TOK; }
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 225 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 225 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::VoidTy ; return VOID; }
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 226 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 226 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; }
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 227 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 227 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; }
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 228 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 228 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; }
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 229 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 229 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; }
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 230 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 230 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UShortTy; return USHORT; }
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 231 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 231 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::IntTy ; return INT; }
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 232 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 232 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UIntTy ; return UINT; }
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 233 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 233 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::LongTy ; return LONG; }
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 234 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 234 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; }
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 235 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 235 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; }
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 236 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 236 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; }
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 237 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 237 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; }
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 238 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 238 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TYPE; }
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 239 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 239 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return OPAQUE; }
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 241 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 241 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Add, ADD); }
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 242 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 242 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Sub, SUB); }
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 243 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 243 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Mul, MUL); }
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 244 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 244 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Div, DIV); }
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 245 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 245 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Rem, REM); }
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 246 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 246 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, And, AND); }
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 247 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 247 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Or , OR ); }
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 248 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 248 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Xor, XOR); }
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 249 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 249 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetNE, SETNE); }
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 250 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 250 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 251 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 251 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetLT, SETLT); }
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 252 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 252 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetGT, SETGT); }
|
||||
YY_BREAK
|
||||
case 69:
|
||||
YY_RULE_SETUP
|
||||
#line 253 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 253 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetLE, SETLE); }
|
||||
YY_BREAK
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 254 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 254 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
||||
YY_BREAK
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 256 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 256 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, PHI, PHI_TOK); }
|
||||
YY_BREAK
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 257 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 257 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Call, CALL); }
|
||||
YY_BREAK
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 258 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 258 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Cast, CAST); }
|
||||
YY_BREAK
|
||||
case 74:
|
||||
YY_RULE_SETUP
|
||||
#line 259 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 259 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Select, SELECT); }
|
||||
YY_BREAK
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 260 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 260 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Shl, SHL); }
|
||||
YY_BREAK
|
||||
case 76:
|
||||
YY_RULE_SETUP
|
||||
#line 261 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 261 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Shr, SHR); }
|
||||
YY_BREAK
|
||||
case 77:
|
||||
YY_RULE_SETUP
|
||||
#line 262 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 262 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VANEXT_old; }
|
||||
YY_BREAK
|
||||
case 78:
|
||||
YY_RULE_SETUP
|
||||
#line 263 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 263 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VAARG_old; }
|
||||
YY_BREAK
|
||||
case 79:
|
||||
YY_RULE_SETUP
|
||||
#line 264 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 264 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, VAArg , VAARG); }
|
||||
YY_BREAK
|
||||
case 80:
|
||||
YY_RULE_SETUP
|
||||
#line 265 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 265 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Ret, RET); }
|
||||
YY_BREAK
|
||||
case 81:
|
||||
YY_RULE_SETUP
|
||||
#line 266 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 266 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Br, BR); }
|
||||
YY_BREAK
|
||||
case 82:
|
||||
YY_RULE_SETUP
|
||||
#line 267 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 267 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Switch, SWITCH); }
|
||||
YY_BREAK
|
||||
case 83:
|
||||
YY_RULE_SETUP
|
||||
#line 268 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 268 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Invoke, INVOKE); }
|
||||
YY_BREAK
|
||||
case 84:
|
||||
YY_RULE_SETUP
|
||||
#line 269 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 269 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
YY_BREAK
|
||||
case 85:
|
||||
YY_RULE_SETUP
|
||||
#line 270 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 270 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
|
||||
YY_BREAK
|
||||
case 86:
|
||||
YY_RULE_SETUP
|
||||
#line 272 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 272 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Malloc, MALLOC); }
|
||||
YY_BREAK
|
||||
case 87:
|
||||
YY_RULE_SETUP
|
||||
#line 273 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 273 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Alloca, ALLOCA); }
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 274 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 274 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Free, FREE); }
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
#line 275 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 275 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Load, LOAD); }
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
#line 276 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 276 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Store, STORE); }
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
#line 277 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 277 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
#line 279 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 279 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
|
||||
YY_BREAK
|
||||
case 93:
|
||||
YY_RULE_SETUP
|
||||
#line 280 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 280 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
|
||||
YY_BREAK
|
||||
case 94:
|
||||
YY_RULE_SETUP
|
||||
#line 281 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 281 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
YY_BREAK
|
||||
case 95:
|
||||
YY_RULE_SETUP
|
||||
#line 284 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 284 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
|
||||
@ -1650,7 +1659,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 96:
|
||||
YY_RULE_SETUP
|
||||
#line 289 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 289 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-1] = 0; // nuke colon
|
||||
UnEscapeLexed(yytext);
|
||||
@ -1660,7 +1669,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 97:
|
||||
YY_RULE_SETUP
|
||||
#line 295 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 295 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
|
||||
UnEscapeLexed(yytext+1);
|
||||
@ -1670,7 +1679,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 98:
|
||||
YY_RULE_SETUP
|
||||
#line 302 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 302 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ // Note that we cannot unescape a string constant here! The
|
||||
// string constant might contain a \00 which would not be
|
||||
// understood by the string stuff. It is valid to make a
|
||||
@ -1683,24 +1692,24 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
#line 313 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 313 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
|
||||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
#line 314 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 314 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT64_MAX+1)
|
||||
ThrowException("Constant too large for signed 64 bits!");
|
||||
GenerateError("Constant too large for signed 64 bits!");
|
||||
llvmAsmlval.SInt64Val = -Val;
|
||||
return ESINT64VAL;
|
||||
}
|
||||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
#line 322 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 322 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
|
||||
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||
@ -1708,39 +1717,39 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
#line 327 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 327 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
ThrowException("Invalid value number (too large)!");
|
||||
GenerateError("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return UINTVAL;
|
||||
}
|
||||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
#line 334 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 334 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT32_MAX+1)
|
||||
ThrowException("Constant too large for signed 32 bits!");
|
||||
GenerateError("Constant too large for signed 32 bits!");
|
||||
llvmAsmlval.SIntVal = (int)-Val;
|
||||
return SINTVAL;
|
||||
}
|
||||
YY_BREAK
|
||||
case 104:
|
||||
YY_RULE_SETUP
|
||||
#line 343 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 343 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case 105:
|
||||
YY_RULE_SETUP
|
||||
#line 344 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 344 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
#line 346 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 346 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
/* Make sure to free the internal buffers for flex when we are
|
||||
* done reading our input!
|
||||
@ -1751,20 +1760,20 @@ case YY_STATE_EOF(INITIAL):
|
||||
YY_BREAK
|
||||
case 106:
|
||||
YY_RULE_SETUP
|
||||
#line 354 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 354 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore whitespace */ }
|
||||
YY_BREAK
|
||||
case 107:
|
||||
YY_RULE_SETUP
|
||||
#line 355 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 355 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return yytext[0]; }
|
||||
YY_BREAK
|
||||
case 108:
|
||||
YY_RULE_SETUP
|
||||
#line 357 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 357 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
YY_FATAL_ERROR( "flex scanner jammed" );
|
||||
YY_BREAK
|
||||
#line 1768 "Lexer.cpp"
|
||||
#line 1777 "Lexer.cpp"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
@ -2140,6 +2149,7 @@ register char *yy_bp;
|
||||
#endif /* ifndef YY_NO_UNPUT */
|
||||
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
#ifdef __cplusplus
|
||||
static int yyinput()
|
||||
#else
|
||||
@ -2186,7 +2196,7 @@ static int input()
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( yywrap() )
|
||||
return 0;
|
||||
return EOF;
|
||||
|
||||
if ( ! yy_did_buffer_switch_on_eof )
|
||||
YY_NEW_FILE;
|
||||
@ -2213,7 +2223,7 @@ static int input()
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* YY_NO_INPUT */
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yyrestart( FILE *input_file )
|
||||
@ -2324,11 +2334,6 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifndef YY_ALWAYS_INTERACTIVE
|
||||
#ifndef YY_NEVER_INTERACTIVE
|
||||
extern int isatty YY_PROTO(( int ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
@ -2646,6 +2651,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 357 "/Volumes/Projects/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
|
||||
#line 357 "/proj/llvm/llvm/lib/AsmParser/Lexer.l"
|
||||
|
||||
|
@ -59,7 +59,7 @@ static uint64_t atoull(const char *Buffer) {
|
||||
Result *= 10;
|
||||
Result += *Buffer-'0';
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -78,7 +78,7 @@ static uint64_t HexIntToVal(const char *Buffer) {
|
||||
Result += C-'a'+10;
|
||||
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -116,7 +116,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
|
||||
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
|
||||
*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
|
||||
if (!AllowNull && !*BOut)
|
||||
ThrowException("String literal cannot accept \\00 escape!");
|
||||
GenerateError("String literal cannot accept \\00 escape!");
|
||||
|
||||
BIn[3] = Tmp; // Restore character
|
||||
BIn += 3; // Skip over handled chars
|
||||
@ -315,7 +315,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT64_MAX+1)
|
||||
ThrowException("Constant too large for signed 64 bits!");
|
||||
GenerateError("Constant too large for signed 64 bits!");
|
||||
llvmAsmlval.SInt64Val = -Val;
|
||||
return ESINT64VAL;
|
||||
}
|
||||
@ -327,7 +327,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
{EPInteger} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
ThrowException("Invalid value number (too large)!");
|
||||
GenerateError("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return UINTVAL;
|
||||
}
|
||||
@ -335,7 +335,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT32_MAX+1)
|
||||
ThrowException("Constant too large for signed 32 bits!");
|
||||
GenerateError("Constant too large for signed 32 bits!");
|
||||
llvmAsmlval.SIntVal = (int)-Val;
|
||||
return SINTVAL;
|
||||
}
|
||||
@ -355,4 +355,3 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
. { return yytext[0]; }
|
||||
|
||||
%%
|
||||
|
||||
|
@ -59,7 +59,7 @@ static uint64_t atoull(const char *Buffer) {
|
||||
Result *= 10;
|
||||
Result += *Buffer-'0';
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -78,7 +78,7 @@ static uint64_t HexIntToVal(const char *Buffer) {
|
||||
Result += C-'a'+10;
|
||||
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
GenerateError("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -116,7 +116,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
|
||||
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
|
||||
*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
|
||||
if (!AllowNull && !*BOut)
|
||||
ThrowException("String literal cannot accept \\00 escape!");
|
||||
GenerateError("String literal cannot accept \\00 escape!");
|
||||
|
||||
BIn[3] = Tmp; // Restore character
|
||||
BIn += 3; // Skip over handled chars
|
||||
@ -315,7 +315,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT64_MAX+1)
|
||||
ThrowException("Constant too large for signed 64 bits!");
|
||||
GenerateError("Constant too large for signed 64 bits!");
|
||||
llvmAsmlval.SInt64Val = -Val;
|
||||
return ESINT64VAL;
|
||||
}
|
||||
@ -327,7 +327,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
{EPInteger} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
ThrowException("Invalid value number (too large)!");
|
||||
GenerateError("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return UINTVAL;
|
||||
}
|
||||
@ -335,7 +335,7 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT32_MAX+1)
|
||||
ThrowException("Constant too large for signed 32 bits!");
|
||||
GenerateError("Constant too large for signed 32 bits!");
|
||||
llvmAsmlval.SIntVal = (int)-Val;
|
||||
return SINTVAL;
|
||||
}
|
||||
@ -355,4 +355,3 @@ shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
. { return yytext[0]; }
|
||||
|
||||
%%
|
||||
|
||||
|
@ -15,26 +15,24 @@
|
||||
#include "llvm/Module.h"
|
||||
using namespace llvm;
|
||||
|
||||
// The useful interface defined by this file... Parse an ASCII file, and return
|
||||
// the internal representation in a nice slice'n'dice'able representation.
|
||||
//
|
||||
Module *llvm::ParseAssemblyFile(const std::string &Filename) {
|
||||
|
||||
ParseError* TheParseError = 0; /// FIXME: Not threading friendly
|
||||
|
||||
Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError* Err) {
|
||||
FILE *F = stdin;
|
||||
|
||||
if (Filename != "-") {
|
||||
F = fopen(Filename.c_str(), "r");
|
||||
|
||||
if (F == 0)
|
||||
throw ParseException(Filename, "Could not open file '" + Filename + "'");
|
||||
if (F == 0) {
|
||||
if (Err)
|
||||
Err->setError(Filename,"Could not open file '" + Filename + "'");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Module *Result;
|
||||
try {
|
||||
Result = RunVMAsmParser(Filename, F);
|
||||
} catch (...) {
|
||||
if (F != stdin) fclose(F); // Make sure to close file descriptor if an
|
||||
throw; // exception is thrown
|
||||
}
|
||||
TheParseError = Err;
|
||||
Module *Result = RunVMAsmParser(Filename, F);
|
||||
|
||||
if (F != stdin)
|
||||
fclose(F);
|
||||
@ -42,31 +40,37 @@ Module *llvm::ParseAssemblyFile(const std::string &Filename) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
Module *llvm::ParseAssemblyString(const char * AsmString, Module * M) {
|
||||
Module *llvm::ParseAssemblyString(
|
||||
const char * AsmString, Module * M, ParseError* Err)
|
||||
{
|
||||
TheParseError = Err;
|
||||
return RunVMAsmParser(AsmString, M);
|
||||
}
|
||||
|
||||
|
||||
//===------------------------------------------------------------------------===
|
||||
// ParseException Class
|
||||
// ParseError Class
|
||||
//===------------------------------------------------------------------------===
|
||||
|
||||
|
||||
ParseException::ParseException(const std::string &filename,
|
||||
const std::string &message,
|
||||
int lineNo, int colNo)
|
||||
: Filename(filename), Message(message) {
|
||||
LineNo = lineNo; ColumnNo = colNo;
|
||||
void ParseError::setError(const std::string &filename,
|
||||
const std::string &message,
|
||||
int lineNo, int colNo)
|
||||
{
|
||||
Filename = filename;
|
||||
Message = message;
|
||||
LineNo = lineNo;
|
||||
colNo = colNo;
|
||||
}
|
||||
|
||||
ParseException::ParseException(const ParseException &E)
|
||||
ParseError::ParseError(const ParseError &E)
|
||||
: Filename(E.Filename), Message(E.Message) {
|
||||
LineNo = E.LineNo;
|
||||
ColumnNo = E.ColumnNo;
|
||||
}
|
||||
|
||||
// Includes info from options
|
||||
const std::string ParseException::getMessage() const {
|
||||
const std::string ParseError::getMessage() const {
|
||||
std::string Result;
|
||||
char Buffer[10];
|
||||
|
||||
|
@ -25,7 +25,8 @@
|
||||
|
||||
// Global variables exported from the lexer...
|
||||
|
||||
extern int llvmAsmlineno;
|
||||
extern int llvmAsmlineno; /// FIXME: Not threading friendly
|
||||
extern llvm::ParseError* TheParseError; /// FIXME: Not threading friendly
|
||||
|
||||
extern std::string &llvmAsmTextin;
|
||||
|
||||
@ -40,7 +41,7 @@ extern int llvmAsmleng;
|
||||
namespace llvm {
|
||||
|
||||
// Globals exported by the parser...
|
||||
extern std::string CurFilename;
|
||||
extern std::string CurFilename; /// FIXME: Not threading friendly
|
||||
|
||||
class Module;
|
||||
Module *RunVMAsmParser(const std::string &Filename, FILE *F);
|
||||
@ -51,7 +52,7 @@ Module *RunVMAsmParser(const char * AsmString, Module * M);
|
||||
|
||||
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
|
||||
// appropriate character. If AllowNull is set to false, a \00 value will cause
|
||||
// an exception to be thrown.
|
||||
// an error.
|
||||
//
|
||||
// If AllowNull is set to true, the return value of the function points to the
|
||||
// last character of the string in memory.
|
||||
@ -65,12 +66,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull = false);
|
||||
// This also helps me because I keep typing 'throw new ParseException' instead
|
||||
// of just 'throw ParseException'... sigh...
|
||||
//
|
||||
static inline void ThrowException(const std::string &message,
|
||||
int LineNo = -1) {
|
||||
if (LineNo == -1) LineNo = llvmAsmlineno;
|
||||
// TODO: column number in exception
|
||||
throw ParseException(CurFilename, message, LineNo);
|
||||
}
|
||||
extern void GenerateError(const std::string &message, int LineNo = -1);
|
||||
|
||||
/// InlineAsmDescriptor - This is a simple class that holds info about inline
|
||||
/// asm blocks, for use by ValID.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,244 @@
|
||||
typedef union {
|
||||
/* A Bison parser, made by GNU Bison 2.1. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ESINT64VAL = 258,
|
||||
EUINT64VAL = 259,
|
||||
SINTVAL = 260,
|
||||
UINTVAL = 261,
|
||||
FPVAL = 262,
|
||||
VOID = 263,
|
||||
BOOL = 264,
|
||||
SBYTE = 265,
|
||||
UBYTE = 266,
|
||||
SHORT = 267,
|
||||
USHORT = 268,
|
||||
INT = 269,
|
||||
UINT = 270,
|
||||
LONG = 271,
|
||||
ULONG = 272,
|
||||
FLOAT = 273,
|
||||
DOUBLE = 274,
|
||||
TYPE = 275,
|
||||
LABEL = 276,
|
||||
VAR_ID = 277,
|
||||
LABELSTR = 278,
|
||||
STRINGCONSTANT = 279,
|
||||
IMPLEMENTATION = 280,
|
||||
ZEROINITIALIZER = 281,
|
||||
TRUETOK = 282,
|
||||
FALSETOK = 283,
|
||||
BEGINTOK = 284,
|
||||
ENDTOK = 285,
|
||||
DECLARE = 286,
|
||||
GLOBAL = 287,
|
||||
CONSTANT = 288,
|
||||
SECTION = 289,
|
||||
VOLATILE = 290,
|
||||
TO = 291,
|
||||
DOTDOTDOT = 292,
|
||||
NULL_TOK = 293,
|
||||
UNDEF = 294,
|
||||
CONST = 295,
|
||||
INTERNAL = 296,
|
||||
LINKONCE = 297,
|
||||
WEAK = 298,
|
||||
APPENDING = 299,
|
||||
OPAQUE = 300,
|
||||
NOT = 301,
|
||||
EXTERNAL = 302,
|
||||
TARGET = 303,
|
||||
TRIPLE = 304,
|
||||
ENDIAN = 305,
|
||||
POINTERSIZE = 306,
|
||||
LITTLE = 307,
|
||||
BIG = 308,
|
||||
ALIGN = 309,
|
||||
DEPLIBS = 310,
|
||||
CALL = 311,
|
||||
TAIL = 312,
|
||||
ASM_TOK = 313,
|
||||
MODULE = 314,
|
||||
SIDEEFFECT = 315,
|
||||
CC_TOK = 316,
|
||||
CCC_TOK = 317,
|
||||
CSRETCC_TOK = 318,
|
||||
FASTCC_TOK = 319,
|
||||
COLDCC_TOK = 320,
|
||||
RET = 321,
|
||||
BR = 322,
|
||||
SWITCH = 323,
|
||||
INVOKE = 324,
|
||||
UNWIND = 325,
|
||||
UNREACHABLE = 326,
|
||||
ADD = 327,
|
||||
SUB = 328,
|
||||
MUL = 329,
|
||||
DIV = 330,
|
||||
REM = 331,
|
||||
AND = 332,
|
||||
OR = 333,
|
||||
XOR = 334,
|
||||
SETLE = 335,
|
||||
SETGE = 336,
|
||||
SETLT = 337,
|
||||
SETGT = 338,
|
||||
SETEQ = 339,
|
||||
SETNE = 340,
|
||||
MALLOC = 341,
|
||||
ALLOCA = 342,
|
||||
FREE = 343,
|
||||
LOAD = 344,
|
||||
STORE = 345,
|
||||
GETELEMENTPTR = 346,
|
||||
PHI_TOK = 347,
|
||||
CAST = 348,
|
||||
SELECT = 349,
|
||||
SHL = 350,
|
||||
SHR = 351,
|
||||
VAARG = 352,
|
||||
EXTRACTELEMENT = 353,
|
||||
INSERTELEMENT = 354,
|
||||
SHUFFLEVECTOR = 355,
|
||||
VAARG_old = 356,
|
||||
VANEXT_old = 357
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ESINT64VAL 258
|
||||
#define EUINT64VAL 259
|
||||
#define SINTVAL 260
|
||||
#define UINTVAL 261
|
||||
#define FPVAL 262
|
||||
#define VOID 263
|
||||
#define BOOL 264
|
||||
#define SBYTE 265
|
||||
#define UBYTE 266
|
||||
#define SHORT 267
|
||||
#define USHORT 268
|
||||
#define INT 269
|
||||
#define UINT 270
|
||||
#define LONG 271
|
||||
#define ULONG 272
|
||||
#define FLOAT 273
|
||||
#define DOUBLE 274
|
||||
#define TYPE 275
|
||||
#define LABEL 276
|
||||
#define VAR_ID 277
|
||||
#define LABELSTR 278
|
||||
#define STRINGCONSTANT 279
|
||||
#define IMPLEMENTATION 280
|
||||
#define ZEROINITIALIZER 281
|
||||
#define TRUETOK 282
|
||||
#define FALSETOK 283
|
||||
#define BEGINTOK 284
|
||||
#define ENDTOK 285
|
||||
#define DECLARE 286
|
||||
#define GLOBAL 287
|
||||
#define CONSTANT 288
|
||||
#define SECTION 289
|
||||
#define VOLATILE 290
|
||||
#define TO 291
|
||||
#define DOTDOTDOT 292
|
||||
#define NULL_TOK 293
|
||||
#define UNDEF 294
|
||||
#define CONST 295
|
||||
#define INTERNAL 296
|
||||
#define LINKONCE 297
|
||||
#define WEAK 298
|
||||
#define APPENDING 299
|
||||
#define OPAQUE 300
|
||||
#define NOT 301
|
||||
#define EXTERNAL 302
|
||||
#define TARGET 303
|
||||
#define TRIPLE 304
|
||||
#define ENDIAN 305
|
||||
#define POINTERSIZE 306
|
||||
#define LITTLE 307
|
||||
#define BIG 308
|
||||
#define ALIGN 309
|
||||
#define DEPLIBS 310
|
||||
#define CALL 311
|
||||
#define TAIL 312
|
||||
#define ASM_TOK 313
|
||||
#define MODULE 314
|
||||
#define SIDEEFFECT 315
|
||||
#define CC_TOK 316
|
||||
#define CCC_TOK 317
|
||||
#define CSRETCC_TOK 318
|
||||
#define FASTCC_TOK 319
|
||||
#define COLDCC_TOK 320
|
||||
#define RET 321
|
||||
#define BR 322
|
||||
#define SWITCH 323
|
||||
#define INVOKE 324
|
||||
#define UNWIND 325
|
||||
#define UNREACHABLE 326
|
||||
#define ADD 327
|
||||
#define SUB 328
|
||||
#define MUL 329
|
||||
#define DIV 330
|
||||
#define REM 331
|
||||
#define AND 332
|
||||
#define OR 333
|
||||
#define XOR 334
|
||||
#define SETLE 335
|
||||
#define SETGE 336
|
||||
#define SETLT 337
|
||||
#define SETGT 338
|
||||
#define SETEQ 339
|
||||
#define SETNE 340
|
||||
#define MALLOC 341
|
||||
#define ALLOCA 342
|
||||
#define FREE 343
|
||||
#define LOAD 344
|
||||
#define STORE 345
|
||||
#define GETELEMENTPTR 346
|
||||
#define PHI_TOK 347
|
||||
#define CAST 348
|
||||
#define SELECT 349
|
||||
#define SHL 350
|
||||
#define SHR 351
|
||||
#define VAARG 352
|
||||
#define EXTRACTELEMENT 353
|
||||
#define INSERTELEMENT 354
|
||||
#define SHUFFLEVECTOR 355
|
||||
#define VAARG_old 356
|
||||
#define VANEXT_old 357
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 897 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
|
||||
typedef union YYSTYPE {
|
||||
llvm::Module *ModuleVal;
|
||||
llvm::Function *FunctionVal;
|
||||
std::pair<llvm::PATypeHolder*, char*> *ArgVal;
|
||||
@ -37,106 +277,14 @@ typedef union {
|
||||
llvm::Instruction::OtherOps OtherOpVal;
|
||||
llvm::Module::Endianness Endianness;
|
||||
} YYSTYPE;
|
||||
#define ESINT64VAL 257
|
||||
#define EUINT64VAL 258
|
||||
#define SINTVAL 259
|
||||
#define UINTVAL 260
|
||||
#define FPVAL 261
|
||||
#define VOID 262
|
||||
#define BOOL 263
|
||||
#define SBYTE 264
|
||||
#define UBYTE 265
|
||||
#define SHORT 266
|
||||
#define USHORT 267
|
||||
#define INT 268
|
||||
#define UINT 269
|
||||
#define LONG 270
|
||||
#define ULONG 271
|
||||
#define FLOAT 272
|
||||
#define DOUBLE 273
|
||||
#define TYPE 274
|
||||
#define LABEL 275
|
||||
#define VAR_ID 276
|
||||
#define LABELSTR 277
|
||||
#define STRINGCONSTANT 278
|
||||
#define IMPLEMENTATION 279
|
||||
#define ZEROINITIALIZER 280
|
||||
#define TRUETOK 281
|
||||
#define FALSETOK 282
|
||||
#define BEGINTOK 283
|
||||
#define ENDTOK 284
|
||||
#define DECLARE 285
|
||||
#define GLOBAL 286
|
||||
#define CONSTANT 287
|
||||
#define SECTION 288
|
||||
#define VOLATILE 289
|
||||
#define TO 290
|
||||
#define DOTDOTDOT 291
|
||||
#define NULL_TOK 292
|
||||
#define UNDEF 293
|
||||
#define CONST 294
|
||||
#define INTERNAL 295
|
||||
#define LINKONCE 296
|
||||
#define WEAK 297
|
||||
#define APPENDING 298
|
||||
#define OPAQUE 299
|
||||
#define NOT 300
|
||||
#define EXTERNAL 301
|
||||
#define TARGET 302
|
||||
#define TRIPLE 303
|
||||
#define ENDIAN 304
|
||||
#define POINTERSIZE 305
|
||||
#define LITTLE 306
|
||||
#define BIG 307
|
||||
#define ALIGN 308
|
||||
#define DEPLIBS 309
|
||||
#define CALL 310
|
||||
#define TAIL 311
|
||||
#define ASM_TOK 312
|
||||
#define MODULE 313
|
||||
#define SIDEEFFECT 314
|
||||
#define CC_TOK 315
|
||||
#define CCC_TOK 316
|
||||
#define CSRETCC_TOK 317
|
||||
#define FASTCC_TOK 318
|
||||
#define COLDCC_TOK 319
|
||||
#define RET 320
|
||||
#define BR 321
|
||||
#define SWITCH 322
|
||||
#define INVOKE 323
|
||||
#define UNWIND 324
|
||||
#define UNREACHABLE 325
|
||||
#define ADD 326
|
||||
#define SUB 327
|
||||
#define MUL 328
|
||||
#define DIV 329
|
||||
#define REM 330
|
||||
#define AND 331
|
||||
#define OR 332
|
||||
#define XOR 333
|
||||
#define SETLE 334
|
||||
#define SETGE 335
|
||||
#define SETLT 336
|
||||
#define SETGT 337
|
||||
#define SETEQ 338
|
||||
#define SETNE 339
|
||||
#define MALLOC 340
|
||||
#define ALLOCA 341
|
||||
#define FREE 342
|
||||
#define LOAD 343
|
||||
#define STORE 344
|
||||
#define GETELEMENTPTR 345
|
||||
#define PHI_TOK 346
|
||||
#define CAST 347
|
||||
#define SELECT 348
|
||||
#define SHL 349
|
||||
#define SHR 350
|
||||
#define VAARG 351
|
||||
#define EXTRACTELEMENT 352
|
||||
#define INSERTELEMENT 353
|
||||
#define SHUFFLEVECTOR 354
|
||||
#define VAARG_old 355
|
||||
#define VANEXT_old 356
|
||||
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 282 "llvmAsmParser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE llvmAsmlval;
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -73,15 +73,10 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
|
||||
/// return it, or return null if not possible.
|
||||
///
|
||||
Module *llvm::ParseInputFile(const std::string &InputFilename) {
|
||||
Module *Result = 0;
|
||||
try {
|
||||
Result = ParseBytecodeFile(InputFilename);
|
||||
if (!Result && !(Result = ParseAssemblyFile(InputFilename))){
|
||||
std::cerr << "bugpoint: could not read input file '"
|
||||
<< InputFilename << "'!\n";
|
||||
}
|
||||
} catch (const ParseException &E) {
|
||||
std::cerr << "bugpoint: " << E.getMessage() << '\n';
|
||||
ParseError Err;
|
||||
Module *Result = ParseBytecodeFile(InputFilename);
|
||||
if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
|
||||
std::cerr << "bugpoint: " << Err.getMessage() << "\n";
|
||||
Result = 0;
|
||||
}
|
||||
return Result;
|
||||
|
@ -137,17 +137,10 @@ int main(int argc, char **argv) {
|
||||
" llvm .s -> .o assembler for GCC\n");
|
||||
sys::PrintStackTraceOnErrorSignal();
|
||||
|
||||
std::auto_ptr<Module> M;
|
||||
try {
|
||||
// Parse the file now...
|
||||
M.reset(ParseAssemblyFile(InputFilename));
|
||||
} catch (const ParseException &E) {
|
||||
std::cerr << argv[0] << ": " << E.getMessage() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
ParseError Err;
|
||||
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename,&Err));
|
||||
if (M.get() == 0) {
|
||||
std::cerr << argv[0] << ": assembly didn't read correctly.\n";
|
||||
std::cerr << argv[0] << ": " << Err.getMessage() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,10 @@ int main(int argc, char **argv) {
|
||||
std::ostream *Out = 0;
|
||||
try {
|
||||
// Parse the file now...
|
||||
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
|
||||
ParseError Err;
|
||||
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename,&Err));
|
||||
if (M.get() == 0) {
|
||||
std::cerr << argv[0] << ": assembly didn't read correctly.\n";
|
||||
std::cerr << argv[0] << ": " << Err.getMessage() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -129,9 +130,6 @@ int main(int argc, char **argv) {
|
||||
if (Force || !CheckBytecodeOutputToConsole(Out,true)) {
|
||||
WriteBytecodeToFile(M.get(), *Out, !NoCompress);
|
||||
}
|
||||
} catch (const ParseException &E) {
|
||||
std::cerr << argv[0] << ": " << E.getMessage() << "\n";
|
||||
exitCode = 1;
|
||||
} catch (const std::string& msg) {
|
||||
std::cerr << argv[0] << ": " << msg << "\n";
|
||||
exitCode = 1;
|
||||
|
@ -169,17 +169,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (AnalyzeOnly) {
|
||||
Module *CurMod = 0;
|
||||
try {
|
||||
#if 0
|
||||
TimeRegion RegionTimer(BytecodeLoadTimer);
|
||||
TimeRegion RegionTimer(BytecodeLoadTimer);
|
||||
#endif
|
||||
CurMod = ParseBytecodeFile(InputFilename);
|
||||
if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename))){
|
||||
std::cerr << argv[0] << ": input file didn't read correctly.\n";
|
||||
return 1;
|
||||
}
|
||||
} catch (const ParseException &E) {
|
||||
std::cerr << argv[0] << ": " << E.getMessage() << "\n";
|
||||
CurMod = ParseBytecodeFile(InputFilename);
|
||||
ParseError Err;
|
||||
if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename,&Err))){
|
||||
std::cerr << argv[0] << ": " << Err.getMessage() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user