|
|
|
@ -40,11 +40,11 @@ namespace SysYF
|
|
|
|
|
#define get_true_type(left_type, right) \
|
|
|
|
|
if (!scope.in_global()) \
|
|
|
|
|
{ \
|
|
|
|
|
if (left_type == INT32_T && right->get_type() == FLOAT_T) \
|
|
|
|
|
if ((left_type == INT32_T || left_type == INT32PTR_T) && right->get_type() == FLOAT_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = builder->create_fptosi(right, INT32_T); \
|
|
|
|
|
} \
|
|
|
|
|
else if (left_type == INT32_T && right->get_type() == INT1_T) \
|
|
|
|
|
else if ((left_type == INT32_T || left_type == INT32PTR_T) && right->get_type() == INT1_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = builder->create_zext(right, INT32_T); \
|
|
|
|
|
} \
|
|
|
|
@ -56,22 +56,22 @@ namespace SysYF
|
|
|
|
|
{ \
|
|
|
|
|
right = builder->create_icmp_ne(right, CONST_INT(0)); \
|
|
|
|
|
} \
|
|
|
|
|
else if (left_type == FLOAT_T && right->get_type() == INT32_T) \
|
|
|
|
|
else if ((left_type == FLOAT_T || left_type == FLOATPTR_T) && right->get_type() == INT32_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = builder->create_sitofp(right, FLOAT_T); \
|
|
|
|
|
} \
|
|
|
|
|
else if (left_type == FLOAT_T && right->get_type() == INT1_T) \
|
|
|
|
|
else if ((left_type == FLOAT_T || left_type == FLOATPTR_T) && right->get_type() == INT1_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = builder->create_zext(right, FLOAT_T); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
else \
|
|
|
|
|
{ \
|
|
|
|
|
if (left_type == FLOAT_T && right->get_type() != FLOAT_T) \
|
|
|
|
|
if ((left_type == FLOAT_T || left_type == INT32PTR_T) && right->get_type() != FLOAT_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = CONST_FLOAT(static_cast<float>(dynamic_pointer_cast<ConstantInt>(right)->get_value())); \
|
|
|
|
|
} \
|
|
|
|
|
else if (left_type == INT32_T && right->get_type() != INT32_T) \
|
|
|
|
|
else if ((left_type == INT32_T || left_type == FLOATPTR_T) && right->get_type() != INT32_T) \
|
|
|
|
|
{ \
|
|
|
|
|
right = CONST_INT(static_cast<int>(dynamic_pointer_cast<ConstantFloat>(right)->get_value())); \
|
|
|
|
|
} \
|
|
|
|
@ -352,7 +352,7 @@ namespace SysYF
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
init_list.clear();
|
|
|
|
|
while (init_list.size() < length.size()) // 如果init_list的长度小于length的长度,就把init_list其他的值补上0
|
|
|
|
|
while (static_cast<int>(init_list.size()) < array_len) // 如果init_list的长度小于length的长度,就把init_list其他的值补上0
|
|
|
|
|
{
|
|
|
|
|
init_list.push_back(ConstantZero::create(type_map[node.btype], module));
|
|
|
|
|
}
|
|
|
|
|