Implement PR614:

These changes modify the makefiles so that the output of flex and bison are
placed in the SRC directory, not the OBJ directory. It is intended that they
be checked in as any other LLVM source so that platforms without convenient
access to flex/bison can be compiled. From now on, if you change a .y or
.l file you *must* also commit the generated .cpp and .h files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23115 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2005-08-27 18:50:39 +00:00
parent 88b9c15912
commit 68a24bdba4
16 changed files with 18717 additions and 27 deletions

View File

@ -1158,9 +1158,9 @@ LexFiles := $(filter %.l,$(Sources))
ifneq ($(LexFiles),)
LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
.PRECIOUS: $(LexOutput)
# Cancel built-in rules for lex
%.c: %.l
%.cpp: %.l
# Note the extra sed filtering here, used to cut down on the warnings emited
# by GCC. The last line is a gross hack to work around flex aparently not
@ -1168,13 +1168,17 @@ LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
# uninitialized string buffers in LLVM we can generate very long tokens, so
# this is a hack around it.
# FIXME. (f.e. char Buffer[10000] )
%.cpp: %.l
$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
$(Echo) Flexing $*.l
$(Verb) $(FLEX) -t $< | \
$(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
$(SED) 's/void yyunput/inline void yyunput/' | \
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
> $@
> $(PROJ_SRC_DIR)/$*.cpp
$(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)"
LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles))
$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
clean-local::
-$(Verb) $(RM) -f $(LexOutput)
@ -1189,7 +1193,7 @@ endif
YaccFiles := $(filter %.y,$(Sources))
ifneq ($(YaccFiles),)
YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
.PRECIOUS: $(YaccOutput)
@ -1199,14 +1203,14 @@ YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
%.h: %.y
# Rule for building the bison parsers...
%.cpp %.h : %.y
$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(Echo) "Bisoning $*.y"
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
$(Verb) $(MV) -f $*.tab.c $*.cpp
$(Verb) $(MV) -f $*.tab.h $*.h
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
$(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
clean-local::
-$(Verb) $(RM) -f $(YaccOutput)
$(Verb) $(RM) -f $(YaccOutput)
endif

View File

@ -1,4 +1 @@
Lexer.cpp
llvmAsmParser.cpp
llvmAsmParser.h
llvmAsmParser.output

2552
lib/AsmParser/Lexer.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
LEVEL = ../..
LIBRARYNAME := LLVMAsmParser
BUILT_SOURCES := llvmAsmParser.cpp llvmAsmParser.h Lexer.cpp
include $(LEVEL)/Makefile.common
@ -17,4 +16,4 @@ include $(LEVEL)/Makefile.common
# Make the object code file for the lexer depend upon the header file generated
# by the Bison parser. This prevents the Lexer from being compiled before the
# header file it needs is built.
$(OBJDIR)/Lexer.o: llvmAsmParser.h
$(ObjDir)/Lexer.o: $(PROJ_SRC_DIR)/llvmAsmParser.h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,271 @@
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, 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,
VOLATILE = 289,
TO = 290,
DOTDOTDOT = 291,
NULL_TOK = 292,
UNDEF = 293,
CONST = 294,
INTERNAL = 295,
LINKONCE = 296,
WEAK = 297,
APPENDING = 298,
OPAQUE = 299,
NOT = 300,
EXTERNAL = 301,
TARGET = 302,
TRIPLE = 303,
ENDIAN = 304,
POINTERSIZE = 305,
LITTLE = 306,
BIG = 307,
DEPLIBS = 308,
CALL = 309,
TAIL = 310,
CC_TOK = 311,
CCC_TOK = 312,
FASTCC_TOK = 313,
COLDCC_TOK = 314,
RET = 315,
BR = 316,
SWITCH = 317,
INVOKE = 318,
UNWIND = 319,
UNREACHABLE = 320,
ADD = 321,
SUB = 322,
MUL = 323,
DIV = 324,
REM = 325,
AND = 326,
OR = 327,
XOR = 328,
SETLE = 329,
SETGE = 330,
SETLT = 331,
SETGT = 332,
SETEQ = 333,
SETNE = 334,
MALLOC = 335,
ALLOCA = 336,
FREE = 337,
LOAD = 338,
STORE = 339,
GETELEMENTPTR = 340,
PHI_TOK = 341,
CAST = 342,
SELECT = 343,
SHL = 344,
SHR = 345,
VAARG = 346,
VAARG_old = 347,
VANEXT_old = 348
};
#endif
#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 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 DEPLIBS 308
#define CALL 309
#define TAIL 310
#define CC_TOK 311
#define CCC_TOK 312
#define FASTCC_TOK 313
#define COLDCC_TOK 314
#define RET 315
#define BR 316
#define SWITCH 317
#define INVOKE 318
#define UNWIND 319
#define UNREACHABLE 320
#define ADD 321
#define SUB 322
#define MUL 323
#define DIV 324
#define REM 325
#define AND 326
#define OR 327
#define XOR 328
#define SETLE 329
#define SETGE 330
#define SETLT 331
#define SETGT 332
#define SETEQ 333
#define SETNE 334
#define MALLOC 335
#define ALLOCA 336
#define FREE 337
#define LOAD 338
#define STORE 339
#define GETELEMENTPTR 340
#define PHI_TOK 341
#define CAST 342
#define SELECT 343
#define SHL 344
#define SHR 345
#define VAARG 346
#define VAARG_old 347
#define VANEXT_old 348
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 865 "/proj/llvm/build/../llvm/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
std::pair<llvm::PATypeHolder*, char*> *ArgVal;
llvm::BasicBlock *BasicBlockVal;
llvm::TerminatorInst *TermInstVal;
llvm::Instruction *InstVal;
llvm::Constant *ConstVal;
const llvm::Type *PrimType;
llvm::PATypeHolder *TypeVal;
llvm::Value *ValueVal;
std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
std::vector<llvm::Value*> *ValueList;
std::list<llvm::PATypeHolder> *TypeList;
// Represent the RHS of PHI node
std::list<std::pair<llvm::Value*,
llvm::BasicBlock*> > *PHIList;
std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
std::vector<llvm::Constant*> *ConstVector;
llvm::GlobalValue::LinkageTypes Linkage;
int64_t SInt64Val;
uint64_t UInt64Val;
int SIntVal;
unsigned UIntVal;
double FPVal;
bool BoolVal;
char *StrVal; // This memory is strdup'd!
llvm::ValID ValIDVal; // strdup'd memory maybe!
llvm::Instruction::BinaryOps BinaryOpVal;
llvm::Instruction::TermOps TermOpVal;
llvm::Instruction::MemoryOps MemOpVal;
llvm::Instruction::OtherOps OtherOpVal;
llvm::Module::Endianness Endianness;
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 263 "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

