aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-01-07 18:15:37 +0000
committerPhilip Herron <philip.herron@embecosm.com>2025-01-10 09:04:48 +0000
commit806166db9db83bee816d169a13ab9992de9d66a0 (patch)
tree95c64de3b2e7753ff85e7aa001d2316f8144d9e2 /gcc/gimple-expr.h
parent1eaf085607f39111370e2c485ca819da7e14dfd1 (diff)
downloadgcc-806166db9db83bee816d169a13ab9992de9d66a0.zip
gcc-806166db9db83bee816d169a13ab9992de9d66a0.tar.gz
gcc-806166db9db83bee816d169a13ab9992de9d66a0.tar.bz2
gccrs: cleanup our enum type layout to be closer to rustc
This changes our enum type layout so for example: enum Foo { A, B, C(char), D { x: i32, y: i32 }, } Used to get layed out like this in gccrs: union { struct A { int RUST$ENUM$DISR; }; struct B { int RUST$ENUM$DISR; }; struct C { int RUST$ENUM$DISR; char __0; }; struct D { int RUST$ENUM$DISR; i64 x; i64 y; }; } This has some issues notably with the constexpr because this is just a giant union it means its not simple to constify what enum variant we are looking at because the discriminant is a mess. This now gets layed out as: struct { int RUST$ENUM$DISR; union { struct A { }; struct B { }; struct C { char __0; }; struct D { i64 x; i64 y; }; } payload; } This layout is much cleaner and allows for our constexpr to work properly. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): new layout * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise (CompilePatternBindings::visit): likewise * backend/rust-compile-resolve-path.cc: likewise * backend/rust-compile-type.cc (TyTyResolveCompile::visit): implement new layout * rust-gcc.cc (constructor_expression): get rid of useless assert Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/gimple-expr.h')
0 files changed, 0 insertions, 0 deletions