Skip to content

compiler: Get rid of implicit fallthrough terminators #41476

Open
@Keno

Description

@Keno

This has been discussed on slack a bit, but the implicit fallthrough terminator design is
pretty terrible from the point of view of a user actually trying to do CFG manipulations.
The main problems I see with it are:

  1. Basic blocks can't be inserted without worrying about whether the previous block had an implicit fallthrough
  2. Every manipulation that needs to insert statements at the end of the basic block needs special logic to determine whether or not the final statement is a terminator or not and needs separate code paths based on it
  3. GotoIfNot is not particularly symmetric and operations that operate on it need two separate code paths, depending on whether the case they're interested in is the fallthrough or the explicit terminator.

In general our IR data structures work ok for what we need in base, but are quite problematic for general compiler needs. We should see what part of this needs a refactor in Base and what needs to be provided by external packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    designDesign of APIs or of the language itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions