glsl: build without bison
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8739>
This commit is contained in:
@@ -1724,6 +1724,8 @@ else
|
|||||||
asan_c_args = ['-DBUILT_WITH_ASAN=0']
|
asan_c_args = ['-DBUILT_WITH_ASAN=0']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
yacc_is_bison = true
|
||||||
|
|
||||||
if build_machine.system() == 'windows'
|
if build_machine.system() == 'windows'
|
||||||
# Prefer the winflexbison versions, they're much easier to install and have
|
# Prefer the winflexbison versions, they're much easier to install and have
|
||||||
# better windows support.
|
# better windows support.
|
||||||
@@ -1746,7 +1748,12 @@ if build_machine.system() == 'windows'
|
|||||||
prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
|
prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
prog_bison = find_program('bison', required : with_any_opengl)
|
prog_bison = find_program('bison', required : false)
|
||||||
|
|
||||||
|
if not prog_bison.found()
|
||||||
|
prog_bison = find_program('byacc', required : with_any_opengl)
|
||||||
|
yacc_is_bison = false
|
||||||
|
endif
|
||||||
|
|
||||||
# Disable deprecated keyword warnings, since we have to use them for
|
# Disable deprecated keyword warnings, since we have to use them for
|
||||||
# old-bison compat. See discussion in
|
# old-bison compat. See discussion in
|
||||||
|
@@ -18,14 +18,24 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
|
bison_command = []
|
||||||
|
if yacc_is_bison
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
|
||||||
|
'--defines=@OUTPUT1@', '@INPUT@',
|
||||||
|
]
|
||||||
|
else
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
|
||||||
|
'-H', '@OUTPUT1@', '@INPUT@',
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
glcpp_parse = custom_target(
|
glcpp_parse = custom_target(
|
||||||
'glcpp-parse.[ch]',
|
'glcpp-parse.[ch]',
|
||||||
input : 'glcpp-parse.y',
|
input : 'glcpp-parse.y',
|
||||||
output : ['glcpp-parse.c', 'glcpp-parse.h'],
|
output : ['glcpp-parse.c', 'glcpp-parse.h'],
|
||||||
command : [
|
command : bison_command
|
||||||
prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
|
|
||||||
'--defines=@OUTPUT1@', '@INPUT@',
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
glcpp_lex = custom_target(
|
glcpp_lex = custom_target(
|
||||||
|
@@ -20,14 +20,24 @@
|
|||||||
|
|
||||||
subdir('glcpp')
|
subdir('glcpp')
|
||||||
|
|
||||||
|
bison_command = []
|
||||||
|
if yacc_is_bison
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
|
||||||
|
'@INPUT@',
|
||||||
|
]
|
||||||
|
else
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '-H', '@OUTPUT1@',
|
||||||
|
'@INPUT@',
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
glsl_parser = custom_target(
|
glsl_parser = custom_target(
|
||||||
'glsl_parser',
|
'glsl_parser',
|
||||||
input : 'glsl_parser.yy',
|
input : 'glsl_parser.yy',
|
||||||
output : ['glsl_parser.cpp', 'glsl_parser.h'],
|
output : ['glsl_parser.cpp', 'glsl_parser.h'],
|
||||||
command : [
|
command : bison_command
|
||||||
prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
|
|
||||||
'@INPUT@',
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
glsl_lexer_cpp = custom_target(
|
glsl_lexer_cpp = custom_target(
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
/* glibc < 2.27 defines OVERFLOW in /usr/include/math.h. */
|
/* glibc < 2.27 defines OVERFLOW in /usr/include/math.h. */
|
||||||
#undef OVERFLOW
|
#undef OVERFLOW
|
||||||
|
|
||||||
void yyerror (char *);
|
|
||||||
int yyparse(void);
|
int yyparse(void);
|
||||||
int yylex(void);
|
int yylex(void);
|
||||||
char *lex_text(void);
|
char *lex_text(void);
|
||||||
|
@@ -28,6 +28,14 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "i965_asm.h"
|
#include "i965_asm.h"
|
||||||
|
|
||||||
|
#undef yyerror
|
||||||
|
#ifdef YYBYACC
|
||||||
|
struct YYLTYPE;
|
||||||
|
void yyerror (struct YYLTYPE *, char *);
|
||||||
|
#else
|
||||||
|
void yyerror (char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef ALIGN16
|
#undef ALIGN16
|
||||||
|
|
||||||
#define YYLTYPE YYLTYPE
|
#define YYLTYPE YYLTYPE
|
||||||
@@ -467,11 +475,11 @@ add_label(struct brw_codegen *p, const char* label_name, enum instr_label_type t
|
|||||||
%token <llint> LONG
|
%token <llint> LONG
|
||||||
%token NULL_TOKEN
|
%token NULL_TOKEN
|
||||||
|
|
||||||
%precedence SUBREGNUM
|
%nonassoc SUBREGNUM
|
||||||
%left PLUS MINUS
|
%left PLUS MINUS
|
||||||
%precedence DOT
|
%nonassoc DOT
|
||||||
%precedence EMPTYEXECSIZE
|
%nonassoc EMPTYEXECSIZE
|
||||||
%precedence LPAREN
|
%nonassoc LPAREN
|
||||||
|
|
||||||
%type <integer> execsize simple_int exp
|
%type <integer> execsize simple_int exp
|
||||||
%type <llint> exp2
|
%type <llint> exp2
|
||||||
@@ -1470,7 +1478,7 @@ simple_int:
|
|||||||
|
|
||||||
rellocation:
|
rellocation:
|
||||||
relativelocation
|
relativelocation
|
||||||
| %empty { $$ = 0; }
|
| /* empty */ { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
relativelocation:
|
relativelocation:
|
||||||
@@ -1482,7 +1490,7 @@ relativelocation:
|
|||||||
|
|
||||||
jumplabel:
|
jumplabel:
|
||||||
JUMP_LABEL { $$ = $1; }
|
JUMP_LABEL { $$ = $1; }
|
||||||
| %empty { $$ = NULL; }
|
| /* empty */ { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
jumplabeltarget:
|
jumplabeltarget:
|
||||||
@@ -1778,7 +1786,7 @@ exp:
|
|||||||
|
|
||||||
subregnum:
|
subregnum:
|
||||||
DOT exp { $$ = $2; }
|
DOT exp { $$ = $2; }
|
||||||
| %empty %prec SUBREGNUM { $$ = 0; }
|
| /* empty */ %prec SUBREGNUM { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
directgenreg:
|
directgenreg:
|
||||||
@@ -2001,7 +2009,7 @@ immval:
|
|||||||
|
|
||||||
/* Regions */
|
/* Regions */
|
||||||
dstregion:
|
dstregion:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
$$ = BRW_HORIZONTAL_STRIDE_1;
|
$$ = BRW_HORIZONTAL_STRIDE_1;
|
||||||
}
|
}
|
||||||
@@ -2020,7 +2028,7 @@ indirectregion:
|
|||||||
;
|
;
|
||||||
|
|
||||||
region:
|
region:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
$$ = stride($$, 0, 1, 0);
|
$$ = stride($$, 0, 1, 0);
|
||||||
}
|
}
|
||||||
@@ -2111,7 +2119,7 @@ imm_type:
|
|||||||
;
|
;
|
||||||
|
|
||||||
writemask:
|
writemask:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
$$ = WRITEMASK_XYZW;
|
$$ = WRITEMASK_XYZW;
|
||||||
}
|
}
|
||||||
@@ -2122,27 +2130,27 @@ writemask:
|
|||||||
;
|
;
|
||||||
|
|
||||||
writemask_x:
|
writemask_x:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| X { $$ = 1 << BRW_CHANNEL_X; }
|
| X { $$ = 1 << BRW_CHANNEL_X; }
|
||||||
;
|
;
|
||||||
|
|
||||||
writemask_y:
|
writemask_y:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| Y { $$ = 1 << BRW_CHANNEL_Y; }
|
| Y { $$ = 1 << BRW_CHANNEL_Y; }
|
||||||
;
|
;
|
||||||
|
|
||||||
writemask_z:
|
writemask_z:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| Z { $$ = 1 << BRW_CHANNEL_Z; }
|
| Z { $$ = 1 << BRW_CHANNEL_Z; }
|
||||||
;
|
;
|
||||||
|
|
||||||
writemask_w:
|
writemask_w:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| W { $$ = 1 << BRW_CHANNEL_W; }
|
| W { $$ = 1 << BRW_CHANNEL_W; }
|
||||||
;
|
;
|
||||||
|
|
||||||
swizzle:
|
swizzle:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
$$ = BRW_SWIZZLE_NOOP;
|
$$ = BRW_SWIZZLE_NOOP;
|
||||||
}
|
}
|
||||||
@@ -2165,7 +2173,7 @@ chansel:
|
|||||||
|
|
||||||
/* Instruction prediction and modifiers */
|
/* Instruction prediction and modifiers */
|
||||||
predicate:
|
predicate:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
brw_push_insn_state(p);
|
brw_push_insn_state(p);
|
||||||
brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
|
brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
|
||||||
@@ -2182,13 +2190,13 @@ predicate:
|
|||||||
;
|
;
|
||||||
|
|
||||||
predstate:
|
predstate:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| PLUS { $$ = 0; }
|
| PLUS { $$ = 0; }
|
||||||
| MINUS { $$ = 1; }
|
| MINUS { $$ = 1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
predctrl:
|
predctrl:
|
||||||
%empty { $$ = BRW_PREDICATE_NORMAL; }
|
/* empty */ { $$ = BRW_PREDICATE_NORMAL; }
|
||||||
| DOT X { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_X; }
|
| DOT X { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_X; }
|
||||||
| DOT Y { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Y; }
|
| DOT Y { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Y; }
|
||||||
| DOT Z { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Z; }
|
| DOT Z { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Z; }
|
||||||
@@ -2209,12 +2217,12 @@ predctrl:
|
|||||||
|
|
||||||
/* Source Modification */
|
/* Source Modification */
|
||||||
negate:
|
negate:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| MINUS { $$ = 1; }
|
| MINUS { $$ = 1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
abs:
|
abs:
|
||||||
%empty { $$ = 0; }
|
/* empty */ { $$ = 0; }
|
||||||
| ABS { $$ = 1; }
|
| ABS { $$ = 1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -2235,7 +2243,7 @@ cond_mod:
|
|||||||
;
|
;
|
||||||
|
|
||||||
condModifiers:
|
condModifiers:
|
||||||
%empty { $$ = BRW_CONDITIONAL_NONE; }
|
/* empty */ { $$ = BRW_CONDITIONAL_NONE; }
|
||||||
| ZERO
|
| ZERO
|
||||||
| EQUAL
|
| EQUAL
|
||||||
| NOT_ZERO
|
| NOT_ZERO
|
||||||
@@ -2250,13 +2258,13 @@ condModifiers:
|
|||||||
;
|
;
|
||||||
|
|
||||||
saturate:
|
saturate:
|
||||||
%empty { $$ = BRW_INSTRUCTION_NORMAL; }
|
/* empty */ { $$ = BRW_INSTRUCTION_NORMAL; }
|
||||||
| SATURATE { $$ = BRW_INSTRUCTION_SATURATE; }
|
| SATURATE { $$ = BRW_INSTRUCTION_SATURATE; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Execution size */
|
/* Execution size */
|
||||||
execsize:
|
execsize:
|
||||||
%empty %prec EMPTYEXECSIZE
|
/* empty */ %prec EMPTYEXECSIZE
|
||||||
{
|
{
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
@@ -2271,7 +2279,7 @@ execsize:
|
|||||||
|
|
||||||
/* Instruction options */
|
/* Instruction options */
|
||||||
instoptions:
|
instoptions:
|
||||||
%empty
|
/* empty */
|
||||||
{
|
{
|
||||||
memset(&$$, 0, sizeof($$));
|
memset(&$$, 0, sizeof($$));
|
||||||
}
|
}
|
||||||
@@ -2295,7 +2303,7 @@ instoption_list:
|
|||||||
$$ = $1;
|
$$ = $1;
|
||||||
add_instruction_option(&$$, $2);
|
add_instruction_option(&$$, $2);
|
||||||
}
|
}
|
||||||
| %empty
|
| /* empty */
|
||||||
{
|
{
|
||||||
memset(&$$, 0, sizeof($$));
|
memset(&$$, 0, sizeof($$));
|
||||||
}
|
}
|
||||||
@@ -2334,8 +2342,13 @@ instoption:
|
|||||||
|
|
||||||
extern int yylineno;
|
extern int yylineno;
|
||||||
|
|
||||||
|
#ifdef YYBYACC
|
||||||
|
void
|
||||||
|
yyerror(YYLTYPE *ltype, char *msg)
|
||||||
|
#else
|
||||||
void
|
void
|
||||||
yyerror(char *msg)
|
yyerror(char *msg)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %d: %s at \"%s\"\n",
|
fprintf(stderr, "%s: %d: %s at \"%s\"\n",
|
||||||
input_filename, yylineno, msg, lex_text());
|
input_filename, yylineno, msg, lex_text());
|
||||||
|
@@ -161,14 +161,24 @@ if with_tools.contains('intel-ui')
|
|||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
bison_command = []
|
||||||
|
if yacc_is_bison
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
|
||||||
|
'--output=@OUTPUT0@'
|
||||||
|
]
|
||||||
|
else
|
||||||
|
bison_command = [
|
||||||
|
prog_bison, '-H', '@OUTPUT1@',
|
||||||
|
'-o', '@OUTPUT0@', '@INPUT@'
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
i965_gram_tab = custom_target(
|
i965_gram_tab = custom_target(
|
||||||
'i965_gram.tab.[ch]',
|
'i965_gram.tab.[ch]',
|
||||||
input : 'i965_gram.y',
|
input : 'i965_gram.y',
|
||||||
output : ['i965_gram.tab.c', 'i965_gram.tab.h'],
|
output : ['i965_gram.tab.c', 'i965_gram.tab.h'],
|
||||||
command : [
|
command : bison_command
|
||||||
prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
|
|
||||||
'--output=@OUTPUT0@'
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
i965_lex_yy_c = custom_target(
|
i965_lex_yy_c = custom_target(
|
||||||
|
@@ -18,6 +18,13 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
|
bison_command = []
|
||||||
|
if yacc_is_bison
|
||||||
|
bison_command = [prog_bison, '-o', '@OUTPUT0@', '--defines=@OUTPUT1@', '@INPUT@']
|
||||||
|
else
|
||||||
|
bison_command = [prog_bison, '-o', '@OUTPUT0@', '-H', '@OUTPUT1@', '@INPUT@']
|
||||||
|
endif
|
||||||
|
|
||||||
mesa_lex = custom_target(
|
mesa_lex = custom_target(
|
||||||
'mesa_lex',
|
'mesa_lex',
|
||||||
input : 'program_lexer.l',
|
input : 'program_lexer.l',
|
||||||
@@ -29,5 +36,5 @@ program_parse_tab = custom_target(
|
|||||||
'program_parse_tab.[ch]',
|
'program_parse_tab.[ch]',
|
||||||
input : 'program_parse.y',
|
input : 'program_parse.y',
|
||||||
output : ['program_parse.tab.c', 'program_parse.tab.h'],
|
output : ['program_parse.tab.c', 'program_parse.tab.h'],
|
||||||
command : [prog_bison, '-o', '@OUTPUT0@', '--defines=@OUTPUT1@', '@INPUT@'],
|
command : bison_command,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user