diff options
-rw-r--r-- | src/hir/from_ast.cpp | 10 | ||||
-rw-r--r-- | src/hir/hir.hpp | 1 | ||||
-rw-r--r-- | src/trans/target.cpp | 2 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index 4def1a41..7f25a42b 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -885,6 +885,7 @@ namespace { { ASSERT_BUG(Span(), attr_repr->has_sub_items(), "#[repr] attribute malformed, " << *attr_repr); bool is_c = false; + bool is_simd = false; bool is_packed = false; ASSERT_BUG(Span(), attr_repr->items().size() > 0, "#[repr] attribute malformed, " << *attr_repr); for( const auto& a : attr_repr->items() ) @@ -897,17 +898,26 @@ namespace { else if( repr_str == "packed" ) { is_packed = true; } + else if( repr_str == "simd" ) { + is_simd = true; + } else { TODO(a.span(), "Handle struct repr '" << repr_str << "'"); } } if( is_packed ) { + // TODO: What if `simd` is present? + // NOTE: repr(packed,C) is treated as the same as repr(packed) in mrustc struct_repr = ::HIR::Struct::Repr::Packed; } else if( is_c ) { + // TODO: What if `simd` is present? struct_repr = ::HIR::Struct::Repr::C; } + else if( is_simd ) { + struct_repr = ::HIR::Struct::Repr::Simd; + } else { } } diff --git a/src/hir/hir.hpp b/src/hir/hir.hpp index f6a1b990..20b9ad58 100644 --- a/src/hir/hir.hpp +++ b/src/hir/hir.hpp @@ -261,6 +261,7 @@ public: Rust, C, Packed, + Simd, }; TAGGED_UNION(Data, Unit, (Unit, struct {}), diff --git a/src/trans/target.cpp b/src/trans/target.cpp index 72d81edd..c1dce972 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -569,6 +569,7 @@ namespace { packed = true; TODO(sp, "make_struct_repr - repr(packed)"); // needs codegen to know to pack the structure break; + case ::HIR::Struct::Repr::Simd: case ::HIR::Struct::Repr::C: // No sorting, no packing break; @@ -893,6 +894,7 @@ namespace { // NOTE: codegen_c checks m_repr for packing too break; case ::HIR::Struct::Repr::C: + case ::HIR::Struct::Repr::Simd: // No sorting, no packing break; case ::HIR::Struct::Repr::Rust: |