ir

package
v0.0.0-...-6e409f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_ADD = iota
	OP_SUB
	OP_MUL
	OP_S_DIV
	OP_U_DIV
	OP_S_MOD
	OP_U_MOD
	OP_BIT_AND
	OP_BIT_OR
	OP_BIT_XOR
	OP_BIT_LSHIFT
	OP_BIT_RSHIFT
	OP_ARITH_RSHIFT

	OP_EQ
	OP_NEQ
	OP_S_GT
	OP_S_GTEQ
	OP_S_LT
	OP_S_LTEQ
	OP_U_GT
	OP_U_GTEQ
	OP_U_LT
	OP_U_LTEQ

	OP_UMINUS
	OP_BIT_NOT
	OP_NOT

	OP_S_CAST
	OP_U_CAST
)

Variables

This section is empty.

Functions

func OpInternBinary

func OpInternBinary(op string, isSigned bool) int

func OpInternUnary

func OpInternUnary(op string) int

func VisitExpr

func VisitExpr(v IIRVisitor, expr core.IExpr) interface{}

func VisitStmt

func VisitStmt(v IIRVisitor, stmt core.IStmt) interface{}

Types

type Addr

type Addr struct {
	ClassName string
	TypeId    int
	Entity    core.IEntity
}

func NewAddr

func NewAddr(t int, e core.IEntity) *Addr

func (*Addr) AsExpr

func (self *Addr) AsExpr() core.IExpr

func (*Addr) GetAddress

func (self *Addr) GetAddress() core.IOperand

func (Addr) GetAddressNode

func (self Addr) GetAddressNode(t int) core.IExpr

func (*Addr) GetAsmValue

func (self *Addr) GetAsmValue() core.IImmediateValue

func (Addr) GetEntity

func (self Addr) GetEntity() core.IEntity

func (Addr) GetEntityForce

func (self Addr) GetEntityForce() core.IEntity

func (*Addr) GetMemref

func (self *Addr) GetMemref() core.IMemoryReference

func (Addr) GetTypeId

func (self Addr) GetTypeId() int

func (Addr) IsAddr

func (self Addr) IsAddr() bool

func (Addr) IsConstant

func (self Addr) IsConstant() bool

func (Addr) IsVar

func (self Addr) IsVar() bool

func (Addr) String

func (self Addr) String() string

type Assign

type Assign struct {
	ClassName string
	Location  core.Location
	LHS       core.IExpr
	RHS       core.IExpr
}

func NewAssign

func NewAssign(loc core.Location, lhs core.IExpr, rhs core.IExpr) *Assign

func (*Assign) AsStmt

func (self *Assign) AsStmt() core.IStmt

func (Assign) GetLHS

func (self Assign) GetLHS() core.IExpr

func (Assign) GetLocation

func (self Assign) GetLocation() core.Location

func (Assign) GetRHS

func (self Assign) GetRHS() core.IExpr

type Bin

type Bin struct {
	ClassName string
	TypeId    int
	Op        int
	Left      core.IExpr
	Right     core.IExpr
}

func NewBin

func NewBin(t int, op int, left core.IExpr, right core.IExpr) *Bin

func (*Bin) AsExpr

func (self *Bin) AsExpr() core.IExpr

func (*Bin) GetAddress

func (self *Bin) GetAddress() core.IOperand

func (Bin) GetAddressNode

func (self Bin) GetAddressNode(t int) core.IExpr

func (*Bin) GetAsmValue

func (self *Bin) GetAsmValue() core.IImmediateValue

func (Bin) GetEntityForce

func (self Bin) GetEntityForce() core.IEntity

func (Bin) GetLeft

func (self Bin) GetLeft() core.IExpr

func (*Bin) GetMemref

func (self *Bin) GetMemref() core.IMemoryReference

func (Bin) GetOp

func (self Bin) GetOp() int

func (Bin) GetRight

func (self Bin) GetRight() core.IExpr

func (Bin) GetTypeId

func (self Bin) GetTypeId() int

func (Bin) IsAddr

func (self Bin) IsAddr() bool

func (Bin) IsConstant

func (self Bin) IsConstant() bool

func (Bin) IsVar

func (self Bin) IsVar() bool

func (Bin) String

func (self Bin) String() string

type CJump

