Replace main_fndecl with current_function_decl

This commit is contained in:
2025-02-09 23:49:57 +01:00
parent 207ae0fa0a
commit 4bf88a92e8
7 changed files with 272 additions and 326 deletions

View File

@ -19,17 +19,11 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "tree.h"
#include "tree-iterator.h"
#include "gimple-expr.h"
#include "diagnostic.h"
#include "opts.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "debug.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "common/common-target.h"
#include <fstream>
#include <elna/boot/driver.h>
@ -52,14 +46,6 @@ struct GTY (()) 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"),
@ -68,7 +54,6 @@ union GTY ((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
"(&%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. */
@ -83,9 +68,6 @@ struct GTY (()) language_function
static bool elna_langhook_init(void)
{
build_common_tree_nodes(false);
void_list_node = build_tree_list(NULL_TREE, void_type_node);
build_common_builtin_nodes();
return true;
@ -198,36 +180,18 @@ static tree elna_langhook_type_for_mode(enum machine_mode mode, int unsignedp)
return nullptr;
}
static tree elna_langhook_type_for_size(unsigned int bits ATTRIBUTE_UNUSED,
int unsignedp ATTRIBUTE_UNUSED)
static bool global_bindings_p(void)
{
gcc_unreachable();
return current_function_decl == NULL_TREE;
}
/* Record a builtin function. We just ignore builtin functions. */
static tree elna_langhook_builtin_function(tree decl)
static tree pushdecl(tree decl)
{
return decl;
}
static bool elna_langhook_global_bindings_p(void)
{
return false;
}
static tree elna_langhook_pushdecl(tree decl ATTRIBUTE_UNUSED)
{
gcc_unreachable();
}
static tree elna_langhook_getdecls(void)
{
return NULL;
}
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "Elna"
#define LANG_HOOKS_NAME "GNU Elna"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT elna_langhook_init
@ -238,20 +202,14 @@ static tree elna_langhook_getdecls(void)
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE elna_langhook_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
#define LANG_HOOKS_TYPE_FOR_SIZE elna_langhook_type_for_size
#undef LANG_HOOKS_BUILTIN_FUNCTION
#define LANG_HOOKS_BUILTIN_FUNCTION elna_langhook_builtin_function
#undef LANG_HOOKS_GLOBAL_BINDINGS_P
#define LANG_HOOKS_GLOBAL_BINDINGS_P elna_langhook_global_bindings_p
#undef LANG_HOOKS_PUSHDECL
#define LANG_HOOKS_PUSHDECL elna_langhook_pushdecl
#define LANG_HOOKS_BUILTIN_FUNCTION pushdecl
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS elna_langhook_getdecls
#define LANG_HOOKS_GETDECLS hook_tree_void_null
#undef LANG_HOOKS_IDENTIFIER_SIZE
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof(struct tree_identifier)
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;