yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
BlifBackend Struct Reference
+ Inheritance diagram for BlifBackend:
+ Collaboration diagram for BlifBackend:

Public Member Functions

 BlifBackend ()
 
virtual void help ()
 
virtual void execute (std::ostream *&f, std::string filename, std::vector< std::string > args, RTLIL::Design *design)
 
virtual void run_register ()
 
virtual void execute (std::vector< std::string > args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL
 
void extra_args (std::ostream *&f, std::string &filename, std::vector< std::string > args, size_t argidx)
 
void extra_args (std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
 
pre_post_exec_state_t pre_execute ()
 
void post_execute (pre_post_exec_state_t state)
 
void cmd_log_args (const std::vector< std::string > &args)
 
void cmd_error (const std::vector< std::string > &args, size_t argidx, std::string msg)
 

Static Public Member Functions

static void backend_call (RTLIL::Design *design, std::ostream *f, std::string filename, std::string command)
 
static void backend_call (RTLIL::Design *design, std::ostream *f, std::string filename, std::vector< std::string > args)
 
static void call (RTLIL::Design *design, std::string command)
 
static void call (RTLIL::Design *design, std::vector< std::string > args)
 
static void call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::string command)
 
static void call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::vector< std::string > args)
 
static void call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::string command)
 
static void call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::vector< std::string > args)
 
static void init_register ()
 
static void done_register ()
 

Data Fields

std::string backend_name
 
std::string pass_name
 
std::string short_help
 
int call_counter
 
int64_t runtime_ns
 
Passnext_queued_pass
 

Detailed Description

Definition at line 292 of file blif.cc.

Constructor & Destructor Documentation

BlifBackend::BlifBackend ( )
inline

Definition at line 293 of file blif.cc.

293 : Backend("blif", "write design to BLIF file") { }
Backend(std::string name, std::string short_help="** document me **")
Definition: register.cc:410

Member Function Documentation

void Backend::backend_call ( RTLIL::Design design,
std::ostream *  f,
std::string  filename,
std::string  command 
)
staticinherited

Definition at line 479 of file register.cc.

480 {
481  std::vector<std::string> args;
482  char *s = strdup(command.c_str());
483  for (char *p = strtok(s, " \t\r\n"); p; p = strtok(NULL, " \t\r\n"))
484  args.push_back(p);
485  free(s);
486  backend_call(design, f, filename, args);
487 }
void free(void *)
static void backend_call(RTLIL::Design *design, std::ostream *f, std::string filename, std::string command)
Definition: register.cc:479
#define NULL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Backend::backend_call ( RTLIL::Design design,
std::ostream *  f,
std::string  filename,
std::vector< std::string >  args 
)
staticinherited

Definition at line 489 of file register.cc.

