2014-11-11 22:55:52 +01:00
|
|
|
/* jit.c -- Dummy "frontend" for use during JIT-compilation.
|
2015-01-05 13:36:59 +01:00
|
|
|
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
2014-11-11 22:55:52 +01:00
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "opts.h"
|
Fix the jit build after header flattening of r219402
gcc/jit/ChangeLog:
* dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
"symtab.h", "inchash.h". Move include of "hash-set.h" much
earlier.
* jit-builtins.c: Remove redundant includes of "opts.h" and
"tree.h".
* jit-common.h: Include "hash-set.h", "input.h", "vec.h",
"double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
* jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
"statistics.h", "vec.h", "double-int.h", "real.h",
"fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
"inchash.h", "fold-const.h". Move include of "hash-set.h" to
earlier.
* jit-recording.c: Remove redundant includes of "opts.h" and
"tree.h".
From-SVN: r219411
2015-01-09 22:45:33 +01:00
|
|
|
#include "alias.h"
|
|
|
|
#include "flags.h"
|
|
|
|
#include "symtab.h"
|
2014-11-11 22:55:52 +01:00
|
|
|
#include "tree-core.h"
|
|
|
|
#include "stor-layout.h"
|
Fix the jit build after header flattening of r219402
gcc/jit/ChangeLog:
* dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
"symtab.h", "inchash.h". Move include of "hash-set.h" much
earlier.
* jit-builtins.c: Remove redundant includes of "opts.h" and
"tree.h".
* jit-common.h: Include "hash-set.h", "input.h", "vec.h",
"double-int.h", "alias.h", "flags.h", "symtab.h", "inchash.h".
* jit-playback.c: Include "hashtab.h", "machmode.h", "input.h",
"statistics.h", "vec.h", "double-int.h", "real.h",
"fixed-value.h", "alias.h", "flags.h", "symtab.h", "tree-core.h",
"inchash.h", "fold-const.h". Move include of "hash-set.h" to
earlier.
* jit-recording.c: Remove redundant includes of "opts.h" and
"tree.h".
From-SVN: r219411
2015-01-09 22:45:33 +01:00
|
|
|
#include "inchash.h"
|
2014-11-11 22:55:52 +01:00
|
|
|
#include "tree.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "langhooks.h"
|
|
|
|
#include "langhooks-def.h"
|
|
|
|
#include "hash-map.h"
|
|
|
|
#include "vec.h"
|
|
|
|
#include "hashtab.h"
|
|
|
|
#include "tm.h"
|
|
|
|
#include "hard-reg-set.h"
|
|
|
|
#include "function.h"
|
|
|
|
#include "dumpfile.h"
|
|
|
|
#include "cgraph.h"
|
|
|
|
|
|
|
|
#include "jit-common.h"
|
New jit API entrypoint: gcc_jit_context_set_logfile
gcc/jit/ChangeLog:
* Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
* docs/internals/index.rst (Overview of code structure): Mention
gcc_jit_context_set_logfile, and embed the example logfile.
* docs/internals/test-hello-world.exe.log.txt: New file: example
of a logfile.
* docs/topics/contexts.rst (Debugging): Add documentation
for gcc_jit_context_set_logfile.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* dummy-frontend.c: Include "jit-logging.h".
(jit_langhook_init): Assert that there is an active playback
context. If it has a logger, log entry/exit to this function.
(jit_langhook_write_globals): Likewise.
* jit-common.h (gcc::jit::logger): New forward declaration.
* jit-logging.c: New file.
* jit-logging.h: New file.
* jit-playback.c: Include "jit-logging.h".
(gcc::jit::playback::context::context): Initialize the log_user
base class from the recording context's logger (if any). Use
JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::build_stmt_list): Likewise.
(gcc::jit::playback::function::postprocess): Likewise.
(gcc::jit::playback::context::compile): Likewise. Log the
entry/exit to toplev::main and toplev::finalize. Log the
fake argv passed to toplev::main.
(gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::release_mutex): Likewise.
(gcc::jit::playback::context::make_fake_args): Likewise.
(gcc::jit::playback::context::extract_any_requested_dumps):
Likewise.
(gcc::jit::playback::context::convert_to_dso): Likewise. Also,
log the arguments that the driver is invoked with.
(gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
the logger to the result object.
(gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::dump_generated_code): Likewise.
(gcc::jit::playback::context::handle_locations): Likewise.
* jit-playback.h (gcc::jit::playback::context): Make this be
a subclass of gcc::jit::log_user.
* jit-recording.c: Include "jit-logging.h".
(gcc::jit::recording::context::context: Initialize the logger to
NULL for root contexts, or to the parent's logger for child
contexts.
(gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::recording::context::replay_into): Likewise.
(gcc::jit::recording::context::disassociate_from_playback):
Likewise.
(gcc::jit::recording::context::compile): Likewise.
(recording::context::add_error_va): Likewise. Also, log the
error.
(gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
* jit-recording.h: Include "jit-logging.h".
(gcc::jit::recording::context): Make this be a subclass of
gcc::jit::log_user.
* jit-result.c: Include "jit-common.h" and "jit-logging.h".
(gcc::jit::result::result): Add logger param, recording it.
Use JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::result::get_code): Likewise.
* jit-result.h (gcc::jit::result): Make this be a subclass of
gcc::jit::log_user.
(gcc::jit::result::result): Add logger parameter.
* libgccjit++.h (gccjit::context::set_logfile): New function.
* libgccjit.c: Include "jit-logging.h".
(gcc_jit_context_acquire): Log the context.
(gcc_jit_context_release): Use JIT_LOG_FUNC to
log entry/exit from the function body, and log the context.
(gcc_jit_context_new_child_context): Likewise, logging both
contexts.
(gcc_jit_context_new_location): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_context_get_type): Likewise.
(gcc_jit_context_get_int_type): Likewise.
(gcc_jit_context_new_array_type): Likewise.
(gcc_jit_context_new_field): Likewise.
(gcc_jit_context_new_struct_type): Likewise.
(gcc_jit_context_new_opaque_struct): Likewise.
(gcc_jit_struct_set_fields): Likewise.
(gcc_jit_context_new_union_type): Likewise.
(gcc_jit_context_new_function_ptr_type): Likewise.
(gcc_jit_context_new_param): Likewise.
(gcc_jit_context_new_function): Likewise.
(gcc_jit_context_get_builtin_function): Likewise.
(gcc_jit_function_get_param): Likewise.
(gcc_jit_function_dump_to_dot): Likewise.
(gcc_jit_function_new_block): Likewise.
(gcc_jit_context_new_global): Likewise.
(gcc_jit_context_new_rvalue_from_int): Likewise.
(gcc_jit_context_zero): Likewise.
(gcc_jit_context_one): Likewise.
(gcc_jit_context_new_rvalue_from_double): Likewise.
(gcc_jit_context_new_rvalue_from_ptr): Likewise.
(gcc_jit_context_null): Likewise.
(gcc_jit_context_new_string_literal): Likewise.
(gcc_jit_context_new_unary_op): Likewise.
(gcc_jit_context_new_binary_op): Likewise.
(gcc_jit_context_new_comparison): Likewise.
(gcc_jit_context_new_call): Likewise.
(gcc_jit_context_new_call_through_ptr): Likewise.
(gcc_jit_context_new_cast): Likewise.
(gcc_jit_context_new_array_access): Likewise.
(gcc_jit_lvalue_access_field): Likewise.
(gcc_jit_rvalue_access_field): Likewise.
(gcc_jit_rvalue_dereference_field): Likewise.
(gcc_jit_rvalue_dereference): Likewise.
(gcc_jit_lvalue_get_address): Likewise.
(gcc_jit_function_new_local): Likewise.
(gcc_jit_block_add_eval): Likewise.
(gcc_jit_block_add_assignment): Likewise.
(gcc_jit_block_add_assignment_op): Likewise.
(gcc_jit_block_end_with_conditional): Likewise.
(gcc_jit_block_add_comment): Likewise.
(gcc_jit_block_end_with_jump): Likewise.
(gcc_jit_block_end_with_return): Likewise.
(gcc_jit_block_end_with_void_return): Likewise.
(gcc_jit_context_set_str_option): Likewise.
(gcc_jit_context_set_int_option): Likewise.
(gcc_jit_context_set_bool_option): Likewise.
(gcc_jit_context_enable_dump): Likewise.
(gcc_jit_context_compile): Likewise. Also log the context,
and the result.
(gcc_jit_context_dump_to_file): Likewise.
(gcc_jit_context_set_logfile): New function.
(gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_result_get_code): Likewise. Also log the fnname)
and the ptr to be returned.
(gcc_jit_result_release): Likewise. Also log the result.
* libgccjit.h: Include <stdio.h>, since we need FILE *.
(gcc_jit_context_set_logfile): New declaration.
* libgccjit.map (gcc_jit_context_set_logfile): New.
gcc/testsuite/ChangeLog:
* jit.dg/harness.h (set_up_logging): New function.
(test_jit): Fail if gcc_jit_context_acquire fails. Call
set_up_logging on the context, so that every testcase is
logged to a particular file.
* jit.dg/test-nested-contexts.c (main): Open a logfile,
and call gcc_jit_context_set_logfile on the top-level context.
From-SVN: r219357
2015-01-08 20:41:07 +01:00
|
|
|
#include "jit-logging.h"
|
2014-11-11 22:55:52 +01:00
|
|
|
#include "jit-playback.h"
|
|
|
|
|
|
|
|
#include <mpfr.h>
|
|
|
|
|
|
|
|
/* Language-dependent contents of a type. */
|
|
|
|
|
|
|
|
struct GTY(()) lang_type
|
|
|
|
{
|
|
|
|
char dummy;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Language-dependent contents of a decl. */
|
|
|
|
|
|
|
|
struct GTY((variable_size)) lang_decl
|
|
|
|
{
|
|
|
|
char dummy;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Language-dependent contents of an identifier. This must include a
|
|
|
|
tree_identifier. */
|
|
|
|
|
|
|
|
struct GTY(()) lang_identifier
|
|
|
|
{
|
|
|
|
struct tree_identifier common;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The resulting tree type. */
|
|
|
|
|
|
|
|
union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
|
|
|
|
chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
|
|
|
|
lang_tree_node
|
|
|
|
{
|
|
|
|
union tree_node GTY((tag ("0"),
|
|
|
|
desc ("tree_node_structure (&%h)"))) generic;
|
|
|
|
struct lang_identifier GTY((tag ("1"))) identifier;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* We don't use language_function. */
|
|
|
|
|
|
|
|
struct GTY(()) language_function
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* GC-marking callback for use from jit_root_tab.
|
|
|
|
|
|
|
|
If there's an active playback context, call its marking method
|
|
|
|
so that it can mark any pointers it references. */
|
|
|
|
|
|
|
|
static void my_ggc_walker (void *)
|
|
|
|
{
|
|
|
|
if (gcc::jit::active_playback_ctxt)
|
|
|
|
gcc::jit::active_playback_ctxt->gt_ggc_mx ();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *dummy;
|
|
|
|
|
|
|
|
struct ggc_root_tab jit_root_tab[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
&dummy, 1, 0, my_ggc_walker, NULL
|
|
|
|
},
|
|
|
|
LAST_GGC_ROOT_TAB
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Language hooks. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
jit_langhook_init (void)
|
|
|
|
{
|
New jit API entrypoint: gcc_jit_context_set_logfile
gcc/jit/ChangeLog:
* Make-lang.in (jit_OBJS): Add jit/jit-logging.o.
* docs/internals/index.rst (Overview of code structure): Mention
gcc_jit_context_set_logfile, and embed the example logfile.
* docs/internals/test-hello-world.exe.log.txt: New file: example
of a logfile.
* docs/topics/contexts.rst (Debugging): Add documentation
for gcc_jit_context_set_logfile.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* dummy-frontend.c: Include "jit-logging.h".
(jit_langhook_init): Assert that there is an active playback
context. If it has a logger, log entry/exit to this function.
(jit_langhook_write_globals): Likewise.
* jit-common.h (gcc::jit::logger): New forward declaration.
* jit-logging.c: New file.
* jit-logging.h: New file.
* jit-playback.c: Include "jit-logging.h".
(gcc::jit::playback::context::context): Initialize the log_user
base class from the recording context's logger (if any). Use
JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::playback::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::build_stmt_list): Likewise.
(gcc::jit::playback::function::postprocess): Likewise.
(gcc::jit::playback::context::compile): Likewise. Log the
entry/exit to toplev::main and toplev::finalize. Log the
fake argv passed to toplev::main.
(gcc::jit::playback::context::acquire_mutex): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::release_mutex): Likewise.
(gcc::jit::playback::context::make_fake_args): Likewise.
(gcc::jit::playback::context::extract_any_requested_dumps):
Likewise.
(gcc::jit::playback::context::convert_to_dso): Likewise. Also,
log the arguments that the driver is invoked with.
(gcc::jit::playback::context::dlopen_built_dso): Likewise. Pass
the logger to the result object.
(gcc::jit::playback::context::replay): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::playback::context::dump_generated_code): Likewise.
(gcc::jit::playback::context::handle_locations): Likewise.
* jit-playback.h (gcc::jit::playback::context): Make this be
a subclass of gcc::jit::log_user.
* jit-recording.c: Include "jit-logging.h".
(gcc::jit::recording::context::context: Initialize the logger to
NULL for root contexts, or to the parent's logger for child
contexts.
(gcc::jit::recording::context::~context): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::recording::context::replay_into): Likewise.
(gcc::jit::recording::context::disassociate_from_playback):
Likewise.
(gcc::jit::recording::context::compile): Likewise.
(recording::context::add_error_va): Likewise. Also, log the
error.
(gcc::jit::recording::context::validate): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
* jit-recording.h: Include "jit-logging.h".
(gcc::jit::recording::context): Make this be a subclass of
gcc::jit::log_user.
* jit-result.c: Include "jit-common.h" and "jit-logging.h".
(gcc::jit::result::result): Add logger param, recording it.
Use JIT_LOG_SCOPE to log entry/exit from the function body.
(gcc::jit::result::~result(): Use JIT_LOG_SCOPE to
log entry/exit from the function body.
(gcc::jit::result::get_code): Likewise.
* jit-result.h (gcc::jit::result): Make this be a subclass of
gcc::jit::log_user.
(gcc::jit::result::result): Add logger parameter.
* libgccjit++.h (gccjit::context::set_logfile): New function.
* libgccjit.c: Include "jit-logging.h".
(gcc_jit_context_acquire): Log the context.
(gcc_jit_context_release): Use JIT_LOG_FUNC to
log entry/exit from the function body, and log the context.
(gcc_jit_context_new_child_context): Likewise, logging both
contexts.
(gcc_jit_context_new_location): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_context_get_type): Likewise.
(gcc_jit_context_get_int_type): Likewise.
(gcc_jit_context_new_array_type): Likewise.
(gcc_jit_context_new_field): Likewise.
(gcc_jit_context_new_struct_type): Likewise.
(gcc_jit_context_new_opaque_struct): Likewise.
(gcc_jit_struct_set_fields): Likewise.
(gcc_jit_context_new_union_type): Likewise.
(gcc_jit_context_new_function_ptr_type): Likewise.
(gcc_jit_context_new_param): Likewise.
(gcc_jit_context_new_function): Likewise.
(gcc_jit_context_get_builtin_function): Likewise.
(gcc_jit_function_get_param): Likewise.
(gcc_jit_function_dump_to_dot): Likewise.
(gcc_jit_function_new_block): Likewise.
(gcc_jit_context_new_global): Likewise.
(gcc_jit_context_new_rvalue_from_int): Likewise.
(gcc_jit_context_zero): Likewise.
(gcc_jit_context_one): Likewise.
(gcc_jit_context_new_rvalue_from_double): Likewise.
(gcc_jit_context_new_rvalue_from_ptr): Likewise.
(gcc_jit_context_null): Likewise.
(gcc_jit_context_new_string_literal): Likewise.
(gcc_jit_context_new_unary_op): Likewise.
(gcc_jit_context_new_binary_op): Likewise.
(gcc_jit_context_new_comparison): Likewise.
(gcc_jit_context_new_call): Likewise.
(gcc_jit_context_new_call_through_ptr): Likewise.
(gcc_jit_context_new_cast): Likewise.
(gcc_jit_context_new_array_access): Likewise.
(gcc_jit_lvalue_access_field): Likewise.
(gcc_jit_rvalue_access_field): Likewise.
(gcc_jit_rvalue_dereference_field): Likewise.
(gcc_jit_rvalue_dereference): Likewise.
(gcc_jit_lvalue_get_address): Likewise.
(gcc_jit_function_new_local): Likewise.
(gcc_jit_block_add_eval): Likewise.
(gcc_jit_block_add_assignment): Likewise.
(gcc_jit_block_add_assignment_op): Likewise.
(gcc_jit_block_end_with_conditional): Likewise.
(gcc_jit_block_add_comment): Likewise.
(gcc_jit_block_end_with_jump): Likewise.
(gcc_jit_block_end_with_return): Likewise.
(gcc_jit_block_end_with_void_return): Likewise.
(gcc_jit_context_set_str_option): Likewise.
(gcc_jit_context_set_int_option): Likewise.
(gcc_jit_context_set_bool_option): Likewise.
(gcc_jit_context_enable_dump): Likewise.
(gcc_jit_context_compile): Likewise. Also log the context,
and the result.
(gcc_jit_context_dump_to_file): Likewise.
(gcc_jit_context_set_logfile): New function.
(gcc_jit_context_get_first_error): Use JIT_LOG_FUNC to
log entry/exit from the function body.
(gcc_jit_result_get_code): Likewise. Also log the fnname)
and the ptr to be returned.
(gcc_jit_result_release): Likewise. Also log the result.
* libgccjit.h: Include <stdio.h>, since we need FILE *.
(gcc_jit_context_set_logfile): New declaration.
* libgccjit.map (gcc_jit_context_set_logfile): New.
gcc/testsuite/ChangeLog:
* jit.dg/harness.h (set_up_logging): New function.
(test_jit): Fail if gcc_jit_context_acquire fails. Call
set_up_logging on the context, so that every testcase is
logged to a particular file.
* jit.dg/test-nested-contexts.c (main): Open a logfile,
and call gcc_jit_context_set_logfile on the top-level context.
From-SVN: r219357
2015-01-08 20:41:07 +01:00
|
|
|
gcc_assert (gcc::jit::active_playback_ctxt);
|
|
|
|
JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ());
|
|
|
|
|
2014-11-11 22:55:52 +01:00
|
|
|
static bool registered_root_tab = false;
|
|
|
|
if (!registered_root_tab)
|
|
|
|
{
|
|
|
|
ggc_register_root_tab (jit_root_tab);
|
|
|
|
registered_root_tab = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
build_common_tree_nodes (false, false);
|
|
|
|
|
|
|
|
/* I don't know why this has to be done explicitly. */
|
|
|
|
void_list_node = build_tree_list (NULL_TREE, void_type_node);
|
|
|
|
|
|
|
|
build_common_builtin_nodes ();
|
|
|
|
|
|
|
|
/* The default precision for floating point numbers. This is used
|
|
|
|
for floating point constants with abstract type. This may
|
|
|
|
eventually be controllable by a command line option. */
|
|
|
|
mpfr_set_default_prec (256);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
jit_langhook_parse_file (void)
|
|
|
|
{
|
|
|
|
/* Replay the activity by the client, recorded on the context. */
|
|
|
|
gcc_assert (gcc::jit::active_playback_ctxt);
|
|
|
|
gcc::jit::active_playback_ctxt->replay ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static tree
|
|
|
|
jit_langhook_type_for_mode (enum machine_mode mode, int unsignedp)
|
|
|
|
{
|
|
|
|
if (mode == TYPE_MODE (float_type_node))
|
|
|
|
return float_type_node;
|
|
|
|
|
|
|
|
if (mode == TYPE_MODE (double_type_node))
|
|
|
|
return double_type_node;
|
|
|
|
|
|
|
|
if (mode == TYPE_MODE (integer_type_node))
|
|
|
|
return unsignedp ? unsigned_type_node : integer_type_node;
|
|
|
|
|
|
|
|
if (mode == TYPE_MODE (long_integer_type_node))
|
|
|
|
return unsignedp ? long_unsigned_type_node : long_integer_type_node;
|
|
|
|
|
2015-02-02 16:21:16 +01:00
|
|
|
if (mode == TYPE_MODE (long_long_integer_type_node))
|
|
|
|
return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node;
|
|
|
|
|
2014-11-11 22:55:52 +01:00
|
|
|
if (COMPLEX_MODE_P (mode))
|
|
|
|
{
|
|
|
|
if (mode == TYPE_MODE (complex_float_type_node))
|
|
|
|
return complex_float_type_node;
|
|
|
|
if (mode == TYPE_MODE (complex_double_type_node))
|
|
|
|
return complex_double_type_node;
|
|
|
|
if (mode == TYPE_MODE (complex_long_double_type_node))
|
|
|
|
return complex_long_double_type_node;
|
|
|
|
if (mode == TYPE_MODE (complex_integer_type_node) && !unsignedp)
|
|
|
|
return complex_integer_type_node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* gcc_unreachable */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static tree
|
|
|
|
jit_langhook_type_for_size (unsigned int bits ATTRIBUTE_UNUSED,
|
|
|
|
int unsignedp ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
gcc_unreachable ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Record a builtin function. We just ignore builtin functions. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
jit_langhook_builtin_function (tree decl)
|
|
|
|
{
|
|
|
|
return decl;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
jit_langhook_global_bindings_p (void)
|
|
|
|
{
|
|
|
|
gcc_unreachable ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static tree
|
|
|
|
jit_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static tree
|
|
|
|
jit_langhook_getdecls (void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_NAME
|
|
|
|
#define LANG_HOOKS_NAME "libgccjit"
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_INIT
|
|
|
|
#define LANG_HOOKS_INIT jit_langhook_init
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_PARSE_FILE
|
|
|
|
#define LANG_HOOKS_PARSE_FILE jit_langhook_parse_file
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_TYPE_FOR_MODE
|
|
|
|
#define LANG_HOOKS_TYPE_FOR_MODE jit_langhook_type_for_mode
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
|
|
|
#define LANG_HOOKS_TYPE_FOR_SIZE jit_langhook_type_for_size
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_BUILTIN_FUNCTION
|
|
|
|
#define LANG_HOOKS_BUILTIN_FUNCTION jit_langhook_builtin_function
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_GLOBAL_BINDINGS_P
|
|
|
|
#define LANG_HOOKS_GLOBAL_BINDINGS_P jit_langhook_global_bindings_p
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_PUSHDECL
|
|
|
|
#define LANG_HOOKS_PUSHDECL jit_langhook_pushdecl
|
|
|
|
|
|
|
|
#undef LANG_HOOKS_GETDECLS
|
|
|
|
#define LANG_HOOKS_GETDECLS jit_langhook_getdecls
|
|
|
|
|
|
|
|
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
|
|
|
|
|
|
|
#include "gt-jit-dummy-frontend.h"
|
|
|
|
#include "gtype-jit.h"
|