Committed to dmalcolm/jit: gcc/jit/ * internal-api.h (gcc::jit::context::get_str_option): New access method. (gcc::jit::context::get_int_option): Likewise.
* internal-api.c (gcc::jit::context::~context): Use access methods for options, rather than direct field access. (gcc::jit::context::compile): Likewise. --- gcc/jit/ChangeLog.jit | 10 ++++++++++ gcc/jit/internal-api.c | 20 ++++++++++---------- gcc/jit/internal-api.h | 12 ++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index f4127d1..cdf9ddb 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,13 @@ +2014-01-24 David Malcolm <dmalc...@redhat.com> + + * internal-api.h (gcc::jit::context::get_str_option): New access + method. + (gcc::jit::context::get_int_option): Likewise. + + * internal-api.c (gcc::jit::context::~context): Use access methods + for options, rather than direct field access. + (gcc::jit::context::compile): Likewise. + 2014-01-23 David Malcolm <dmalc...@redhat.com> * libgccjit.h (enum gcc_jit_bool_option): New value: diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index 869185a..32af625 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -24,7 +24,7 @@ gcc::jit::context:: ~context () { - if (m_bool_options[GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES]) + if (get_bool_option (GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES)) fprintf (stderr, "intermediate files written to %s\n", m_path_tempdir); else { @@ -1213,7 +1213,7 @@ compile () /* Pass in user-provided "progname", if any, so that it makes it into GCC's "progname" global, used in various diagnostics. */ - progname = m_str_options[GCC_JIT_STR_OPTION_PROGNAME]; + progname = get_str_option (GCC_JIT_STR_OPTION_PROGNAME); fake_args[0] = progname ? progname : "libgccjit.so"; fake_args[1] = m_path_c_file; @@ -1230,11 +1230,11 @@ compile () ADD_ARG ("-fPIC"); /* Handle int options: */ - switch (m_int_options[GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL]) + switch (get_int_option (GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL)) { default: add_error ("unrecognized optimization level: %i", - m_int_options[GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL]); + get_int_option (GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL)); goto error; case 0: @@ -1256,18 +1256,18 @@ compile () /* What about -Os? */ /* Handle bool options: */ - if (m_bool_options[GCC_JIT_BOOL_OPTION_DEBUGINFO]) + if (get_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO)) ADD_ARG ("-g"); /* Suppress timing (and other) info. */ - if (!m_bool_options[GCC_JIT_BOOL_OPTION_DUMP_SUMMARY]) + if (!get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_SUMMARY)) { ADD_ARG ("-quiet"); quiet_flag = 1; } /* Aggressively garbage-collect, to shake out bugs: */ - if (m_bool_options[GCC_JIT_BOOL_OPTION_SELFCHECK_GC]) + if (get_bool_option (GCC_JIT_BOOL_OPTION_SELFCHECK_GC)) { ADD_ARG ("--param"); ADD_ARG ("ggc-min-expand=0"); @@ -1275,7 +1275,7 @@ compile () ADD_ARG ("ggc-min-heapsize=0"); } - if (m_bool_options[GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING]) + if (get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING)) { ADD_ARG ("-fdump-tree-all"); ADD_ARG ("-fdump-rtl-all"); @@ -1302,8 +1302,8 @@ compile () goto error; } - if (m_bool_options[GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE]) - dump_generated_code (); + if (get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE)) + dump_generated_code (); timevar_push (TV_ASSEMBLE); diff --git a/gcc/jit/internal-api.h b/gcc/jit/internal-api.h index b226c23..3f0e9eb 100644 --- a/gcc/jit/internal-api.h +++ b/gcc/jit/internal-api.h @@ -135,6 +135,18 @@ public: set_bool_option (enum gcc_jit_bool_option opt, int value); + const char * + get_str_option (enum gcc_jit_str_option opt) const + { + return m_str_options[opt]; + } + + int + get_int_option (enum gcc_jit_int_option opt) const + { + return m_int_options[opt]; + } + int get_bool_option (enum gcc_jit_bool_option opt) const { -- 1.7.11.7