View File

@ -2,7 +2,6 @@
LEVEL := ../..
LIBRARYNAME := stkr_compiler
BUILT_SOURCES := StackerParser.cpp StackerParser.h Lexer.cpp
include $(LEVEL)/Makefile.common
@ -10,4 +9,4 @@ ifdef PARSE_DEBUG
INCLUDES += -DPARSE_DEBUG
endif
$(OBJDIR)/Lexer.o : StackerParser.h
$(ObjDir)/Lexer.o : $(PROJ_SRC_DIR)/StackerParser.h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,203 @@
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, 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 {
INTEGER = 258,
STRING = 259,
IDENTIFIER = 260,
SEMI = 261,
COLON = 262,
FORWARD = 263,
MAIN = 264,
DUMP = 265,
TRUETOK = 266,
FALSETOK = 267,
LESS = 268,
MORE = 269,
LESS_EQUAL = 270,
MORE_EQUAL = 271,
NOT_EQUAL = 272,
EQUAL = 273,
PLUS = 274,
MINUS = 275,
INCR = 276,
DECR = 277,
MULT = 278,
DIV = 279,
MODULUS = 280,
NEGATE = 281,
ABS = 282,
MIN = 283,
MAX = 284,
STAR_SLASH = 285,
AND = 286,
OR = 287,
XOR = 288,
LSHIFT = 289,
RSHIFT = 290,
DROP = 291,
DROP2 = 292,
NIP = 293,
NIP2 = 294,
DUP = 295,
DUP2 = 296,
SWAP = 297,
SWAP2 = 298,
OVER = 299,
OVER2 = 300,
ROT = 301,
ROT2 = 302,
RROT = 303,
RROT2 = 304,
TUCK = 305,
TUCK2 = 306,
ROLL = 307,
PICK = 308,
SELECT = 309,
MALLOC = 310,
FREE = 311,
GET = 312,
PUT = 313,
IF = 314,
ELSE = 315,
ENDIF = 316,
WHILE = 317,
END = 318,
RECURSE = 319,
RETURN = 320,
EXIT = 321,
TAB = 322,
SPACE = 323,
CR = 324,
IN_STR = 325,
IN_NUM = 326,
IN_CHAR = 327,
OUT_STR = 328,
OUT_NUM = 329,
OUT_CHAR = 330
};
#endif
#define INTEGER 258
#define STRING 259
#define IDENTIFIER 260
#define SEMI 261
#define COLON 262
#define FORWARD 263
#define MAIN 264
#define DUMP 265
#define TRUETOK 266
#define FALSETOK 267
#define LESS 268
#define MORE 269
#define LESS_EQUAL 270
#define MORE_EQUAL 271
#define NOT_EQUAL 272
#define EQUAL 273
#define PLUS 274
#define MINUS 275
#define INCR 276
#define DECR 277
#define MULT 278
#define DIV 279
#define MODULUS 280
#define NEGATE 281
#define ABS 282
#define MIN 283
#define MAX 284
#define STAR_SLASH 285
#define AND 286
#define OR 287
#define XOR 288
#define LSHIFT 289
#define RSHIFT 290
#define DROP 291
#define DROP2 292
#define NIP 293
#define NIP2 294
#define DUP 295
#define DUP2 296
#define SWAP 297
#define SWAP2 298
#define OVER 299
#define OVER2 300
#define ROT 301
#define ROT2 302
#define RROT 303
#define RROT2 304
#define TUCK 305
#define TUCK2 306
#define ROLL 307
#define PICK 308
#define SELECT 309
#define MALLOC 310
#define FREE 311
#define GET 312
#define PUT 313
#define IF 314
#define ELSE 315
#define ENDIF 316
#define WHILE 317
#define END 318
#define RECURSE 319
#define RETURN 320
#define EXIT 321
#define TAB 322
#define SPACE 323
#define CR 324
#define IN_STR 325
#define IN_NUM 326
#define IN_CHAR 327
#define OUT_STR 328
#define OUT_NUM 329
#define OUT_CHAR 330
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 35 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y"
typedef union YYSTYPE {
llvm::Module* ModuleVal;
llvm::Function* FunctionVal;
llvm::BasicBlock* BasicBlockVal;
int64_t IntegerVal;
char* StringVal;
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 195 "StackerParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE Stackerlval;

2720
tools/llvmc/ConfigLexer.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1 @@
FileLexer.cpp
FileParser.cpp
FileParser.h
FileParser.output

1936
utils/TableGen/FileLexer.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

102
utils/TableGen/FileParser.h Normal file
View File

@ -0,0 +1,102 @@
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, 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 {
INT = 258,
BIT = 259,
STRING = 260,
BITS = 261,
LIST = 262,
CODE = 263,
DAG = 264,
CLASS = 265,
DEF = 266,
FIELD = 267,
LET = 268,
IN = 269,
SHLTOK = 270,
SRATOK = 271,
SRLTOK = 272,
INTVAL = 273,
ID = 274,
VARNAME = 275,
STRVAL = 276,
CODEFRAGMENT = 277
};
#endif
#define INT 258
#define BIT 259
#define STRING 260
#define BITS 261
#define LIST 262
#define CODE 263
#define DAG 264
#define CLASS 265
#define DEF 266
#define FIELD 267
#define LET 268
#define IN 269
#define SHLTOK 270
#define SRATOK 271
#define SRLTOK 272
#define INTVAL 273
#define ID 274
#define VARNAME 275
#define STRVAL 276
#define CODEFRAGMENT 277
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 189 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y"
typedef union YYSTYPE {
std::string* StrVal;
int IntVal;
llvm::RecTy* Ty;
llvm::Init* Initializer;
std::vector<llvm::Init*>* FieldList;
std::vector<unsigned>* BitList;
llvm::Record* Rec;
SubClassRefTy* SubClassRef;
std::vector<SubClassRefTy>* SubClassList;
std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 94 "FileParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE Filelval;

View File

@ -17,8 +17,4 @@ include $(LEVEL)/Makefile.common
# (which depend on the source file) won't get generated until bison is done
# generating the C source and header files for the parser.
#
FileLexer.cpp: FileParser.h
clean::
$(Verb) $(RM) -f FileParser.cpp FileParser.h FileLexer.cpp CommandLine.cpp
$(Verb) $(RM) -f FileParser.output
$(ObjDir)/FileLexer.o : $(PROJ_SRC_DIR)/FileParser.h