Skip to content
  • Daniel Dunbar's avatar
    Rework IRgen invariant w.r.t. current insert point. · 5c7e3935
    Daniel Dunbar authored
     - EmitStmt is no longer required to finish with a current insertion
       point defined (i.e. it does not need to make dummy
       blocks). Instead, it can clear the insertion point in the builder
       which indicates that the current insertion point is unreachable.
     - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
       which respectively test if there is an insert point and ensure an
       insertion point exists (by making a dummy block).
     - Clearly mark functions in CodeGenFunction which can be called with
       no insertion point defined. Currently this is a limited set, and
       EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.
    
    Remove EmitDummyBlock, which is no longer needed. Clients who haven't
    already cleared the insertion point (typically via EmitBranch) can do
    so by hand.
    
    Remove isDummyBlock, which has effectively been renamed to
    HaveInsertPoint.
    
    The main thrust of this change is that we no longer have create dummy
    blocks just to destroy them a short time later in EmitBlock in the
    common case that there is no unreachable code following something like
    a goto. 
    
    Additionally, this means that we are not using the hokey condition in
    isDummyBlock that a block without a name is a dummy block. Guess how
    well that works when we never emit block names!
    
    llvm-svn: 59089
    5c7e3935
Loading