#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include "tm.h"
#include "toplev.h"
#include "tree.h"
#include "tree-inline.h"
#include "tree-gimple.h"
#include "rtl.h"
#include "insn-config.h"
#include "integrate.h"
#include "flags.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "ggc.h"
#include "diagnostic.h"
void
lhd_do_nothing (void)
{
}
void
lhd_do_nothing_t (tree ARG_UNUSED (t))
{
}
void
lhd_do_nothing_i (int ARG_UNUSED (i))
{
}
tree
lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED (i),
int ARG_UNUSED (j),
int ARG_UNUSED (k))
{
return NULL_TREE;
}
void
lhd_do_nothing_f (struct function * ARG_UNUSED (f))
{
}
tree
lhd_return_tree (tree t)
{
return t;
}
tree
lhd_return_null_tree_v (void)
{
return NULL_TREE;
}
tree
lhd_return_null_tree (tree ARG_UNUSED (t))
{
return NULL_TREE;
}
bool
lhd_post_options (const char ** ARG_UNUSED (pfilename))
{
return false;
}
void
lhd_print_tree_nothing (FILE * ARG_UNUSED (file),
tree ARG_UNUSED (node),
int ARG_UNUSED (indent))
{
}
int
lhd_safe_from_p (rtx ARG_UNUSED (x), tree ARG_UNUSED (exp))
{
return 1;
}
tree
lhd_staticp (tree ARG_UNUSED (exp))
{
return NULL;
}
bool
lhd_warn_unused_global_decl (tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
return false;
if (TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl))
return false;
if (DECL_IN_SYSTEM_HEADER (decl))
return false;
return true;
}
void
lhd_set_decl_assembler_name (tree decl)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl)
|| DECL_EXTERNAL (decl)
|| TREE_PUBLIC (decl))));
if (TREE_PUBLIC (decl) || DECL_CONTEXT (decl) == NULL_TREE)
SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
else
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
char *label;
ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
}
}
bool
lhd_can_use_bit_fields_p (void)
{
return true;
}
tree
lhd_type_promotes_to (tree ARG_UNUSED (type))
{
gcc_unreachable ();
}
void
lhd_register_builtin_type (tree ARG_UNUSED (type),
const char * ARG_UNUSED (name))
{
}
void
lhd_incomplete_type_error (tree ARG_UNUSED (value), tree type)
{
gcc_assert (TREE_CODE (type) == ERROR_MARK);
return;
}
HOST_WIDE_INT
lhd_get_alias_set (tree ARG_UNUSED (t))
{
return -1;
}
HOST_WIDE_INT
hook_get_alias_set_0 (tree ARG_UNUSED (t))
{
return 0;
}
rtx
lhd_expand_expr (tree ARG_UNUSED (t), rtx ARG_UNUSED (r),
enum machine_mode ARG_UNUSED (mm),
int ARG_UNUSED (em),
rtx * ARG_UNUSED (a))
{
gcc_unreachable ();
}
int
lhd_expand_decl (tree ARG_UNUSED (t))
{
return 0;
}
const char *
lhd_decl_printable_name (tree decl, int ARG_UNUSED (verbosity))
{
gcc_assert (decl && DECL_NAME (decl));
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
const char *
lhd_dwarf_name (tree t, int verbosity)
{
gcc_assert (DECL_P (t));
return lang_hooks.decl_printable_name (t, verbosity);
}
int
lhd_types_compatible_p (tree x, tree y)
{
return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
}
tree
lhd_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
int *subtrees ATTRIBUTE_UNUSED,
walk_tree_fn func ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED,
struct pointer_set_t *pset ATTRIBUTE_UNUSED)
{
return NULL_TREE;
}
int
lhd_tree_inlining_cannot_inline_tree_fn (tree *fnp)
{
if (flag_really_no_inline
&& lookup_attribute ("always_inline", DECL_ATTRIBUTES (*fnp)) == NULL)
return 1;
return 0;
}
int
lhd_tree_inlining_disregard_inline_limits (tree fn)
{
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL)
return 1;
return 0;
}
tree
lhd_tree_inlining_add_pending_fn_decls (void *vafnp ATTRIBUTE_UNUSED, tree pfn)
{
return pfn;
}
int
lhd_tree_inlining_auto_var_in_fn_p (tree var, tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
&& ! TREE_STATIC (var))
|| TREE_CODE (var) == LABEL_DECL
|| TREE_CODE (var) == RESULT_DECL));
}
int
lhd_tree_inlining_anon_aggr_type_p (tree t ATTRIBUTE_UNUSED)
{
return 0;
}
int
lhd_vtable_p (tree t ATTRIBUTE_UNUSED)
{
return 0;
}
int
lhd_tree_inlining_start_inlining (tree fn ATTRIBUTE_UNUSED)
{
return 1;
}
void
lhd_tree_inlining_end_inlining (tree fn ATTRIBUTE_UNUSED)
{
}
tree
lhd_tree_inlining_convert_parm_for_inlining (tree parm ATTRIBUTE_UNUSED,
tree value,
tree fndecl ATTRIBUTE_UNUSED,
int argnum ATTRIBUTE_UNUSED)
{
return value;
}
bool
lhd_tree_dump_dump_tree (void *di ATTRIBUTE_UNUSED, tree t ATTRIBUTE_UNUSED)
{
return false;
}
int
lhd_tree_dump_type_quals (tree t)
{
return TYPE_QUALS (t);
}
tree
lhd_expr_size (tree exp)
{
if (DECL_P (exp)
&& DECL_SIZE_UNIT (exp) != 0)
return DECL_SIZE_UNIT (exp);
else
return size_in_bytes (TREE_TYPE (exp));
}
int
lhd_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED, tree *pre_p ATTRIBUTE_UNUSED,
tree *post_p ATTRIBUTE_UNUSED)
{
return GS_UNHANDLED;
}
size_t
lhd_tree_size (enum tree_code c ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
bool
lhd_decl_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED)
{
return true;
}
const char *
lhd_comdat_group (tree decl)
{
return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
}
void
write_global_declarations (void)
{
tree globals = lang_hooks.decls.getdecls ();
int len = list_length (globals);
tree *vec = XNEWVEC (tree, len);
int i;
tree decl;
for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
vec[len - i - 1] = decl;
wrapup_global_declarations (vec, len);
check_global_declarations (vec, len);
emit_debug_global_declarations (vec, len);
free (vec);
}
void
lhd_initialize_diagnostics (struct diagnostic_context *ctx ATTRIBUTE_UNUSED)
{
}
void
lhd_print_error_function (diagnostic_context *context, const char *file)
{
if (diagnostic_last_function_changed (context))
{
const char *old_prefix = context->printer->prefix;
char *new_prefix = file ? file_name_as_prefix (file) : NULL;
pp_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
pp_printf (context->printer, _("At top level:"));
else
{
if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
pp_printf
(context->printer, _("In member function %qs:"),
lang_hooks.decl_printable_name (current_function_decl, 2));
else
pp_printf
(context->printer, _("In function %qs:"),
lang_hooks.decl_printable_name (current_function_decl, 2));
}
diagnostic_set_last_function (context);
pp_flush (context->printer);
context->printer->prefix = old_prefix;
free ((char*) new_prefix);
}
}
tree
lhd_callgraph_analyze_expr (tree *tp ATTRIBUTE_UNUSED,
int *walk_subtrees ATTRIBUTE_UNUSED,
tree decl ATTRIBUTE_UNUSED)
{
return NULL;
}
tree
lhd_make_node (enum tree_code code)
{
return make_node (code);
}
HOST_WIDE_INT
lhd_to_target_charset (HOST_WIDE_INT c)
{
return c;
}
#if 0
void
lhd_start_source_file (int n, const char *s)
{
(*debug_hooks->start_source_file) (n, s);
}
void
lhd_end_source_file (int n, const char *s ATTRIBUTE_UNUSED)
{
(*debug_hooks->end_source_file) (n);
}
#endif
tree
lhd_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED,
bool *ti ATTRIBUTE_UNUSED, bool *se ATTRIBUTE_UNUSED)
{
return expr;
}
enum omp_clause_default_kind
lhd_omp_predetermined_sharing (tree decl ATTRIBUTE_UNUSED)
{
if (DECL_ARTIFICIAL (decl))
return OMP_CLAUSE_DEFAULT_SHARED;
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
tree
lhd_omp_assignment (tree clause ATTRIBUTE_UNUSED, tree dst, tree src)
{
return build2 (MODIFY_EXPR, void_type_node, dst, src);
}
void
lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c ATTRIBUTE_UNUSED,
tree t ATTRIBUTE_UNUSED)
{
}