Optimizing switch statements: Overview and what's new
- Track: GCC (GNU Toolchain)
- Room: K.3.201
- Day: Saturday
- Start: 17:20
- End: 17:40
- Video only: k3201
- Chat: Join the conversation!
During compilation, GCC breaks down switch statements into simpler statements. If a switch has a specific structure, GCC may use techniques that result in faster code. We call these techniques "switch optimizations".
In this talk we'll overview switch optimizations in GCC. Then we'll go into more detail on turning switches into array lookups. In GCC this is called "switch conversion". I'll introduce a new method called "exponential transformation" that I recently contributed to switch conversion. If time permits, we will also discuss potential future work on switch optimizations.
I plan to make this talk beginner-friendly. I myself have started working on GCC just 2 years ago. The talk should however give the audience a good idea about what switch optimizations are available and what they do.
Expected prior knowledge: What is a C switch statement. What is an intermediate representation (or intermediate language).
Speakers
Filip Kastl |