@@ -95,6 +95,18 @@ F(config->optimisations.inline_everything, inline-everything) \
9595F(config->hacks.restructure_everything, restructure-everything) \
9696F(config->hacks.recover_structure, recover-structure) \
9797
98+ static IntSizes parse_int_size (String argv ) {
99+ if (strcmp (argv , "8" ) == 0 )
100+ return IntTy8 ;
101+ if (strcmp (argv , "16" ) == 0 )
102+ return IntTy16 ;
103+ if (strcmp (argv , "32" ) == 0 )
104+ return IntTy32 ;
105+ if (strcmp (argv , "64" ) == 0 )
106+ return IntTy64 ;
107+ error ("Valid pointer sizes are 8, 16, 32 or 64." );
108+ }
109+
98110void cli_parse_compiler_config_args (CompilerConfig * config , int * pargc , char * * argv ) {
99111 int argc = * pargc ;
100112
@@ -142,6 +154,14 @@ void cli_parse_compiler_config_args(CompilerConfig* config, int* pargc, char** a
142154 default : break ;
143155 }
144156 config -> specialization .execution_model = em ;
157+ } else if (strcmp (argv [i ], "--word-size" ) == 0 ) {
158+ argv [i ] = NULL ;
159+ i ++ ;
160+ config -> target .memory .word_size = parse_int_size (argv [i ]);
161+ } else if (strcmp (argv [i ], "--pointer-size" ) == 0 ) {
162+ argv [i ] = NULL ;
163+ i ++ ;
164+ config -> target .memory .ptr_size = parse_int_size (argv [i ]);
145165 } else if (strcmp (argv [i ], "--help" ) == 0 || strcmp (argv [i ], "-h" ) == 0 ) {
146166 help = true;
147167 continue ;
@@ -157,6 +177,8 @@ void cli_parse_compiler_config_args(CompilerConfig* config, int* pargc, char** a
157177 error_print (" --no-dynamic-scheduling Disable the built-in dynamic scheduler, restricts code to only leaf functions\n" );
158178 error_print (" --simt2d Emits SIMD code instead of SIMT, only effective with the C backend.\n" );
159179 error_print (" --entry-point <foo> Selects an entry point for the program to be specialized on.\n" );
180+ error_print (" --word-size <8|16|32|64> Sets the word size for physical memory emulation (default=32)\n" );
181+ error_print (" --pointer-size <8|16|32|64> Sets the pointer size for physical pointers (default=64)\n" );
160182#define EM (name , _ ) #name", "
161183 error_print (" --execution-model <em> Selects an entry point for the program to be specialized on.\nPossible values: " EXECUTION_MODELS (EM ));
162184#undef EM
0 commit comments