#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "tree-dump.h"
#include "tree-iterator.h"
#include "tree-gimple.h"
#include "function.h"
#include "flags.h"
#include "output.h"
#include "ggc.h"
#include "toplev.h"
#include "varray.h"
#include "langhooks-def.h"
#include "langhooks.h"
#include "target.h"
#include "cgraph.h"
#include "treelang.h"
#include "treetree.h"
#include "opts.h"
extern int option_main;
extern char **file_names;
struct lang_identifier GTY(())
{
struct tree_identifier common;
};
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
generic;
struct lang_identifier GTY ((tag ("1"))) identifier;
};
struct lang_type GTY(())
{
char junk;
};
struct lang_decl GTY(())
{
char junk;
};
struct language_function GTY(())
{
char junk;
};
static tree tree_lang_truthvalue_conversion (tree expr);
static bool tree_mark_addressable (tree exp);
static tree tree_lang_type_for_size (unsigned precision, int unsignedp);
static tree tree_lang_type_for_mode (enum machine_mode mode, int unsignedp);
static tree tree_lang_unsigned_type (tree type_node);
static tree tree_lang_signed_type (tree type_node);
static tree tree_lang_signed_or_unsigned_type (int unsignedp, tree type);
static void pushlevel (int ignore);
static tree poplevel (int keep, int reverse, int functionbody);
static tree pushdecl (tree decl);
static tree* getstmtlist (void);
static tree builtin_function (const char *name, tree type, int function_code,
enum built_in_class class, const char *library_name,
tree attrs);
static tree getdecls (void);
static int global_bindings_p (void);
static void insert_block (tree);
static void tree_push_type_decl (tree id, tree type_node);
static void treelang_expand_function (tree fndecl);
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION tree_lang_truthvalue_conversion
#undef LANG_HOOKS_MARK_ADDRESSABLE
#define LANG_HOOKS_MARK_ADDRESSABLE tree_mark_addressable
#undef LANG_HOOKS_SIGNED_TYPE
#define LANG_HOOKS_SIGNED_TYPE tree_lang_signed_type
#undef LANG_HOOKS_UNSIGNED_TYPE
#define LANG_HOOKS_UNSIGNED_TYPE tree_lang_unsigned_type
#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE tree_lang_signed_or_unsigned_type
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE tree_lang_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
#define LANG_HOOKS_TYPE_FOR_SIZE tree_lang_type_for_size
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE treelang_parse_file
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION treelang_expand_function
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT treelang_init
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU treelang"
#undef LANG_HOOKS_FINISH
#define LANG_HOOKS_FINISH treelang_finish
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS treelang_init_options
#undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION treelang_handle_option
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
const enum tree_code_class tree_code_type[] = {
#include "tree.def"
tcc_exceptional
};
#undef DEFTREECODE
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
const unsigned char tree_code_length[] = {
#include "tree.def"
0
};
#undef DEFTREECODE
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
const char *const tree_code_name[] = {
#include "tree.def"
"@@dummy"
};
#undef DEFTREECODE
unsigned int tree_code_int_size = SIZEOF_INT * HOST_BITS_PER_CHAR;
unsigned int tree_code_char_size = HOST_BITS_PER_CHAR;
tree
tree_code_get_type (int type_num)
{
switch (type_num)
{
case SIGNED_CHAR:
return signed_char_type_node;
case UNSIGNED_CHAR:
return unsigned_char_type_node;
case SIGNED_INT:
return integer_type_node;
case UNSIGNED_INT:
return unsigned_type_node;
case VOID_TYPE:
return void_type_node;
default:
gcc_unreachable ();
}
}
void
tree_code_if_start (tree exp, location_t loc)
{
tree cond_exp, cond;
cond_exp = fold (build2 (NE_EXPR, boolean_type_node, exp,
fold (build1 (CONVERT_EXPR, TREE_TYPE (exp),
integer_zero_node))));
SET_EXPR_LOCATION (cond_exp, loc);
cond = build3 (COND_EXPR, void_type_node, cond_exp, NULL_TREE,
NULL_TREE);
SET_EXPR_LOCATION (cond, loc);
append_to_statement_list_force (cond, getstmtlist ());
pushlevel (0);
}
void
tree_code_if_else (location_t loc ATTRIBUTE_UNUSED)
{
tree stmts = *getstmtlist ();
tree block = poplevel (1, 0, 0);
if (BLOCK_VARS (block))
{
tree bindexpr = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
stmts, block);
stmts = alloc_stmt_list ();
append_to_statement_list (bindexpr, &stmts);
}
TREE_OPERAND (STATEMENT_LIST_TAIL (*getstmtlist ())->stmt, 1) = stmts;
pushlevel (0);
}
void
tree_code_if_end (location_t loc ATTRIBUTE_UNUSED)
{
tree stmts = *getstmtlist ();
tree block = poplevel (1, 0, 0);
if (BLOCK_VARS (block))
{
tree bindexpr = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
stmts, block);
stmts = alloc_stmt_list ();
append_to_statement_list (bindexpr, &stmts);
}
TREE_OPERAND (STATEMENT_LIST_TAIL (*getstmtlist ())->stmt, 2) = stmts;
}
tree
tree_code_create_function_prototype (unsigned char* chars,
unsigned int storage_class,
unsigned int ret_type,
struct prod_token_parm_item* parms,
location_t loc)
{
tree id;
struct prod_token_parm_item* parm;
tree type_list = NULL_TREE;
tree type_node;
tree fn_type;
tree fn_decl;
tree parm_list = NULL_TREE;
id = get_identifier ((const char*)chars);
for (parm = parms; parm; parm = parm->tp.par.next)
{
gcc_assert (parm->category == parameter_category);
type_node = tree_code_get_type (parm->type);
type_list = tree_cons (NULL_TREE, type_node, type_list);
}
type_list = tree_cons (NULL_TREE, void_type_node, type_list);
type_list = nreverse (type_list);
type_node = tree_code_get_type (ret_type);
fn_type = build_function_type (type_node, type_list);
id = get_identifier ((const char*)chars);
fn_decl = build_decl (FUNCTION_DECL, id, fn_type);
DECL_CONTEXT (fn_decl) = NULL_TREE;
DECL_SOURCE_LOCATION (fn_decl) = loc;
TREE_PUBLIC (fn_decl) = 0;
DECL_EXTERNAL (fn_decl) = 0;
TREE_STATIC (fn_decl) = 0;
switch (storage_class)
{
case STATIC_STORAGE:
break;
case EXTERNAL_DEFINITION_STORAGE:
TREE_PUBLIC (fn_decl) = 1;
break;
case EXTERNAL_REFERENCE_STORAGE:
DECL_EXTERNAL (fn_decl) = 1;
break;
case AUTOMATIC_STORAGE:
default:
gcc_unreachable ();
}
for (parm = parms; parm; parm = parm->tp.par.next)
{
tree parm_decl = build_decl (PARM_DECL, get_identifier
((const char*) (parm->tp.par.variable_name)),
tree_code_get_type (parm->type));
DECL_ARG_TYPE (parm_decl) = TREE_TYPE (parm_decl);
gcc_assert (DECL_ARG_TYPE (parm_decl));
gcc_assert (fn_decl);
DECL_CONTEXT (parm_decl) = fn_decl;
DECL_SOURCE_LOCATION (parm_decl) = loc;
parm_list = chainon (parm_decl, parm_list);
}
parm_list = nreverse (parm_list);
DECL_ARGUMENTS (fn_decl) = parm_list;
for (parm = parms; parm_list;
parm_list = TREE_CHAIN (parm_list),
parm = parm->tp.par.next)
{
gcc_assert (parm);
*parm->tp.par.where_to_put_var_tree = parm_list;
}
gcc_assert (!parm);
rest_of_decl_compilation (fn_decl, 1, 0);
return fn_decl;
}
void
tree_code_create_function_initial (tree prev_saved,
location_t loc)
{
tree fn_decl;
tree resultdecl;
fn_decl = prev_saved;
gcc_assert (fn_decl);
announce_function (fn_decl);
pushdecl (fn_decl);
current_function_decl = fn_decl;
DECL_INITIAL (fn_decl) = error_mark_node;
DECL_SOURCE_LOCATION (fn_decl) = loc;
resultdecl =
build_decl (RESULT_DECL, NULL_TREE, TREE_TYPE (TREE_TYPE (fn_decl)));
DECL_CONTEXT (resultdecl) = fn_decl;
DECL_ARTIFICIAL (resultdecl) = 1;
DECL_IGNORED_P (resultdecl) = 1;
DECL_SOURCE_LOCATION (resultdecl) = loc;
DECL_RESULT (fn_decl) = resultdecl;
pushlevel (0);
TREE_STATIC (fn_decl) = 1;
}
void
tree_code_create_function_wrapup (location_t loc)
{
tree block;
tree fn_decl;
tree stmts = *getstmtlist ();
fn_decl = current_function_decl;
block = poplevel (1, 0, 1);
DECL_SAVED_TREE (fn_decl) = build3 (BIND_EXPR, void_type_node,
BLOCK_VARS (block),
stmts, block);
allocate_struct_function (fn_decl);
cfun->function_end_locus = loc;
dump_function (TDI_original, fn_decl);
gimplify_function_tree (fn_decl);
dump_function (TDI_generic, fn_decl);
current_function_decl = NULL_TREE;
cfun = NULL;
(void)cgraph_node (fn_decl);
cgraph_finalize_function (fn_decl, false);
}
tree
tree_code_create_variable (unsigned int storage_class,
unsigned char* chars,
unsigned int length,
unsigned int expression_type,
tree init,
location_t loc)
{
tree var_type;
tree var_id;
tree var_decl;
var_type = tree_code_get_type (expression_type);
gcc_assert (chars[length] == 0);
var_id = get_identifier ((const char*)chars);
var_decl = build_decl (VAR_DECL, var_id, var_type);
if (init)
DECL_INITIAL (var_decl) = fold (build1 (CONVERT_EXPR, var_type, init));
else
DECL_INITIAL (var_decl) = NULL_TREE;
gcc_assert (TYPE_SIZE (var_type) != 0);
DECL_CONTEXT (var_decl) = current_function_decl;
DECL_SOURCE_LOCATION (var_decl) = loc;
DECL_EXTERNAL (var_decl) = 0;
TREE_PUBLIC (var_decl) = 0;
TREE_STATIC (var_decl) = 0;
switch (storage_class)
{
case STATIC_STORAGE:
TREE_STATIC (var_decl) = 1;
break;
case AUTOMATIC_STORAGE:
break;
case EXTERNAL_DEFINITION_STORAGE:
TREE_PUBLIC (var_decl) = 1;
break;
case EXTERNAL_REFERENCE_STORAGE:
DECL_EXTERNAL (var_decl) = 1;
break;
default:
gcc_unreachable ();
}
TYPE_NAME (TREE_TYPE (var_decl)) = TYPE_NAME (var_type);
return pushdecl (copy_node (var_decl));
}
void
tree_code_generate_return (tree type, tree exp)
{
tree setret;
#ifdef ENABLE_CHECKING
tree param;
for (param = DECL_ARGUMENTS (current_function_decl);
param;
param = TREE_CHAIN (param))
gcc_assert (DECL_CONTEXT (param) == current_function_decl);
#endif
if (exp && TREE_TYPE (TREE_TYPE (current_function_decl)) != void_type_node)
{
setret = fold (build2 (MODIFY_EXPR, type,
DECL_RESULT (current_function_decl),
fold (build1 (CONVERT_EXPR, type, exp))));
TREE_SIDE_EFFECTS (setret) = 1;
TREE_USED (setret) = 1;
setret = build1 (RETURN_EXPR, type, setret);
SET_EXPR_LOCUS (setret, EXPR_LOCUS (exp));
}
else
setret = build1 (RETURN_EXPR, type, NULL_TREE);
append_to_statement_list_force (setret, getstmtlist ());
}
void
tree_code_output_expression_statement (tree code, location_t loc)
{
SET_EXPR_LOCATION (code, loc);
TREE_USED (code) = 1;
TREE_SIDE_EFFECTS (code) = 1;
append_to_statement_list_force (code, getstmtlist ());
}
tree
tree_code_get_integer_value (unsigned char* chars, unsigned int length)
{
long long int val = 0;
unsigned int ix;
unsigned int start = 0;
int negative = 1;
switch (chars[0])
{
case (unsigned char)'-':
negative = -1;
start = 1;
break;
case (unsigned char)'+':
start = 1;
break;
default:
break;
}
for (ix = start; ix < length; ix++)
val = val * 10 + chars[ix] - (unsigned char)'0';
val = val*negative;
return build_int_cst_wide (start == 1 ?
integer_type_node : unsigned_type_node,
val & 0xffffffff, (val >> 32) & 0xffffffff);
}
tree
tree_code_get_expression (unsigned int exp_type,
tree type, tree op1, tree op2,
tree op3 ATTRIBUTE_UNUSED,
location_t loc)
{
tree ret1;
int operator;
switch (exp_type)
{
case EXP_ASSIGN:
gcc_assert (op1 && op2);
operator = MODIFY_EXPR;
ret1 = fold (build2 (operator, void_type_node, op1,
fold (build1 (CONVERT_EXPR, TREE_TYPE (op1),
op2))));
break;
case EXP_PLUS:
operator = PLUS_EXPR;
goto binary_expression;
case EXP_MINUS:
operator = MINUS_EXPR;
goto binary_expression;
case EXP_EQUALS:
operator = EQ_EXPR;
goto binary_expression;
binary_expression:
gcc_assert (op1 && op2);
ret1 = fold (build2 (operator, type,
fold (build1 (CONVERT_EXPR, type, op1)),
fold (build1 (CONVERT_EXPR, type, op2))));
break;
case EXP_REFERENCE:
gcc_assert (op1);
TREE_USED (op1) = 1;
if (type == TREE_TYPE (op1))
ret1 = build1 (NOP_EXPR, type, op1);
else
ret1 = fold (build1 (CONVERT_EXPR, type, op1));
break;
case EXP_FUNCTION_INVOCATION:
gcc_assert (op1);
{
tree fun_ptr;
TREE_USED (op1) = 1;
fun_ptr = fold (build1 (ADDR_EXPR,
build_pointer_type (TREE_TYPE (op1)), op1));
ret1 = build3 (CALL_EXPR, type, fun_ptr, nreverse (op2), NULL_TREE);
}
break;
default:
gcc_unreachable ();
}
if (! DECL_P (ret1) && ! TREE_CONSTANT (ret1))
SET_EXPR_LOCATION (ret1, loc);
return ret1;
}
tree
tree_code_init_parameters (void)
{
return NULL_TREE;
}
tree
tree_code_add_parameter (tree list, tree proto_exp, tree exp)
{
tree new_exp;
new_exp = tree_cons (NULL_TREE,
fold (build1 (CONVERT_EXPR, TREE_TYPE (proto_exp),
exp)), NULL_TREE);
if (!list)
return new_exp;
return chainon (new_exp, list);
}
const char*
get_string (const char *s, size_t l)
{
tree t;
t = get_identifier_with_length (s, l);
return IDENTIFIER_POINTER(t);
}
void dt (tree t);
void
dt (tree t)
{
debug_tree (t);
}
#ifndef MAX_BITS_PER_WORD
#define MAX_BITS_PER_WORD BITS_PER_WORD
#endif
static GTY(()) tree signed_and_unsigned_types[MAX_BITS_PER_WORD + 1][2];
static tree
tree_lang_truthvalue_conversion (tree expr)
{
return expr;
}
static bool
tree_mark_addressable (tree exp)
{
register tree x = exp;
while (1)
switch (TREE_CODE (x))
{
case COMPONENT_REF:
case ADDR_EXPR:
case ARRAY_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
x = TREE_OPERAND (x, 0);
break;
case CONSTRUCTOR:
TREE_ADDRESSABLE (x) = 1;
return 1;
case VAR_DECL:
case CONST_DECL:
case PARM_DECL:
case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& DECL_NONLOCAL (x))
{
if (TREE_PUBLIC (x))
{
error ("Global register variable %qD used in nested function.",
x);
return 0;
}
pedwarn ("Register variable %qD used in nested function.", x);
}
else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
{
if (TREE_PUBLIC (x))
{
error ("Address of global register variable %qD requested.",
x);
return 0;
}
pedwarn ("Address of register variable %qD requested.", x);
}
case FUNCTION_DECL:
TREE_ADDRESSABLE (x) = 1;
default:
return 1;
}
}
static tree
tree_lang_type_for_size (unsigned precision, int unsignedp)
{
tree t;
if (precision <= MAX_BITS_PER_WORD
&& signed_and_unsigned_types[precision][unsignedp] != 0)
return signed_and_unsigned_types[precision][unsignedp];
if (unsignedp)
t = signed_and_unsigned_types[precision][1]
= make_unsigned_type (precision);
else
t = signed_and_unsigned_types[precision][0]
= make_signed_type (precision);
return t;
}
static tree
tree_lang_type_for_mode (enum machine_mode mode, int unsignedp)
{
if (SCALAR_INT_MODE_P (mode))
return tree_lang_type_for_size (GET_MODE_BITSIZE (mode), unsignedp);
else
return NULL_TREE;
}
static tree
tree_lang_unsigned_type (tree type_node)
{
return tree_lang_type_for_size (TYPE_PRECISION (type_node), 1);
}
static tree
tree_lang_signed_type (tree type_node)
{
return tree_lang_type_for_size (TYPE_PRECISION (type_node), 0);
}
static tree
tree_lang_signed_or_unsigned_type (int unsignedp, tree type)
{
if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
return type;
else
return tree_lang_type_for_size (TYPE_PRECISION (type), unsignedp);
}
struct binding_level
{
tree names;
tree blocks;
tree stmts;
struct binding_level *level_chain;
};
static struct binding_level *current_binding_level = NULL;
static struct binding_level *global_binding_level;
static struct binding_level clear_binding_level = {NULL, NULL, NULL, NULL };
static int
global_bindings_p (void)
{
return current_binding_level == global_binding_level ? -1 : 0;
}
static tree
getdecls (void)
{
return current_binding_level->names;
}
static tree*
getstmtlist (void)
{
return ¤t_binding_level->stmts;
}
static void
pushlevel (int ignore ATTRIBUTE_UNUSED)
{
struct binding_level *newlevel = xmalloc (sizeof (struct binding_level));
*newlevel = clear_binding_level;
newlevel->level_chain = current_binding_level;
current_binding_level = newlevel;
current_binding_level->stmts = alloc_stmt_list ();
}
static tree
poplevel (int keep, int reverse, int functionbody)
{
tree block_node = NULL_TREE;
tree decl_chain;
tree subblock_chain = current_binding_level->blocks;
tree subblock_node;
decl_chain = (reverse) ? nreverse (current_binding_level->names)
: current_binding_level->names;
if (keep || functionbody)
block_node = build_block (keep ? decl_chain : 0, 0, subblock_chain, 0, 0);
for (subblock_node = subblock_chain; subblock_node;
subblock_node = TREE_CHAIN (subblock_node))
BLOCK_SUPERCONTEXT (subblock_node) = block_node;
for (subblock_node = decl_chain; subblock_node;
subblock_node = TREE_CHAIN (subblock_node))
if (DECL_NAME (subblock_node) != 0)
if (DECL_EXTERNAL (subblock_node))
{
if (TREE_USED (subblock_node))
TREE_USED (DECL_NAME (subblock_node)) = 1;
}
current_binding_level = current_binding_level->level_chain;
if (functionbody)
{
DECL_INITIAL (current_function_decl) = block_node;
}
else if (block_node)
{
current_binding_level->blocks
= chainon (current_binding_level->blocks, block_node);
}
else if (subblock_chain)
current_binding_level->blocks
= chainon (current_binding_level->blocks, subblock_chain);
if (block_node)
TREE_USED (block_node) = 1;
return block_node;
}
static void
insert_block (tree block)
{
TREE_USED (block) = 1;
current_binding_level->blocks
= chainon (current_binding_level->blocks, block);
}
tree
pushdecl (tree decl)
{
if ((DECL_EXTERNAL (decl)) || (decl==current_function_decl))
DECL_CONTEXT (decl) = 0;
else
DECL_CONTEXT (decl) = current_function_decl;
TREE_CHAIN (decl) = current_binding_level->names;
current_binding_level->names = decl;
if (TREE_CODE (decl) == TYPE_DECL
&& TYPE_NAME (TREE_TYPE (decl)) == 0)
TYPE_NAME (TREE_TYPE (decl)) = DECL_NAME (decl);
if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
&& !TREE_STATIC (decl) && !TREE_PUBLIC (decl))
tree_code_output_expression_statement (build1 (DECL_EXPR, void_type_node,
decl),
DECL_SOURCE_LOCATION (decl));
return decl;
}
static void
tree_push_type_decl(tree id, tree type_node)
{
tree decl = build_decl (TYPE_DECL, id, type_node);
TYPE_NAME (type_node) = id;
pushdecl (decl);
}
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
void
treelang_init_decl_processing (void)
{
current_function_decl = NULL;
current_binding_level = NULL_BINDING_LEVEL;
pushlevel (0);
global_binding_level = current_binding_level;
build_common_tree_nodes (flag_signed_char, false);
tree_push_type_decl (NULL_TREE, intQI_type_node);
tree_push_type_decl (NULL_TREE, intHI_type_node);
tree_push_type_decl (NULL_TREE, intSI_type_node);
tree_push_type_decl (NULL_TREE, intDI_type_node);
#if HOST_BITS_PER_WIDE_INT >= 64
tree_push_type_decl (NULL_TREE, intTI_type_node);
#endif
tree_push_type_decl (NULL_TREE, unsigned_intQI_type_node);
tree_push_type_decl (NULL_TREE, unsigned_intHI_type_node);
tree_push_type_decl (NULL_TREE, unsigned_intSI_type_node);
tree_push_type_decl (NULL_TREE, unsigned_intDI_type_node);
#if HOST_BITS_PER_WIDE_INT >= 64
tree_push_type_decl (NULL_TREE, unsigned_intTI_type_node);
#endif
tree_push_type_decl (get_identifier ("int"), integer_type_node);
tree_push_type_decl (get_identifier ("char"), char_type_node);
tree_push_type_decl (get_identifier ("long int"),
long_integer_type_node);
tree_push_type_decl (get_identifier ("unsigned int"),
unsigned_type_node);
tree_push_type_decl (get_identifier ("long unsigned int"),
long_unsigned_type_node);
tree_push_type_decl (get_identifier ("long long int"),
long_long_integer_type_node);
tree_push_type_decl (get_identifier ("long long unsigned int"),
long_long_unsigned_type_node);
tree_push_type_decl (get_identifier ("short int"),
short_integer_type_node);
tree_push_type_decl (get_identifier ("short unsigned int"),
short_unsigned_type_node);
tree_push_type_decl (get_identifier ("signed char"),
signed_char_type_node);
tree_push_type_decl (get_identifier ("unsigned char"),
unsigned_char_type_node);
size_type_node = make_unsigned_type (POINTER_SIZE);
tree_push_type_decl (get_identifier ("size_t"), size_type_node);
set_sizetype (size_type_node);
build_common_tree_nodes_2 ( 0);
tree_push_type_decl (get_identifier ("float"), float_type_node);
tree_push_type_decl (get_identifier ("double"), double_type_node);
tree_push_type_decl (get_identifier ("long double"), long_double_type_node);
tree_push_type_decl (get_identifier ("void"), void_type_node);
build_common_builtin_nodes ();
(*targetm.init_builtins) ();
pedantic_lvalues = pedantic;
}
static tree
builtin_function (const char *name, tree type, int function_code,
enum built_in_class class, const char *library_name,
tree attrs)
{
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
if (library_name)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
if (attrs)
decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
else
decl_attributes (&decl, NULL_TREE, 0);
return decl;
}
static void
treelang_expand_function (tree fndecl)
{
tree_rest_of_compilation (fndecl);
}
#include "debug.h"
#include "gt-treelang-treetree.h"