Commit 1a9f131a authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

API to enable dumping

parent 12f260b0
......@@ -291,6 +291,12 @@ FIRM_API size_t get_irp_n_asms(void);
/** Return the global asm include at position pos. */
FIRM_API ident *get_irp_asm(size_t pos);
/** Return whether optimization dump vcg graphs */
FIRM_API int get_irp_optimization_dumps(void);
/** Enable vcg dumping of optimization */
FIRM_API void enable_irp_optimization_dumps(void);
#include "end.h"
#endif
......@@ -140,6 +140,20 @@ static inline ir_label_t _get_irp_next_label_nr(void)
return ++irp->last_label_nr;
}
/** Whether optimizations should dump irgs */
static inline int _get_irp_optimization_dumps(void)
{
assert(irp);
return irp->optimization_dumps;
}
/** Set optimizations to dump irgs */
static inline void _enable_irp_optimization_dumps(void)
{
assert(irp);
irp->optimization_dumps = 1;
}
void set_irp_ip_outedges(ir_node ** ip_outedges);
ir_node** get_irp_ip_outedges(void);
......@@ -164,5 +178,7 @@ void init_irprog_2(void);
#define get_tls_type() _get_tls_type()
#define get_irp_next_region_nr() _get_irp_next_region_nr()
#define get_irp_next_label_nr() _get_irp_next_label_nr()
#define get_irp_optimization_dumps() _get_irp_optimization_dumps()
#define enable_irp_optimization_dumps() _enable_irp_optimization_dumps()
#endif
......@@ -608,6 +608,7 @@ struct ir_prog {
size_t max_irg_idx; /**< highest unused irg index */
long max_node_nr; /**< to generate unique numbers for nodes. */
unsigned dump_nr; /**< number of program info dumps */
unsigned optimization_dumps :1; /**< dump irg on each optimization */
#ifndef NDEBUG
ir_resources_t reserved_resources; /**< Bitset for tracking used global resources. */
#endif
......
......@@ -4,6 +4,7 @@
#include <stdbool.h>
#include "irgraph_t.h"
#include "irprog_t.h"
#include "iroptimize.h"
#include "irgopt.h"
......@@ -14,9 +15,6 @@
#include "irdump.h"
#include "opt_manage.h"
// TODO some API to enable dumping
static const bool dump_opts = false;
static void deactivate_entity_usage(ir_graph *irg)
{
set_irg_entity_usage_state(irg, ir_entity_usage_not_computed);
......@@ -62,12 +60,12 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt)
PREPARE(IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS, compute_extbb)
/* now all the requirements for the optimization are fulfilled */
if (dump_opts)
if (dump)
dump_ir_graph(irg, opt->name);
new_irg_state = opt->optimization(irg);
if (dump_opts)
if (dump)
dump_ir_graph(irg, opt->name);
/* unless the optimization returned that some state is retained,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment