2024-12-29 22:28:53 +01:00
|
|
|
#include "elna/gcc/elna-tree.h"
|
|
|
|
|
2025-01-01 23:02:19 +01:00
|
|
|
#include "stor-layout.h"
|
|
|
|
|
2024-12-29 22:28:53 +01:00
|
|
|
tree elna_global_trees[ELNA_TI_MAX];
|
2025-01-01 23:02:19 +01:00
|
|
|
|
2025-01-03 22:18:35 +01:00
|
|
|
namespace elna
|
2025-01-01 23:02:19 +01:00
|
|
|
{
|
2025-01-03 22:18:35 +01:00
|
|
|
namespace gcc
|
|
|
|
{
|
|
|
|
void init_ttree()
|
|
|
|
{
|
|
|
|
elna_char_type_node = make_unsigned_type(8);
|
|
|
|
elna_string_type_node = build_pointer_type(
|
|
|
|
build_qualified_type(char_type_node, TYPE_QUAL_CONST)); /* const char* */
|
|
|
|
TYPE_STRING_FLAG(elna_char_type_node) = 1;
|
|
|
|
}
|
|
|
|
|
2025-01-10 23:17:18 +01:00
|
|
|
bool is_pointer_type(tree type)
|
2025-01-03 22:18:35 +01:00
|
|
|
{
|
|
|
|
gcc_assert(TYPE_P(type));
|
2025-01-10 23:17:18 +01:00
|
|
|
return TREE_CODE(type) == POINTER_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_string_type(tree type)
|
|
|
|
{
|
|
|
|
return is_pointer_type(type)
|
2025-01-03 22:18:35 +01:00
|
|
|
&& TYPE_MAIN_VARIANT(TREE_TYPE(type)) == char_type_node;
|
|
|
|
}
|
2025-01-04 20:24:34 +01:00
|
|
|
|
2025-01-07 14:37:30 +01:00
|
|
|
bool is_array_type(tree type)
|
|
|
|
{
|
|
|
|
gcc_assert(TYPE_P(type));
|
|
|
|
return TREE_CODE(type) == ARRAY_TYPE;
|
|
|
|
}
|
|
|
|
|
2025-01-04 20:24:34 +01:00
|
|
|
tree tree_chain_base::head()
|
|
|
|
{
|
|
|
|
return first;
|
|
|
|
}
|
|
|
|
|
|
|
|
void tree_chain_base::append(tree t)
|
|
|
|
{
|
|
|
|
gcc_assert(t != NULL_TREE);
|
|
|
|
|
|
|
|
if (this->first == NULL_TREE)
|
|
|
|
{
|
|
|
|
this->first = this->last = t;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
chain(t);
|
|
|
|
this->last = t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void tree_chain::chain(tree t)
|
|
|
|
{
|
|
|
|
TREE_CHAIN(this->last) = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
tree_symbol_mapping::tree_symbol_mapping(tree bind_expression, tree block)
|
|
|
|
: m_bind_expression(bind_expression), m_block(block)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
tree tree_symbol_mapping::bind_expression()
|
|
|
|
{
|
|
|
|
return m_bind_expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
tree tree_symbol_mapping::block()
|
|
|
|
{
|
|
|
|
return m_block;
|
|
|
|
}
|
2025-01-17 10:11:40 +01:00
|
|
|
|
|
|
|
std::shared_ptr<elna::source::symbol_table<tree>> builtin_symbol_table()
|
|
|
|
{
|
|
|
|
return std::make_shared<elna::source::symbol_table<tree>>();
|
|
|
|
}
|
2025-01-03 22:18:35 +01:00
|
|
|
}
|
2025-01-01 23:02:19 +01:00
|
|
|
}
|