490 {
491  if (args.size() == 0)
492  return;
493  if (backend_register.count(args[0]) == 0)
494  log_cmd_error("No such backend: %s\n", args[0].c_str());
495 
496  size_t orig_sel_stack_pos = design->selection_stack.size();
497 
498  if (f != NULL) {
499  auto state = backend_register[args[0]]->pre_execute();
500  backend_register[args[0]]->execute(f, filename, args, design);
501  backend_register[args[0]]->post_execute(state);
502  } else if (filename == "-") {
503  std::ostream *f_cout = &std::cout;
504  auto state = backend_register[args[0]]->pre_execute();
505  backend_register[args[0]]->execute(f_cout, "<stdout>", args, design);
506  backend_register[args[0]]->post_execute(state);
507  } else {
508  if (!filename.empty())
509  args.push_back(filename);
510  backend_register[args[0]]->execute(args, design);
511  }
512 
513  while (design->selection_stack.size() > orig_sel_stack_pos)
514  design->selection_stack.pop_back();
515 
516  design->check();
517 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
void check()
Definition: rtlil.cc:357
void log_cmd_error(const char *format,...)
Definition: log.cc:211
#define NULL
std::map< std::string, Backend * > backend_register
Definition: register.cc:36

+ Here is the call graph for this function:

void Pass::call ( RTLIL::Design design,
std::string  command 
)
staticinherited

Definition at line 146 of file register.cc.

147 {
148  std::vector<std::string> args;
149 
150  std::string cmd_buf = command;
151  std::string tok = next_token(cmd_buf, " \t\r\n");
152 
153  if (tok.empty() || tok[0] == '#')
154  return;
155 
156  if (tok[0] == '!') {
157  cmd_buf = command.substr(command.find('!') + 1);
158  while (!cmd_buf.empty() && (cmd_buf.back() == ' ' || cmd_buf.back() == '\t' ||
159  cmd_buf.back() == '\r' || cmd_buf.back() == '\n'))
160  cmd_buf.resize(cmd_buf.size()-1);
161  log_header("Shell command: %s\n", cmd_buf.c_str());
162  int retCode = run_command(cmd_buf);
163  if (retCode != 0)
164  log_cmd_error("Shell command returned error code %d.\n", retCode);
165  return;
166  }
167 
168  while (!tok.empty()) {
169  if (tok == "#")
170  break;
171  if (tok.back() == ';') {
172  int num_semikolon = 0;
173  while (!tok.empty() && tok.back() == ';')
174  tok.resize(tok.size()-1), num_semikolon++;
175  if (!tok.empty())
176  args.push_back(tok);
177  call(design, args);
178  args.clear();
179  if (num_semikolon == 2)
180  call(design, "clean");
181  if (num_semikolon == 3)
182  call(design, "clean -purge");
183  } else
184  args.push_back(tok);
185  tok = next_token(cmd_buf, " \t\r\n");
186  }
187 
188  call(design, args);
189 }
static std::string next_token(bool pass_newline=false)
Definition: preproc.cc:96
void log_header(const char *format,...)
Definition: log.cc:188
int run_command(const std::string &command, std::function< void(const std::string &)> process_line)
Definition: yosys.cc:195
void log_cmd_error(const char *format,...)
Definition: log.cc:211
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::call ( RTLIL::Design design,
std::vector< std::string >  args 
)
staticinherited

Definition at line 191 of file register.cc.

192 {
193  if (args.size() == 0 || args[0][0] == '#')
194  return;
195 
196  if (echo_mode) {
197  log("%s", create_prompt(design, 0));
198  for (size_t i = 0; i < args.size(); i++)
199  log("%s%s", i ? " " : "", args[i].c_str());
200  log("\n");
201  }
202 
203  if (pass_register.count(args[0]) == 0)
204  log_cmd_error("No such command: %s (type 'help' for a command overview)\n", args[0].c_str());
205 
206  size_t orig_sel_stack_pos = design->selection_stack.size();
207  auto state = pass_register[args[0]]->pre_execute();
208  pass_register[args[0]]->execute(args, design);
209  pass_register[args[0]]->post_execute(state);
210  while (design->selection_stack.size() > orig_sel_stack_pos)
211  design->selection_stack.pop_back();
212 
213  design->check();
214 }
bool echo_mode
Definition: register.cc:30
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
const char * create_prompt(RTLIL::Design *design, int recursion_counter)
Definition: yosys.cc:400
void check()
Definition: rtlil.cc:357
void log_cmd_error(const char *format,...)
Definition: log.cc:211
void log(const char *format,...)
Definition: log.cc:180
std::map< std::string, Pass * > pass_register
Definition: register.cc:35

+ Here is the call graph for this function:

void Pass::call_on_module ( RTLIL::Design design,
RTLIL::Module module,
std::string  command 
)
staticinherited

Definition at line 240 of file register.cc.

241 {
242  std::string backup_selected_active_module = design->selected_active_module;
243  design->selected_active_module = module->name.str();
244  design->selection_stack.push_back(RTLIL::Selection(false));
245  design->selection_stack.back().select(module);
246 
247  Pass::call(design, command);
248 
249  design->selection_stack.pop_back();
250  design->selected_active_module = backup_selected_active_module;
251 }
std::string str() const
Definition: rtlil.h:182
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
RTLIL::IdString name
Definition: rtlil.h:599
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::call_on_module ( RTLIL::Design design,
RTLIL::Module module,
std::vector< std::string >  args 
)
staticinherited

Definition at line 253 of file register.cc.

254 {
255  std::string backup_selected_active_module = design->selected_active_module;
256  design->selected_active_module = module->name.str();
257  design->selection_stack.push_back(RTLIL::Selection(false));
258  design->selection_stack.back().select(module);
259 
260  Pass::call(design, args);
261 
262  design->selection_stack.pop_back();
263  design->selected_active_module = backup_selected_active_module;
264 }
std::string str() const
Definition: rtlil.h:182
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
RTLIL::IdString name
Definition: rtlil.h:599
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::call_on_selection ( RTLIL::Design design,
const RTLIL::Selection selection,
std::string  command 
)
staticinherited

Definition at line 216 of file register.cc.

217 {
218  std::string backup_selected_active_module = design->selected_active_module;
219  design->selected_active_module.clear();
220  design->selection_stack.push_back(selection);
221 
222  Pass::call(design, command);
223 
224  design->selection_stack.pop_back();
225  design->selected_active_module = backup_selected_active_module;
226 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::call_on_selection ( RTLIL::Design design,
const RTLIL::Selection selection,
std::vector< std::string >  args 
)
staticinherited

Definition at line 228 of file register.cc.

229 {
230  std::string backup_selected_active_module = design->selected_active_module;
231  design->selected_active_module.clear();
232  design->selection_stack.push_back(selection);
233 
234  Pass::call(design, args);
235 
236  design->selection_stack.pop_back();
237  design->selected_active_module = backup_selected_active_module;
238 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::cmd_error ( const std::vector< std::string > &  args,
size_t  argidx,
std::string  msg 
)
inherited

Definition at line 110 of file register.cc.

111 {
112  std::string command_text;
113  int error_pos = 0;
114 
115  for (size_t i = 0; i < args.size(); i++) {
116  if (i < argidx)
117  error_pos += args[i].size() + 1;
118  command_text = command_text + (command_text.empty() ? "" : " ") + args[i];
119  }
120 
121  log("\nSyntax error in command `%s':\n", command_text.c_str());
122  help();
123 
124  log_cmd_error("Command syntax error: %s\n> %s\n> %*s^\n",
125  msg.c_str(), command_text.c_str(), error_pos, "");
126 }
virtual void help()
Definition: register.cc:93
void log_cmd_error(const char *format,...)
Definition: log.cc:211
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::cmd_log_args ( const std::vector< std::string > &  args)
inherited

Definition at line 100 of file register.cc.

101 {
102  if (args.size() <= 1)
103  return;
104  log("Full command line:");
105  for (size_t i = 0; i < args.size(); i++)
106  log(" %s", args[i].c_str());
107  log("\n");
108 }
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

void Pass::done_register ( )
staticinherited

Definition at line 62 of file register.cc.

63 {
64  frontend_register.clear();
65  pass_register.clear();
66  backend_register.clear();
68 }
std::map< std::string, Frontend * > frontend_register
Definition: register.cc:34
Pass * first_queued_pass
Definition: register.cc:31
#define log_assert(_assert_expr_)
Definition: log.h:85
#define NULL
std::map< std::string, Pass * > pass_register
Definition: register.cc:35
std::map< std::string, Backend * > backend_register
Definition: register.cc:36

+ Here is the caller graph for this function:

void Backend::execute ( std::vector< std::string >  args,
RTLIL::Design design 
)
virtualinherited

Implements Pass.

Definition at line 429 of file register.cc.

430 {
431  std::ostream *f = NULL;
432  auto state = pre_execute();
433  execute(f, std::string(), args, design);
434  post_execute(state);
435  if (f != &std::cout)
436  delete f;
437 }
virtual void execute(std::vector< std::string > args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL
Definition: register.cc:429
#define NULL
pre_post_exec_state_t pre_execute()
Definition: register.cc:74
void post_execute(pre_post_exec_state_t state)
Definition: register.cc:84

+ Here is the call graph for this function:

virtual void BlifBackend::execute ( std::ostream *&  f,
std::string  filename,
std::vector< std::string >  args,
RTLIL::Design design 
)
inlinevirtual

Implements Backend.

Definition at line 346 of file blif.cc.

347  {
348  std::string top_module_name;
349  std::string buf_type, buf_in, buf_out;
350  std::string true_type, true_out;
351  std::string false_type, false_out;
352  BlifDumperConfig config;
353 
354  log_header("Executing BLIF backend.\n");
355 
356  size_t argidx;
357  for (argidx = 1; argidx < args.size(); argidx++)
358  {
359  if (args[argidx] == "-top" && argidx+1 < args.size()) {
360  top_module_name = args[++argidx];
361  continue;
362  }
363  if (args[argidx] == "-buf" && argidx+3 < args.size()) {
364  config.buf_type = args[++argidx];
365  config.buf_in = args[++argidx];
366  config.buf_out = args[++argidx];
367  continue;
368  }
369  if (args[argidx] == "-unbuf" && argidx+3 < args.size()) {
370  RTLIL::IdString unbuf_type = RTLIL::escape_id(args[++argidx]);
371  RTLIL::IdString unbuf_in = RTLIL::escape_id(args[++argidx]);
372  RTLIL::IdString unbuf_out = RTLIL::escape_id(args[++argidx]);
373  config.unbuf_types[unbuf_type] = std::pair<RTLIL::IdString, RTLIL::IdString>(unbuf_in, unbuf_out);
374  continue;
375  }
376  if (args[argidx] == "-true" && argidx+2 < args.size()) {
377  config.true_type = args[++argidx];
378  config.true_out = args[++argidx];
379  continue;
380  }
381  if (args[argidx] == "-false" && argidx+2 < args.size()) {
382  config.false_type = args[++argidx];
383  config.false_out = args[++argidx];
384  continue;
385  }
386  if (args[argidx] == "-undef" && argidx+2 < args.size()) {
387  config.undef_type = args[++argidx];
388  config.undef_out = args[++argidx];
389  continue;
390  }
391  if (args[argidx] == "-icells") {
392  config.icells_mode = true;
393  continue;
394  }
395  if (args[argidx] == "-gates") {
396  config.gates_mode = true;
397  continue;
398  }
399  if (args[argidx] == "-conn") {
400  config.conn_mode = true;
401  continue;
402  }
403  if (args[argidx] == "-param") {
404  config.param_mode = true;
405  continue;
406  }
407  if (args[argidx] == "-blackbox") {
408  config.blackbox_mode = true;
409  continue;
410  }
411  if (args[argidx] == "-impltf") {
412  config.impltf_mode = true;
413  continue;
414  }
415  break;
416  }
417  extra_args(f, filename, args, argidx);
418 
419  if (top_module_name.empty())
420  for (auto & mod_it:design->modules_)
421  if (mod_it.second->get_bool_attribute("\\top"))
422  top_module_name = mod_it.first.str();
423 
424  *f << stringf("# Generated by %s\n", yosys_version_str);
425 
426  std::vector<RTLIL::Module*> mod_list;
427 
428  for (auto module_it : design->modules_)
429  {
430  RTLIL::Module *module = module_it.second;
431  if (module->get_bool_attribute("\\blackbox") && !config.blackbox_mode)
432  continue;
433 
434  if (module->processes.size() != 0)
435  log_error("Found unmapped processes in module %s: unmapped processes are not supported in BLIF backend!\n", RTLIL::id2cstr(module->name));
436  if (module->memories.size() != 0)
437  log_error("Found munmapped emories in module %s: unmapped memories are not supported in BLIF backend!\n", RTLIL::id2cstr(module->name));
438 
439  if (module->name == RTLIL::escape_id(top_module_name)) {
440  BlifDumper::dump(*f, module, design, config);
441  top_module_name.clear();
442  continue;
443  }
444 
445  mod_list.push_back(module);
446  }
447 
448  if (!top_module_name.empty())
449  log_error("Can't find top module `%s'!\n", top_module_name.c_str());
450 
451  for (auto module : mod_list)
452  BlifDumper::dump(*f, module, design, config);
453  }
const char * yosys_version_str
std::map< RTLIL::IdString, std::pair< RTLIL::IdString, RTLIL::IdString > > unbuf_types
Definition: blif.cc:44
std::string undef_out
Definition: blif.cc:45
std::string stringf(const char *fmt,...)
Definition: yosys.cc:58
bool impltf_mode
Definition: blif.cc:38
std::string true_out
Definition: blif.cc:45
bool conn_mode
Definition: blif.cc:37
void log_header(const char *format,...)
Definition: log.cc:188
std::map< RTLIL::IdString, RTLIL::Memory * > memories
Definition: rtlil.h:601
void log_error(const char *format,...)
Definition: log.cc:204
RTLIL::Module * module
Definition: abc.cc:94
std::string true_type
Definition: blif.cc:45
bool param_mode
Definition: blif.cc:40
static std::string escape_id(std::string str)
Definition: rtlil.h:251
bool blackbox_mode
Definition: blif.cc:41
bool icells_mode
Definition: blif.cc:36
void extra_args(std::ostream *&f, std::string &filename, std::vector< std::string > args, size_t argidx)
Definition: register.cc:439
void dump()
Definition: blif.cc:106
RTLIL::IdString name
Definition: rtlil.h:599
std::string false_type
Definition: blif.cc:45
static const char * id2cstr(const RTLIL::IdString &str)
Definition: rtlil.h:267
std::string false_out
Definition: blif.cc:45
std::map< RTLIL::IdString, RTLIL::Process * > processes
Definition: rtlil.h:602
std::map< RTLIL::IdString, RTLIL::Module * > modules_
Definition: rtlil.h:507
std::string buf_out
Definition: blif.cc:43
std::string undef_type
Definition: blif.cc:45
std::string buf_in
Definition: blif.cc:43
bool gates_mode
Definition: blif.cc:39
std::string buf_type
Definition: blif.cc:43

+ Here is the call graph for this function:

void Pass::extra_args ( std::vector< std::string >  args,
size_t  argidx,
RTLIL::Design design,
bool  select = true 
)
inherited

Definition at line 128 of file register.cc.

129 {
130  for (; argidx < args.size(); argidx++)
131  {
132  std::string arg = args[argidx];
133 
134  if (arg.substr(0, 1) == "-")
135  cmd_error(args, argidx, "Unknown option or option in arguments.");
136 
137  if (!select)
138  cmd_error(args, argidx, "Extra argument.");
139 
140  handle_extra_select_args(this, args, argidx, args.size(), design);
141  break;
142  }
143  // cmd_log_args(args);
144 }
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
Definition: register.cc:110
void handle_extra_select_args(Pass *pass, std::vector< std::string > args, size_t argidx, size_t args_size, RTLIL::Design *design)
Definition: select.cc:803

+ Here is the call graph for this function:

void Backend::extra_args ( std::ostream *&  f,
std::string &  filename,
std::vector< std::string >  args,
size_t  argidx 
)
inherited

Definition at line 439 of file register.cc.

440 {
441  bool called_with_fp = f != NULL;
442 
443  for (; argidx < args.size(); argidx++)
444  {
445  std::string arg = args[argidx];
446 
447  if (arg.substr(0, 1) == "-" && arg != "-")
448  cmd_error(args, argidx, "Unknown option or option in arguments.");
449  if (f != NULL)
450  cmd_error(args, argidx, "Extra filename argument in direct file mode.");
451 
452  if (arg == "-") {
453  filename = "<stdout>";
454  f = &std::cout;
455  continue;
456  }
457 
458  filename = arg;
459  std::ofstream *ff = new std::ofstream;
460  ff->open(filename.c_str(), std::ofstream::trunc);
461  if (ff->fail()) {
462  delete ff;
463  log_cmd_error("Can't open output file `%s' for writing: %s\n", filename.c_str(), strerror(errno));
464  }
465  f = ff;
466  }
467 
468  if (called_with_fp)
469  args.push_back(filename);
470  args[0] = pass_name;
471  // cmd_log_args(args);
472 
473  if (f == NULL) {
474  filename = "<stdout>";
475  f = &std::cout;
476  }
477 }
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
Definition: register.cc:110
std::string pass_name
Definition: register.h:29
void log_cmd_error(const char *format,...)
Definition: log.cc:211
#define NULL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void BlifBackend::help ( )
inlinevirtual

Reimplemented from Pass.

Definition at line 294 of file blif.cc.

295  {
296  // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
297  log("\n");
298  log(" write_blif [options] [filename]\n");
299  log("\n");
300  log("Write the current design to an BLIF file.\n");
301  log("\n");
302  log(" -top top_module\n");
303  log(" set the specified module as design top module\n");
304  log("\n");
305  log(" -buf <cell-type> <in-port> <out-port>\n");
306  log(" use cells of type <cell-type> with the specified port names for buffers\n");
307  log("\n");
308  log(" -unbuf <cell-type> <in-port> <out-port>\n");
309  log(" replace buffer cells with the specified name and port names with\n");
310  log(" a .names statement that models a buffer\n");
311  log("\n");
312  log(" -true <cell-type> <out-port>\n");
313  log(" -false <cell-type> <out-port>\n");
314  log(" -undef <cell-type> <out-port>\n");
315  log(" use the specified cell types to drive nets that are constant 1, 0, or\n");
316  log(" undefined. when '-' is used as <cell-type>, then <out-port> specifies\n");
317  log(" the wire name to be used for the constant signal and no cell driving\n");
318  log(" that wire is generated.\n");
319  log("\n");
320  log("The following options can be useful when the generated file is not going to be\n");
321  log("read by a BLIF parser but a custom tool. It is recommended to not name the output\n");
322  log("file *.blif when any of this options is used.\n");
323  log("\n");
324  log(" -icells\n");
325  log(" do not translate Yosys's internal gates to generic BLIF logic\n");
326  log(" functions. Instead create .subckt or .gate lines for all cells.\n");
327  log("\n");
328  log(" -gates\n");
329  log(" print .gate instead of .subckt lines for all cells that are not\n");
330  log(" instantiations of other modules from this design.\n");
331  log("\n");
332  log(" -conn\n");
333  log(" do not generate buffers for connected wires. instead use the\n");
334  log(" non-standard .conn statement.\n");
335  log("\n");
336  log(" -param\n");
337  log(" use the non-standard .param statement to write module parameters\n");
338  log("\n");
339  log(" -blackbox\n");
340  log(" write blackbox cells with .blackbox statement.\n");
341  log("\n");
342  log(" -impltf\n");
343  log(" do not write definitions for the $true, $false and $undef wires.\n");
344  log("\n");
345  }
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

void Pass::init_register ( )
staticinherited

Definition at line 54 of file register.cc.

55 {
56  while (first_queued_pass) {
59  }
60 }
Pass * first_queued_pass
Definition: register.cc:31
Pass * next_queued_pass
Definition: register.h:60
virtual void run_register()
Definition: register.cc:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::post_execute ( Pass::pre_post_exec_state_t  state)
inherited

Definition at line 84 of file register.cc.

85 {
86  int64_t time_ns = PerformanceTimer::query() - state.begin_ns;
87  runtime_ns += time_ns;
88  current_pass = state.parent_pass;
89  if (current_pass)
90  current_pass->runtime_ns -= time_ns;
91 }
static int64_t query()
Definition: log.h:151
int64_t runtime_ns
Definition: register.h:37
Pass * current_pass
Definition: register.cc:32
Pass * parent_pass
Definition: register.h:40
int64_t begin_ns
Definition: register.h:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Pass::pre_post_exec_state_t Pass::pre_execute ( )
inherited

Definition at line 74 of file register.cc.

75 {
76  pre_post_exec_state_t state;
77  call_counter++;
78  state.begin_ns = PerformanceTimer::query();
79  state.parent_pass = current_pass;
80  current_pass = this;
81  return state;
82 }
static int64_t query()
Definition: log.h:151
Pass * current_pass
Definition: register.cc:32
int call_counter
Definition: register.h:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Backend::run_register ( )
virtualinherited

Reimplemented from Pass.

Definition at line 416 of file register.cc.

417 {
418  log_assert(pass_register.count(pass_name) == 0);
419  pass_register[pass_name] = this;
420 
423 }
std::string pass_name
Definition: register.h:29
#define log_assert(_assert_expr_)
Definition: log.h:85
std::string backend_name
Definition: register.h:88
std::map< std::string, Pass * > pass_register
Definition: register.cc:35
std::map< std::string, Backend * > backend_register
Definition: register.cc:36

Field Documentation

std::string Backend::backend_name
inherited

Definition at line 88 of file register.h.

int Pass::call_counter
inherited

Definition at line 36 of file register.h.

Pass* Pass::next_queued_pass
inherited

Definition at line 60 of file register.h.

std::string Pass::pass_name
inherited

Definition at line 29 of file register.h.

int64_t Pass::runtime_ns
inherited

Definition at line 37 of file register.h.

std::string Pass::short_help
inherited

Definition at line 29 of file register.h.


The documentation for this struct was generated from the following file: