github.com/llir/llvm@v0.3.6/ir/block_aggregate.go (about) 1 package ir 2 3 import ( 4 "github.com/llir/llvm/ir/value" 5 ) 6 7 // --- [ Aggregate instructions ] ---------------------------------------------- 8 9 // ~~~ [ extractvalue ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 11 // NewExtractValue appends a new extractvalue instruction to the basic block 12 // based on the given aggregate value and indicies. 13 func (block *Block) NewExtractValue(x value.Value, indices ...uint64) *InstExtractValue { 14 inst := NewExtractValue(x, indices...) 15 block.Insts = append(block.Insts, inst) 16 return inst 17 } 18 19 // ~~~ [ insertvalue ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 20 21 // NewInsertValue appends a new insertvalue instruction to the basic block based 22 // on the given aggregate value, element and indicies. 23 func (block *Block) NewInsertValue(x, elem value.Value, indices ...uint64) *InstInsertValue { 24 inst := NewInsertValue(x, elem, indices...) 25 block.Insts = append(block.Insts, inst) 26 return inst 27 }