type CJump struct {
	ClassName string
	Location  core.Location
	Cond      core.IExpr
	ThenLabel *asm.Label
	ElseLabel *asm.Label
}

func NewCJump

func NewCJump(loc core.Location, cond core.IExpr, thenLabel *asm.Label, elseLabel *asm.Label) *CJump

func (*CJump) AsStmt

func (self *CJump) AsStmt() core.IStmt

func (CJump) GetCond

func (self CJump) GetCond() core.IExpr

func (CJump) GetElseLabel

func (self CJump) GetElseLabel() *asm.Label

func (CJump) GetLocation

func (self CJump) GetLocation() core.Location

func (CJump) GetThenLabel

func (self CJump) GetThenLabel() *asm.Label

type Call

type Call struct {
	ClassName string
	TypeId    int
	Expr      core.IExpr
	Args      []core.IExpr
}

func NewCall

func NewCall(t int, expr core.IExpr, args []core.IExpr) *Call

func (*Call) AsExpr

func (self *Call) AsExpr() core.IExpr

func (*Call) GetAddress

func (self *Call) GetAddress() core.IOperand

func (Call) GetAddressNode

func (self Call) GetAddressNode(t int) core.IExpr

func (Call) GetArgs

func (self Call) GetArgs() []core.IExpr

func (*Call) GetAsmValue

func (self *Call) GetAsmValue() core.IImmediateValue

func (Call) GetEntityForce

func (self Call) GetEntityForce() core.IEntity

func (Call) GetExpr

func (self Call) GetExpr() core.IExpr

func (Call) GetFunction

func (self Call) GetFunction() core.IFunction

func (*Call) GetMemref

func (self *Call) GetMemref() core.IMemoryReference

func (Call) GetTypeId

func (self Call) GetTypeId() int

func (Call) IsAddr

func (self Call) IsAddr() bool

func (Call) IsConstant

func (self Call) IsConstant() bool

func (Call) IsStaticCall

func (self Call) IsStaticCall() bool

func (Call) IsVar

func (self Call) IsVar() bool

func (Call) NumArgs

func (self Call) NumArgs() int

func (Call) String

func (self Call) String() string

type Case

type Case struct {
	ClassName string
	Value     int64
	Label     *asm.Label
}

func NewCase

func NewCase(value int64, label *asm.Label) *Case

func (Case) GetLabel

func (self Case) GetLabel() *asm.Label

func (Case) GetValue

func (self Case) GetValue() int64

type ExprStmt

type ExprStmt struct {
	ClassName string
	Location  core.Location
	Expr      core.IExpr
}

func NewExprStmt

func NewExprStmt(loc core.Location, expr core.IExpr) *ExprStmt

func (*ExprStmt) AsStmt

func (self *ExprStmt) AsStmt() core.IStmt

func (ExprStmt) GetExpr

func (self ExprStmt) GetExpr() core.IExpr

func (ExprStmt) GetLocation

func (self ExprStmt) GetLocation() core.Location

type IIRVisitor

type IIRVisitor interface {
	VisitStmt(core.IStmt) interface{}
	VisitExpr(core.IExpr) interface{}
}

type IR

type IR struct {
	ClassName string
	Location  xtc_core.Location
	Defvars   []*xtc_entity.DefinedVariable
	Defuns    []*xtc_entity.DefinedFunction
	Funcdecls []*xtc_entity.UndefinedFunction
	// contains filtered or unexported fields
}

func NewIR

func (*IR) AllFunctions

func (self *IR) AllFunctions() []xtc_core.IFunction

func (*IR) AllGlobalVariables

func (self *IR) AllGlobalVariables() []xtc_core.IVariable

func (*IR) GetConstantTable

func (self *IR) GetConstantTable() *xtc_entity.ConstantTable

func (*IR) GetDefinedCommonSymbols

func (self *IR) GetDefinedCommonSymbols() []*xtc_entity.DefinedVariable

func (*IR) GetDefinedFunctions

func (self *IR) GetDefinedFunctions() []*xtc_entity.DefinedFunction

func (*IR) GetDefinedGlobalVariables

func (self *IR) GetDefinedGlobalVariables() []*xtc_entity.DefinedVariable

func (*IR) GetDefinedVariables

