Rename the frontend binary name to gelna
This commit is contained in:
@ -17,6 +17,8 @@ namespace gcc
|
||||
{
|
||||
void generic_visitor::visit(source::call_statement *statement)
|
||||
{
|
||||
auto symbol = this->symbol_map.find(statement->name());
|
||||
|
||||
if (statement->name() == "writei")
|
||||
{
|
||||
if (statement->arguments().size() != 1)
|
||||
@ -78,23 +80,21 @@ namespace gcc
|
||||
append_to_statement_list(stmt, &this->current_statements);
|
||||
this->current_expression = NULL_TREE;
|
||||
}
|
||||
else
|
||||
else if (symbol != this->symbol_map.end())
|
||||
{
|
||||
tree fndecl_type = build_function_type_list(integer_type_node, NULL_TREE);
|
||||
|
||||
tree printf_fn_decl = build_fn_decl(statement->name().c_str(), fndecl_type);
|
||||
DECL_EXTERNAL(printf_fn_decl) = 1;
|
||||
|
||||
tree printf_fn = build1(ADDR_EXPR, build_pointer_type(fndecl_type), printf_fn_decl);
|
||||
tree printf_fn = build1(ADDR_EXPR, build_pointer_type(fndecl_type), symbol->second);
|
||||
|
||||
tree stmt = build_call_nary(integer_type_node, printf_fn, 0);
|
||||
|
||||
append_to_statement_list(stmt, &this->current_statements);
|
||||
this->current_expression = NULL_TREE;
|
||||
/*
|
||||
}
|
||||
else
|
||||
{
|
||||
error_at(get_location(&statement->position()),
|
||||
"procedure '%s' not declared",
|
||||
statement->name().c_str()); */
|
||||
statement->name().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +152,9 @@ namespace gcc
|
||||
tree declaration_type = build_function_type_array(void_type_node,
|
||||
definition->parameters().size(), parameter_types);
|
||||
this->main_fndecl = build_fn_decl(definition->identifier().c_str(), declaration_type);
|
||||
|
||||
this->symbol_map.insert({ definition->identifier(), this->main_fndecl });
|
||||
|
||||
tree resdecl = build_decl(UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, integer_type_node);
|
||||
DECL_CONTEXT(resdecl) = this->main_fndecl;
|
||||
DECL_RESULT(this->main_fndecl) = resdecl;
|
||||
|
Reference in New Issue
Block a user