示例#1
0
void
Ex3SuifPass::initialize()
{
    PipelinablePass::initialize();

    OptionList *l;

    // Create grammar for parsing the command line.  This must occur
    // after the parent class's initialize routine has been executed.
    _command_line->set_description("cookbook example #3");

    // Collect optional flags.
    OptionSelection *flags = new OptionSelection(false);

    // -reserve_reg
    l = new OptionList;
    l->add(new OptionLiteral("-reserve_reg"));
    l->add(new OptionString("reg", &reserved_reg_name));
    l->set_description("specifies name of register to reserve");
    flags->add(l);

    // Accept tagged options in any order.
    _command_line->add(new OptionLoop(flags));

    // zero or more file names
    file_names = new OptionString("file name");
    OptionLoop *files =
	new OptionLoop(file_names,
		       "names of optional input and/or output files");
    _command_line->add(files);
}
void One2MultiArrayExpressionPass::initialize() {
    PipelinablePass::initialize();
    _command_line -> set_description(
                    "Convert one-dimentional array "
                    "access expressions and array types to"
                   " multidimantional ones\n"
                   " If -preserve1dim is specified, then single"
                   " ArrayReferenceExpressions are preserved and not"
                   " converted to corresponding multidimentional ones."
                   );
    _preserve_one_dim = new OptionLiteral("-preserve1dim");
    OptionSelection *opt = new OptionSelection(true);
    opt->add(_preserve_one_dim);
    _command_line->add(opt);
}
示例#3
0
  virtual void initialize() {
    Pass::initialize();

    _def_flag_argument = new OptionLiteral("-D", &def, true);
    _def_opts_argument = new OptionMultiString("definition", &_d_opts);
    _def_list_argument = new OptionList();
    _def_list_argument->add(_def_flag_argument);
    _def_list_argument->add(_def_opts_argument);
    _def_loop_argument = new OptionLoop(_def_list_argument, true);

    _def_selector = new OptionSelection(true);
    _def_selector->add(_def_loop_argument);
    _command_line->add(_def_selector);

    _incl_flag_argument = new OptionLiteral("-I", &incl, true);
    _incl_opts_argument = new OptionMultiString("include", &_i_opts);
    _incl_list_argument = new OptionList();
    _incl_list_argument->add(_incl_flag_argument);
    _incl_list_argument->add(_incl_opts_argument);
    _incl_loop_argument = new OptionLoop(_incl_list_argument, true);

    _incl_selector = new OptionSelection(true);
    _incl_selector->add(_incl_loop_argument);
    _command_line->add(_incl_selector);
    
    _debug_argument = new OptionLiteral("-d", &debug_it, true);
    _debug_selector = new OptionSelection(true);
    _debug_selector-> add( _debug_argument );
    _command_line-> add(_debug_selector);

#ifndef MSVC
    _macro_file_name = get_default_file_name("suif/suif2b/basesuif/s2c/c_text.mac");
#else
    _macro_file_name = get_default_file_name("suif\\suif2b\\basesuif\\s2c\\c_text.mac");
#endif

    _output_file_name_argument = new OptionString( "output-file" );
    _command_line-> add( _output_file_name_argument );
    _macro_file_name_argument = new OptionString( "macro-file",&_macro_file_name );
    _option_selector = new OptionSelection(true);
    _option_selector-> add( _macro_file_name_argument );
    _command_line-> add(_option_selector);
    
    _command_line-> set_description("Outputs C form of a SUIF tree." );
    // SuifEnv *s = get_suif_env();

  }