func (self *IR) GetDefinedVariables() []*xtc_entity.DefinedVariable

func (*IR) GetFileName

func (self *IR) GetFileName() string

func (*IR) GetLocation

func (self *IR) GetLocation() xtc_core.Location

func (*IR) GetScope

func (self *IR) GetScope() *xtc_entity.ToplevelScope

func (*IR) IsCommonSymbolDefined

func (self *IR) IsCommonSymbolDefined() bool

func (*IR) IsFunctionDefined

func (self *IR) IsFunctionDefined() bool

func (*IR) IsGlobalVariableDefined

func (self *IR) IsGlobalVariableDefined() bool

func (*IR) IsStringLiteralDefined

func (self *IR) IsStringLiteralDefined() bool

type Int

type Int struct {
	ClassName string
	TypeId    int
	Value     int64
}

func NewInt

func NewInt(t int, value int64) *Int

func (*Int) AsExpr

func (self *Int) AsExpr() core.IExpr

func (*Int) GetAddress

func (self *Int) GetAddress() core.IOperand

func (Int) GetAddressNode

func (self Int) GetAddressNode(t int) core.IExpr

func (*Int) GetAsmValue

func (self *Int) GetAsmValue() core.IImmediateValue

func (Int) GetEntityForce

func (self Int) GetEntityForce() core.IEntity

func (*Int) GetMemref

func (self *Int) GetMemref() core.IMemoryReference

func (Int) GetTypeId

func (self Int) GetTypeId() int

func (Int) GetValue

func (self Int) GetValue() int64

func (Int) IsAddr

func (self Int) IsAddr() bool

func (Int) IsConstant

func (self Int) IsConstant() bool

func (Int) IsVar

func (self Int) IsVar() bool

func (Int) String

func (self Int) String() string

type Jump

type Jump struct {
	ClassName string
	Location  core.Location
	Label     *asm.Label
}

func NewJump

func NewJump(loc core.Location, label *asm.Label) *Jump

func (*Jump) AsStmt

func (self *Jump) AsStmt() core.IStmt

func (Jump) GetLabel

func (self Jump) GetLabel() *asm.Label

func (Jump) GetLocation

func (self Jump) GetLocation() core.Location

type LabelStmt

type LabelStmt struct {
	ClassName string
	Location  core.Location
	Label     *asm.Label
}

func NewLabelStmt

func NewLabelStmt(loc core.Location, label *asm.Label) *LabelStmt

func (*LabelStmt) AsStmt

func (self *LabelStmt) AsStmt() core.IStmt

func (LabelStmt) GetLabel

func (self LabelStmt) GetLabel() *asm.Label

func (LabelStmt) GetLocation

func (self LabelStmt) GetLocation() core.Location

type Mem

type Mem struct {
	ClassName string
	TypeId    int
	Expr      core.IExpr
}

func NewMem

func NewMem(t int, expr core.IExpr) *Mem

func (*Mem) AsExpr

func (self *Mem) AsExpr() core.IExpr

func (*Mem) GetAddress

func (self *Mem) GetAddress() core.IOperand

func (Mem) GetAddressNode

func (self Mem) GetAddressNode(t int) core.IExpr

func (*Mem) GetAsmValue

func (self *Mem) GetAsmValue() core.IImmediateValue

func (Mem) GetEntityForce

func (self Mem) GetEntityForce() core.IEntity

func (Mem) GetExpr

func (self Mem) GetExpr() core.IExpr

func (*Mem) GetMemref

func (self *Mem) GetMemref() core.IMemoryReference

func (Mem) GetTypeId

func (self Mem) GetTypeId() int

func (Mem) IsAddr

func (self Mem) IsAddr() bool

func (Mem) IsConstant

func (self Mem) IsConstant() bool

func (Mem) IsVar

func (self Mem) IsVar() bool

func (Mem) String

func (self Mem) String() string

type Return

type Return struct {
	ClassName string
	Location  core.Location
	Expr      core.IExpr
}

func NewReturn

func NewReturn(loc core.Location, expr core.IExpr) *Return

func (*Return) AsStmt

func (self *Return) AsStmt() core.IStmt

func (Return) GetExpr

func (self Return) GetExpr() core.IExpr

func (Return) GetLocation

func (self Return) GetLocation() core.Location

func (Return) HasExpr

