diff options
author | David Faust <david.faust@oracle.com> | 2022-07-07 11:41:54 -0700 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2022-07-07 11:41:54 -0700 |
commit | b7c4aa942fa828038106105524af2c568acca7ac (patch) | |
tree | 8d6ba220d7ca4147c0d90ef5dc0e9f3054a7c641 /gcc/rust/resolve/rust-ast-resolve-expr.cc | |
parent | 7784232540214b0fa500fa5682326f8841f170d5 (diff) | |
download | gcc-b7c4aa942fa828038106105524af2c568acca7ac.zip gcc-b7c4aa942fa828038106105524af2c568acca7ac.tar.gz gcc-b7c4aa942fa828038106105524af2c568acca7ac.tar.bz2 |
backend: initial support for matches on tuples
This is a first take on compiling matches on more complex expressions,
starting with tuples.
The general idea is to first rearrange the match into a simpler form, in
which only one element of the scrutinee tuple is examined at a time.
The remaining elements are then checked by a new match in each arm. By
repeating this process, we end up with a series of nested matches each
checking one element of the original scrutinee, which is equivalent to
the original match expression, and which lowers directly to SWITCH_EXPR
tree nodes (since these can only switch on one thing).
The resulting SWITCH_EXPRs may be messy, and unoptimal, but we can rely
on later optimizations in GENERIC and GIMPLE to clean them up for us.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.cc')
0 files changed, 0 insertions, 0 deletions