github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/block.go (about)

     1  package ccall
     2  
     3  /*
     4  #cgo CFLAGS: -I../
     5  #cgo CFLAGS: -Iinclude
     6  
     7  #include <jit/jit.h>
     8  */
     9  import "C"
    10  
    11  type Block struct {
    12  	c C.jit_block_t
    13  }
    14  
    15  func toBlock(c C.jit_block_t) *Block {
    16  	return &Block{c}
    17  }
    18  
    19  func (b *Block) Function() *Function {
    20  	return toFunction(C.jit_block_get_function(b.c))
    21  }
    22  
    23  func (b *Block) Context() *Context {
    24  	return toContext(C.jit_block_get_context(b.c))
    25  }
    26  
    27  func (b *Block) Label() *Label {
    28  	return toLabel(C.jit_block_get_label(b.c))
    29  }
    30  
    31  func (b *Block) NextLabel(label *Label) *Label {
    32  	return toLabel(C.jit_block_get_next_label(b.c, label.c))
    33  }
    34  
    35  func (b *Block) IsReachable() bool {
    36  	return int(C.jit_block_is_reachable(b.c)) == 1
    37  }
    38  
    39  func (b *Block) EndsInDead() bool {
    40  	return int(C.jit_block_ends_in_dead(b.c)) == 1
    41  }