示例#4
0
void SuifCFGraphPass::initialize() {
  PipelinablePass::initialize();
  //SuifEnv *s = get_suif_env();

  Module::initialize();
  _command_line->set_description("Control Flow Graph builder pass");

  _verbose_output = new OptionLiteral("-v");
  _dot_output = new OptionLiteral("-dot");
  OptionSelection *sel = new OptionSelection();
  sel->add(_verbose_output);
  sel->add(_dot_output);
  OptionLoop *opt = new OptionLoop(sel, true);
  _command_line->add(opt);

  
  //ModuleSubSystem *ms = s->get_module_subsystem();
  //  ms->register_interface_listener( this, "suif_cfgraph_builder");
  //  ms->register_interface_producer( this, "suif_cfgraph_builder");
  

  //  CFGraphState *state = new CFGraphState(s);
  //  _maps = new WalkingMaps(s, "suif_cfgraph_pass_walker",
  //			  (Address) state);
  //  state->set_maps(_maps);
  
  // Initialize it
  
  
  // Now do the deferred initialization
  //  for (list<walker_init_fn>::iterator iter =
  //	 _walker_inits->begin();
  //       iter != _walker_inits->end();
  //       iter++) {
  //    walker_init_fn fn = (*iter);
    // This is an indirect function call through
    // something that had bee untyped.
    // I'd REALLY like to be able to validate it
    // before using it.
  //    (*fn)(_maps);
  //  }

  
}
示例#5
0
void
Il2cfgSuifPass::initialize()
{
    PipelinablePass::initialize();

    OptionLiteral *f;

    // Create grammar for parsing the command line.  This must occur
    // after the parent class's initialize routine has been executed.
    _command_line->set_description("convert from InstrList to Cfg form");

    // Collect optional flags.
    OptionSelection *flags = new OptionSelection(false);

    // -keep_layout
    f = new OptionLiteral("-keep_layout", &keep_layout, true);
    f->set_description("maintain the program layout");
    flags->add(f);

    // -break_at_call
    f = new OptionLiteral("-break_at_call", &break_at_call, true);
    f->set_description("treat call as a block-terminating CTI");
    flags->add(f);

    // -break_at_instr
    f = new OptionLiteral("-break_at_instr", &break_at_instr, true);
    f->set_description("give each instruction a CFG node");
    flags->add(f);

    // Accept tagged options in any order.
    _command_line->add(new OptionLoop(flags));

    // zero or more file names
    file_names = new OptionString("file name");
    OptionLoop *files =
	new OptionLoop(file_names,
		       "names of optional input and/or output files");
    _command_line->add(files);
}
示例#6
0
void
M2aSuifPass::initialize()
{
    OptionList *l;
    OptionLiteral *f;

    PipelinablePass::initialize();

    // Create parse tree for parsing the command line.  This must occur
    // after the parent class's initialize routine has been executed.
    _command_line->set_description(
	"translate Machine-SUIF file to assembly language");

    // Collect optional flags.
    OptionSelection *flags = new OptionSelection(false);

    // -debug level
    l = new OptionList;
    l->add(new OptionLiteral("-debug"));
    l->add(new OptionInt("level", &debuglvl));
    l->set_description("set verbosity level for debugging messages");
    flags->add(l);

    // -all_notes -- print all instruction notes
    f = new OptionLiteral("-all_notes", &m2a.print_all_notes, true);
    f->set_description("force all instruction notes to appear in output");
    flags->add(f);
    
    // -noprint note -- do not print this note
    l = new OptionList;
    l->add(new OptionLiteral("-noprint"));
    nonprinting_notes_option = new OptionString("annotation key");
    l->add(nonprinting_notes_option);
    l->set_description("suppress annotations with given key");
    flags->add(l);

    // -G max -- max byte size of datum in $gp area
    l = new OptionList;
    l->add(new OptionLiteral("-G"));
    l->add(new OptionInt("max", &m2a.Gnum));
    l->set_description("set max byte size of a datum in the $gp area");
    flags->add(l);

    // -stabs -- print with stabs information
    f = new OptionLiteral("-stabs", &m2a.want_stabs, true);
    f->set_description("add stabs debugging information to output");
    flags->add(f);

    // accept flags in any order
    _command_line->add(new OptionLoop(flags));

    // zero or more file names
    file_names_option = new OptionString("file name");
    OptionLoop *files =
	new OptionLoop(file_names_option,
		       "names of optional input and/or output files");
    _command_line->add(files);
}