mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Ignore ir_emit_byte_swap for constant values
This commit is contained in:
+14
-2
@@ -1812,11 +1812,23 @@ void init_core_source_code_location(Checker *c) {
|
|||||||
|
|
||||||
void init_core_map_type(Checker *c) {
|
void init_core_map_type(Checker *c) {
|
||||||
if (t_map_key == nullptr) {
|
if (t_map_key == nullptr) {
|
||||||
t_map_key = find_core_type(c, str_lit("Map_Key"));
|
Entity *e = find_core_entity(c, str_lit("Map_Key"));
|
||||||
|
if (e->state == EntityState_Unresolved) {
|
||||||
|
auto ctx = c->init_ctx;
|
||||||
|
check_entity_decl(&ctx, e, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
t_map_key = e->type;
|
||||||
|
GB_ASSERT(t_map_key != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t_map_header == nullptr) {
|
if (t_map_header == nullptr) {
|
||||||
t_map_header = find_core_type(c, str_lit("Map_Header"));
|
Entity *e = find_core_entity(c, str_lit("Map_Header"));
|
||||||
|
if (e->state == EntityState_Unresolved) {
|
||||||
|
auto ctx = c->init_ctx;
|
||||||
|
check_entity_decl(&ctx, e, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
t_map_header = e->type;
|
||||||
|
GB_ASSERT(t_map_header != nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4372,6 +4372,9 @@ irValue *ir_emit_uintptr_to_ptr(irProcedure *proc, irValue *value, Type *t) {
|
|||||||
|
|
||||||
irValue *ir_emit_byte_swap(irProcedure *proc, irValue *value, Type *t) {
|
irValue *ir_emit_byte_swap(irProcedure *proc, irValue *value, Type *t) {
|
||||||
Type *vt = core_type(ir_type(value));
|
Type *vt = core_type(ir_type(value));
|
||||||
|
if (is_type_untyped(vt)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
GB_ASSERT(type_size_of(vt) == type_size_of(t));
|
GB_ASSERT(type_size_of(vt) == type_size_of(t));
|
||||||
return ir_emit(proc, ir_instr_conv(proc, irConv_byteswap, value, vt, t));
|
return ir_emit(proc, ir_instr_conv(proc, irConv_byteswap, value, vt, t));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user