From da467817e3e25d201e94326ff876374093a3ba22 Mon Sep 17 00:00:00 2001 From: "Kristian H. Kristensen" Date: Wed, 22 Apr 2020 16:57:52 -0700 Subject: [PATCH] freedreno/ir3: Move ir3 assembler to backend compiler For easier reuse. Part-of: --- src/freedreno/computerator/ir3_asm.c | 2 +- src/freedreno/computerator/ir3_asm.h | 2 +- src/freedreno/computerator/meson.build | 21 ------------------- .../{computerator => ir3}/ir3_lexer.l | 0 .../{computerator => ir3}/ir3_parser.y | 0 src/freedreno/ir3/meson.build | 20 +++++++++++++++++- 6 files changed, 21 insertions(+), 24 deletions(-) rename src/freedreno/{computerator => ir3}/ir3_lexer.l (100%) rename src/freedreno/{computerator => ir3}/ir3_parser.y (100%) diff --git a/src/freedreno/computerator/ir3_asm.c b/src/freedreno/computerator/ir3_asm.c index 46e21347407..cbab6e8e16f 100644 --- a/src/freedreno/computerator/ir3_asm.c +++ b/src/freedreno/computerator/ir3_asm.c @@ -22,9 +22,9 @@ */ #include "ir3/ir3_compiler.h" +#include "ir3/ir3_parser.h" #include "ir3_asm.h" -#include "ir3_parser.h" struct ir3_kernel * ir3_asm_assemble(struct ir3_compiler *c, FILE *in) diff --git a/src/freedreno/computerator/ir3_asm.h b/src/freedreno/computerator/ir3_asm.h index 5bb19c09645..1a03eb2548d 100644 --- a/src/freedreno/computerator/ir3_asm.h +++ b/src/freedreno/computerator/ir3_asm.h @@ -27,7 +27,7 @@ #include "main.h" #include "ir3/ir3_shader.h" -#include "ir3_parser.h" +#include "ir3/ir3_parser.h" struct ir3_kernel { struct kernel base; diff --git a/src/freedreno/computerator/meson.build b/src/freedreno/computerator/meson.build index 57b89d5f7d7..e810dfb78e4 100644 --- a/src/freedreno/computerator/meson.build +++ b/src/freedreno/computerator/meson.build @@ -18,32 +18,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -ir3_parser = custom_target( - 'ir3_parser.[ch]', - input: 'ir3_parser.y', - output: ['ir3_parser.c', 'ir3_parser.h'], - command: [ - prog_bison, '@INPUT@', '--name-prefix=ir3_yy', '--defines=@OUTPUT1@', '--output=@OUTPUT0@' - ] -) - -ir3_lexer = custom_target( - 'ir3_lexer.c', - input: 'ir3_lexer.l', - output: 'ir3_lexer.c', - command: [ - prog_flex, '-o', '@OUTPUT@', '@INPUT@' - ] -) - computerator_files = [ 'a6xx.c', 'ir3_asm.c', 'main.c', freedreno_xml_header_files, - ir3_parser[0], - ir3_parser[1], - ir3_lexer ] computerator = executable( diff --git a/src/freedreno/computerator/ir3_lexer.l b/src/freedreno/ir3/ir3_lexer.l similarity index 100% rename from src/freedreno/computerator/ir3_lexer.l rename to src/freedreno/ir3/ir3_lexer.l diff --git a/src/freedreno/computerator/ir3_parser.y b/src/freedreno/ir3/ir3_parser.y similarity index 100% rename from src/freedreno/computerator/ir3_parser.y rename to src/freedreno/ir3/ir3_parser.y diff --git a/src/freedreno/ir3/meson.build b/src/freedreno/ir3/meson.build index 068d4262ee7..a9268b04c36 100644 --- a/src/freedreno/ir3/meson.build +++ b/src/freedreno/ir3/meson.build @@ -42,6 +42,24 @@ ir3_nir_imul_c = custom_target( depend_files : nir_algebraic_py, ) +ir3_parser = custom_target( + 'ir3_parser.[ch]', + input: 'ir3_parser.y', + output: ['ir3_parser.c', 'ir3_parser.h'], + command: [ + prog_bison, '@INPUT@', '--name-prefix=ir3_yy', '--defines=@OUTPUT1@', '--output=@OUTPUT0@' + ] +) + +ir3_lexer = custom_target( + 'ir3_lexer.c', + input: 'ir3_lexer.l', + output: 'ir3_lexer.c', + command: [ + prog_flex, '-o', '@OUTPUT@', '@INPUT@' + ] +) + libfreedreno_ir3_files = files( 'disasm-a3xx.c', 'instr-a3xx.h', @@ -85,7 +103,7 @@ libfreedreno_ir3_files = files( libfreedreno_ir3 = static_library( 'freedreno_ir3', - [libfreedreno_ir3_files, ir3_nir_trig_c, ir3_nir_imul_c], + [libfreedreno_ir3_files, ir3_nir_trig_c, ir3_nir_imul_c, ir3_parser[0], ir3_parser[1], ir3_lexer], include_directories : [inc_freedreno, inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], c_args : [c_vis_args, no_override_init_args], cpp_args : [cpp_vis_args], -- 2.30.2