Compare commits

..

No commits in common. "14f856b550fa9c315ddc0e162c6e227bb9741d23" and "156fed316615b55ee68f0cbabd1c57a438b314f7" have entirely different histories.

4 changed files with 149 additions and 1985 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1029,6 +1029,7 @@ struct MacroDeclaration
{ {
Slice<Argument> arguments; Slice<Argument> arguments;
Slice<ConstantArgument> constant_arguments; Slice<ConstantArgument> constant_arguments;
TypeList types;
Type* return_type; Type* return_type;
Block* block; Block* block;
String name; String name;
@ -1933,13 +1934,12 @@ fn Type* get_enum_array_type(Module* module, Type* enum_type, Type* element_type
return last_enum_type; return last_enum_type;
} }
auto next = last_enum_type->enum_array.next; if (!last_enum_type->enum_array.next)
if (!next)
{ {
break; break;
} }
last_enum_type = next; last_enum_type = last_enum_type->enum_array.next;
} }
} }

View File

@ -43,7 +43,6 @@ enum class TypeKind
abi, abi,
memory, memory,
}; };
fn void analyze_block(Module* module, Block* block); fn void analyze_block(Module* module, Block* block);
fn void emit_local_storage(Module* module, Variable* variable); fn void emit_local_storage(Module* module, Variable* variable);
fn void emit_assignment(Module* module, LLVMValueRef left_llvm, Type* left_type, Value* right); fn void emit_assignment(Module* module, LLVMValueRef left_llvm, Type* left_type, Value* right);
@ -341,7 +340,6 @@ fn bool is_arbitrary_bit_integer(Type* type)
{ {
case TypeId::integer: switch (type->integer.bit_count) case TypeId::integer: switch (type->integer.bit_count)
{ {
case 1:
case 8: case 8:
case 16: case 16:
case 32: case 32:
@ -1624,10 +1622,7 @@ fn AbiInformation abi_system_v_get_indirect_result(Module* module, Type* type, u
{ {
if (is_promotable_integer_type_for_abi(type)) if (is_promotable_integer_type_for_abi(type))
{ {
return abi_system_v_get_extend({ trap();
.semantic_type = type,
.sign = type_is_signed(type),
});
} }
else else
{ {
@ -1659,6 +1654,7 @@ fn AbiInformation abi_system_v_get_indirect_result(Module* module, Type* type, u
} }
} }
struct AbiSystemVClassifyArgumentTypeOptions struct AbiSystemVClassifyArgumentTypeOptions
{ {
u32 available_gpr; u32 available_gpr;
@ -1953,7 +1949,7 @@ struct AllocaOptions
fn Global* get_current_function(Module* module) fn Global* get_current_function(Module* module)
{ {
Global* parent_function_global = 0; Global* parent_function_global;
if (module->current_function) if (module->current_function)
{ {
parent_function_global = module->current_function; parent_function_global = module->current_function;
@ -1962,6 +1958,10 @@ fn Global* get_current_function(Module* module)
{ {
parent_function_global = module->current_macro_instantiation->instantiation_function; parent_function_global = module->current_macro_instantiation->instantiation_function;
} }
else
{
report_error();
}
return parent_function_global; return parent_function_global;
} }
@ -4095,10 +4095,7 @@ fn void analyze_type(Module* module, Value* value, Type* expected_type, TypeAnal
bool is_ordered = true; bool is_ordered = true;
auto enum_type = aggregate_type->enum_array.enum_type; auto enum_type = aggregate_type->enum_array.enum_type;
auto element_type = aggregate_type->enum_array.element_type; auto element_type = aggregate_type->enum_array.element_type;
if (enum_type->id != TypeId::enumerator) assert(enum_type->id == TypeId::enumerator);
{
report_error();
}
auto fields = enum_type->enumerator.fields; auto fields = enum_type->enumerator.fields;
assert(fields.length <= 64); assert(fields.length <= 64);
@ -9375,7 +9372,6 @@ void emit(Module* module)
abi_argument_type_count += 1; abi_argument_type_count += 1;
} }
for (u64 i = 0; i < semantic_argument_count; i += 1) for (u64 i = 0; i < semantic_argument_count; i += 1)
{ {
auto& abi = function_type->abi.argument_abis[i]; auto& abi = function_type->abi.argument_abis[i];

View File

@ -2693,11 +2693,7 @@ fn Statement* parse_statement(Module* module, Scope* scope)
} break; } break;
case StatementStartKeyword::return_st: case StatementStartKeyword::return_st:
{ {
Value* return_value = 0; auto return_value = parse_value(module, scope, {});
if (module->content[module->offset] != ';')
{
return_value = parse_value(module, scope, {});
}
statement->return_st = return_value; statement->return_st = return_value;
statement->id = StatementId::return_st; statement->id = StatementId::return_st;
} break; } break;