func (self Return) HasExpr() bool

type Str

type Str struct {
	ClassName string
	TypeId    int
	Entry     *entity.ConstantEntry
}

func NewStr

func NewStr(t int, entry *entity.ConstantEntry) *Str

func (*Str) AsExpr

func (self *Str) AsExpr() core.IExpr

func (*Str) GetAddress

func (self *Str) GetAddress() core.IOperand

func (Str) GetAddressNode

func (self Str) GetAddressNode(t int) core.IExpr

func (*Str) GetAsmValue

func (self *Str) GetAsmValue() core.IImmediateValue

func (Str) GetEntityForce

func (self Str) GetEntityForce() core.IEntity

func (*Str) GetMemref

func (self *Str) GetMemref() core.IMemoryReference

func (Str) GetSymbol

func (self Str) GetSymbol() core.ISymbol

func (Str) GetTypeId

func (self Str) GetTypeId() int

func (Str) IsAddr

func (self Str) IsAddr() bool

func (Str) IsConstant

func (self Str) IsConstant() bool

func (Str) IsVar

func (self Str) IsVar() bool

func (Str) String

func (self Str) String() string

type Switch

type Switch struct {
	ClassName    string
	Location     core.Location
	Cond         core.IExpr
	Cases        []*Case
	DefaultLabel *asm.Label
	EndLabel     *asm.Label
}

func NewSwitch

func NewSwitch(loc core.Location, cond core.IExpr, cases []*Case, defaultLabel *asm.Label, endLabel *asm.Label) *Switch

func (*Switch) AsStmt

func (self *Switch) AsStmt() core.IStmt

func (Switch) GetCases

func (self Switch) GetCases() []*Case

func (Switch) GetCond

func (self Switch) GetCond() core.IExpr

func (Switch) GetDefaultLabel

func (self Switch) GetDefaultLabel() *asm.Label

func (Switch) GetEndLabel

func (self Switch) GetEndLabel() *asm.Label

func (Switch) GetLocation

func (self Switch) GetLocation() core.Location

type Uni

type Uni struct {
	ClassName string
	TypeId    int
	Op        int
	Expr      core.IExpr
}

func NewUni

func NewUni(t int, op int, expr core.IExpr) *Uni

func (*Uni) AsExpr

func (self *Uni) AsExpr() core.IExpr

func (*Uni) GetAddress

func (self *Uni) GetAddress() core.IOperand

func (Uni) GetAddressNode

func (self Uni) GetAddressNode(t int) core.IExpr

func (*Uni) GetAsmValue

func (self *Uni) GetAsmValue() core.IImmediateValue

func (Uni) GetEntityForce

func (self Uni) GetEntityForce() core.IEntity

func (Uni) GetExpr

func (self Uni) GetExpr() core.IExpr

func (*Uni) GetMemref

func (self *Uni) GetMemref() core.IMemoryReference

func (Uni) GetOp

func (self Uni) GetOp() int

func (Uni) GetTypeId

func (self Uni) GetTypeId() int

func (Uni) IsAddr

func (self Uni) IsAddr() bool

func (Uni) IsConstant

func (self Uni) IsConstant() bool

func (Uni) IsVar

func (self Uni) IsVar() bool

func (Uni) String

func (self Uni) String() string

type Var

type Var struct {
	ClassName string
	TypeId    int
	Entity    core.IEntity
}

func NewVar

func NewVar(t int, e core.IEntity) *Var

func (*Var) AsExpr

func (self *Var) AsExpr() core.IExpr

func (*Var) GetAddress

func (self *Var) GetAddress() core.IOperand

func (Var) GetAddressNode

func (self Var) GetAddressNode(t int) core.IExpr

func (*Var) GetAsmValue

func (self *Var) GetAsmValue() core.IImmediateValue

func (Var) GetEntityForce

func (self Var) GetEntityForce() core.IEntity

func (*Var) GetMemref

func (self *Var) GetMemref() core.IMemoryReference

func (Var) GetTypeId

func (self Var) GetTypeId() int

func (Var) IsAddr

func (self Var) IsAddr() bool

func (Var) IsConstant

func (self Var) IsConstant() bool

func (Var) IsVar

func (self Var) IsVar() bool

func (Var) String

func (self Var) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL