github.com/llir/llvm@v0.3.6/ir/block_bitwise.go (about)

     1  package ir
     2  
     3  import (
     4  	"github.com/llir/llvm/ir/value"
     5  )
     6  
     7  // --- [ Bitwise instructions ] ------------------------------------------------
     8  
     9  // ~~~ [ shl ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    10  
    11  // NewShl appends a new shl instruction to the basic block based on the given
    12  // operands.
    13  func (block *Block) NewShl(x, y value.Value) *InstShl {
    14  	inst := NewShl(x, y)
    15  	block.Insts = append(block.Insts, inst)
    16  	return inst
    17  }
    18  
    19  // ~~~ [ lshr ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    20  
    21  // NewLShr appends a new lshr instruction to the basic block based on the given
    22  // operands.
    23  func (block *Block) NewLShr(x, y value.Value) *InstLShr {
    24  	inst := NewLShr(x, y)
    25  	block.Insts = append(block.Insts, inst)
    26  	return inst
    27  }
    28  
    29  // ~~~ [ ashr ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    30  
    31  // NewAShr appends a new ashr instruction to the basic block based on the given
    32  // operands.
    33  func (block *Block) NewAShr(x, y value.Value) *InstAShr {
    34  	inst := NewAShr(x, y)
    35  	block.Insts = append(block.Insts, inst)
    36  	return inst
    37  }
    38  
    39  // ~~~ [ and ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    40  
    41  // NewAnd appends a new and instruction to the basic block based on the given
    42  // operands.
    43  func (block *Block) NewAnd(x, y value.Value) *InstAnd {
    44  	inst := NewAnd(x, y)
    45  	block.Insts = append(block.Insts, inst)
    46  	return inst
    47  }
    48  
    49  // ~~~ [ or ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    50  
    51  // NewOr appends a new or instruction to the basic block based on the given
    52  // operands.
    53  func (block *Block) NewOr(x, y value.Value) *InstOr {
    54  	inst := NewOr(x, y)
    55  	block.Insts = append(block.Insts, inst)
    56  	return inst
    57  }
    58  
    59  // ~~~ [ xor ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    60  
    61  // NewXor appends a new xor instruction to the basic block based on the given
    62  // operands.
    63  func (block *Block) NewXor(x, y value.Value) *InstXor {
    64  	inst := NewXor(x, y)
    65  	block.Insts = append(block.Insts, inst)
    66  	return inst
    67  }