Documentation ¶
Index ¶
- Variables
- func ArrayType(base types.Type, count int) types.Type
- func BoolType() types.Type
- func Constant(constantType types.Type, value interface{}) value.Value
- func DoubleType() types.Type
- func FloatType() types.Type
- func IntType(bits int) types.Type
- type Block
- func (b *Block) Add(lhs value.Value, rhs value.Value) *instructions.Add
- func (b *Block) Alloca(base types.Type) *instructions.Alloca
- func (b *Block) And(lhs, rhs value.Value) *instructions.And
- func (b *Block) Br(block value.Value) *instructions.Br
- func (b *Block) Call(function value.Value, operands ...value.Value) *instructions.Call
- func (b *Block) Cast(value value.Value, cast types.Type) value.Value
- func (b *Block) CondBr(condition, trueBlock, falseBlock value.Value) *instructions.CondBr
- func (b *Block) Div(lhs, rhs value.Value) *instructions.Div
- func (b *Block) Empty() bool
- func (b *Block) Extractvalue(location value.Value, position value.Value) *instructions.Extractvalue
- func (b *Block) Fadd(lhs value.Value, rhs value.Value) *instructions.Fadd
- func (b *Block) Fcmp(mode string, lhs, rhs value.Value) *instructions.Fcmp
- func (b *Block) Fdiv(lhs value.Value, rhs value.Value) *instructions.Fdiv
- func (b *Block) Fmul(lhs value.Value, rhs value.Value) *instructions.Fmul
- func (b *Block) Fpext(value value.Value, cast types.Type) *instructions.Fpext
- func (b *Block) Fptosi(value value.Value, cast types.Type) *instructions.Fptosi
- func (b *Block) Fptrunc(value value.Value, cast types.Type) *instructions.Fptrunc
- func (b *Block) Fsub(lhs value.Value, rhs value.Value) *instructions.Fsub
- func (b *Block) Function() *Function
- func (b *Block) Getelementptr(typ types.Type, element value.Pointer, location ...value.Value) *instructions.Getelementptr
- func (b *Block) Icmp(mode string, lhs, rhs value.Value) *instructions.Icmp
- func (b *Block) Ident() string
- func (b *Block) Insertvalue(location, value value.Value, position value.Value) *instructions.Insertvalue
- func (b *Block) Llvm() string
- func (b *Block) Load(element value.Pointer) *instructions.Load
- func (b *Block) Mul(lhs value.Value, rhs value.Value) *instructions.Mul
- func (b *Block) Name() string
- func (b *Block) Or(lhs value.Value, rhs value.Value) *instructions.Or
- func (b *Block) Phi() *instructions.Phi
- func (b *Block) Ret(value value.Value) *instructions.Ret
- func (b *Block) Sitofp(value value.Value, cast types.Type) *instructions.Sitofp
- func (b *Block) Srem(lhs value.Value, rhs value.Value) *instructions.Srem
- func (b *Block) Store(element value.Pointer, value value.Value)
- func (b *Block) Sub(lhs value.Value, rhs value.Value) *instructions.Sub
- func (b *Block) Terminated() bool
- func (b *Block) Trunc(value value.Value, cast types.Type) *instructions.Trunc
- func (b *Block) Type() types.Type
- func (b *Block) Xor(lhs value.Value, rhs value.Value) *instructions.Xor
- func (b *Block) Zext(value value.Value, cast types.Type) *instructions.Zext
- type Function
- func (f *Function) AddArgument(argType types.Type, name string) types.Arg
- func (f *Function) AddBlock() *Block
- func (f *Function) Arguments() []types.Arg
- func (f *Function) Entry() *Block
- func (f *Function) Ident() string
- func (f *Function) Llvm() string
- func (f *Function) Module() *Module
- func (f *Function) Name() string
- func (f *Function) Type() types.Type
- type Module
Constants ¶
This section is empty.
Variables ¶
var ( // FloatOeq is a float ordered equal comparison FloatOeq = "oeq" // FloatOlt is a float ordered less than comparison FloatOlt = "olt" // Float One is a float ordered not equals comparison FloatOne = "one" // FloatOgt is a float ordered greater than comparison FloatOgt = "ogt" )
var ( // IntEq is an integer equals comparison IntEq = "eq" // IntNe is an integer not equals comparison IntNe = "ne" // IntUlt is an integer unsigned less than comparison IntUlt = "ult" // IntSlt is an integer signed less than comparison IntSlt = "slt" // IntUgt is an integer unsigned greater than comparison IntUgt = "ugt" // IntSgt is an integer signed greater than comparison IntSgt = "sgt" )
Functions ¶
func DoubleType ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a seqential list of instructions ending with a terminator instruction
func (*Block) Add ¶
Add creates a new add instruction. lhs and rhs must be integer types of the same size. Add returns the result of this instruction with the same type as lhs and rhs.
func (*Block) Alloca ¶
func (b *Block) Alloca(base types.Type) *instructions.Alloca
Alloca creates a new alloca instruction. type is the type you want to allocate space for. Call SetNumber to set the number of elements to allocate for (default 1) Alloca returns the result of this instruction as a pointer with the same type as base type.
func (*Block) And ¶
func (b *Block) And(lhs, rhs value.Value) *instructions.And
And create a new and instruction. lhs and rhs must be boolean types. And returns the result of the instruction as a boolean type.
func (*Block) Br ¶
func (b *Block) Br(block value.Value) *instructions.Br
Br creates a new br instruction. block must be a block type.
func (*Block) Call ¶
Call creates a new call instruction. function must be a function type. operands must match the types of the function arguments. Call returns the result of the instruction with the same type as the function return type.
func (*Block) CondBr ¶
func (b *Block) CondBr(condition, trueBlock, falseBlock value.Value) *instructions.CondBr
CondBr creates a new conditional branch instruction. condition must be a boolean type. trueBlock and falseBlock must be block types.
func (*Block) Div ¶
func (b *Block) Div(lhs, rhs value.Value) *instructions.Div
Div creates a new integer division instruction. lhs and rhs must be integer types. Div returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Extractvalue ¶
func (b *Block) Extractvalue(location value.Value, position value.Value) *instructions.Extractvalue
Extractvalue creates a new extract value instruction location must be an aggregate type position is the index at which to extract the value from location Extractvalue returns the type specified in location at index position
func (*Block) Fadd ¶
Fadd creates a new float add instruction. lhs and rhs must be float or double types. Fadd returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Fcmp ¶
Fcmp creates a new float add instruction. mode controls the behavior of the comparison, see https://godoc.org/github.com/bongo227/goory#pkg-variables. lhs and rhs must be float or double types. Fcmp returns the result of the instruction as a boolean type.
func (*Block) Fdiv ¶
Fdiv creates a new float add instruction. lhs and rhs must be float or double types. Fdiv returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Fmul ¶
Fmul creates a new float add instruction. lhs and rhs must be float or double types. Fmul returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Fpext ¶
Fpext creates a new float extention instruction. value must be a float or double type. cast must be a type larger than value. Fpext returns the result of the instruction with the same type as cast.
func (*Block) Fptosi ¶
Fptosi creates a new float to signed integer type. value must be a float of double type. cast must be an integer type. Fptosi returns the result of the instruction with the same type as cast.
func (*Block) Fptrunc ¶
Fptrunc creates a new float truncation. value must be a float or double type. cast must be a type smaller than value. Fptrunc returns the result of the instruction with the same type as cast.
func (*Block) Fsub ¶
Fsub creates a new float subtraction instruction. lhs and rhs must be float or double types. Fsub returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Getelementptr ¶
func (b *Block) Getelementptr(typ types.Type, element value.Pointer, location ...value.Value) *instructions.Getelementptr
func (*Block) Icmp ¶
Icmp creates a new integer comparison instruction. mode controls the behavior of the comparison, see: https://godoc.org/github.com/bongo227/goory#pkg-variables. lhs and rhs must be integer types of the the same size. Icmp returns the result of the instruction as a boolean type.
func (*Block) Insertvalue ¶
func (b *Block) Insertvalue(location, value value.Value, position value.Value) *instructions.Insertvalue
Insertvalue creates a new insert value instruction. location must be an aggregate type the value is to be inserted into. value must match the type of the location at index position. position spesifys the index in which to insert value in location. Insertvalue returns the result of the instruction with the same type as location.
func (*Block) Load ¶
func (b *Block) Load(element value.Pointer) *instructions.Load
Load creates a new load instruction. Load returns the result of the instruction with the same type as the allocation.
func (*Block) Mul ¶
Mul creates a new integer multiplication instruction. lhs and rhs must be integer types of the the same size. Mul returns the result of the instruction with the same type as lhs and rhs.
func (*Block) Or ¶
Or creates a new bitwise or instruction. lhs and rhs must be boolean types. Or returns the result of the instruction as a boolean type.
func (*Block) Phi ¶
func (b *Block) Phi() *instructions.Phi
Phi creates a new phi instruction. Phi returns the phi instruction to which you add all incoming blocks.
func (*Block) Ret ¶
func (b *Block) Ret(value value.Value) *instructions.Ret
Ret creates a new return instruction. value must be the same type as the function return type.
func (*Block) Sitofp ¶
Sitofp creates a new signed integer to float instruction. value must be an integer type. cast must be a float type. Sitofp returns the result of the instruction with the same type as cast.
func (*Block) Srem ¶
Srem creates a new srem instruction. lhs and rhs must be integer types of the same size. Srem returns the result of this instruction with the same type as lhs and rhs.
func (*Block) Store ¶
Store creates a new store instruction. value must be the same type as the allocation. Store retruns the result of the instruction with the same type as lhs and rhs.
func (*Block) Sub ¶
Sub creates a new float sub instruction. lhs and rhs must be float or double types. Sub retruns the result of the instruction with the same type as lhs and rhs.
func (*Block) Terminated ¶
Terminated returns true if the block is terminated (ends in branch or return)
func (*Block) Trunc ¶
Trunc creates a new integer truncation instruction. value must be an integer type. cast must be a integer type smaller than value. Trunc returns the result of the instruction with the same type as cast.
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
Function is a group of instructions that are executed is a new stack frame
func (*Function) AddArgument ¶
AddArgument adds a new parameter to the function