cir

package
v0.8.0-test1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCType

func ToCType(from types.Type) ctypes.Type

Types

type AddExpr

type AddExpr struct {
	X Expr
	Y Expr
}

************************************* AddExpr: *************************************

func NewAddExpr

func NewAddExpr(x, y Expr) *AddExpr

func (*AddExpr) CIRString

func (e *AddExpr) CIRString() string

func (*AddExpr) Type

func (e *AddExpr) Type() ctypes.Type

type AssignStmt

type AssignStmt struct {
	Lh Expr
	Rh Expr
}

************************************* AssignStmt: *************************************

func NewAssignStmt

func NewAssignStmt(l, r Expr) *AssignStmt

func (*AssignStmt) CIRString

func (s *AssignStmt) CIRString() string

type BlackLine

type BlackLine struct {
}

************************************* BlackLine: *************************************

func NewBlackLine

func NewBlackLine() *BlackLine

func (*BlackLine) CIRString

func (s *BlackLine) CIRString() string

type CIRStringer

type CIRStringer interface {
	CIRString() string
}

************************************* CIRStringer: *************************************

type CallExpr

type CallExpr struct {
	Func Expr
	Args []Expr
}

************************************* CallExpr: *************************************

func NewCallExpr

func NewCallExpr(fn Expr, args []Expr) *CallExpr

func (*CallExpr) CIRString

func (s *CallExpr) CIRString() string

func (*CallExpr) Type

func (s *CallExpr) Type() ctypes.Type

type EqlExpr

type EqlExpr struct {
	X Expr
	Y Expr
}

************************************* EqlExpr: *************************************

func NewEqlExpr

func NewEqlExpr(x, y Expr) *EqlExpr

func (*EqlExpr) CIRString

func (e *EqlExpr) CIRString() string

func (*EqlExpr) Type

func (e *EqlExpr) Type() ctypes.Type

type Expr

type Expr interface {
	CIRStringer
	Type() ctypes.Type
}

************************************* Expr: *************************************

type ExprStmt

type ExprStmt struct {
	X Expr
}

************************************* ExprStmt: *************************************

func NewExprStmt

func NewExprStmt(x Expr) *ExprStmt

func (*ExprStmt) CIRString

func (s *ExprStmt) CIRString() string

type FuncDecl

type FuncDecl struct {
	Ident
	Result ctypes.Type
	Params []VarDecl
	Body   *Scope
}

************************************* FuncDecl: 函数声明 *************************************

func NewFuncDecl

func NewFuncDecl(name string, result ctypes.Type, params []VarDecl) *FuncDecl

func (*FuncDecl) CIRString

func (f *FuncDecl) CIRString() string

type GetaddrExpr

type GetaddrExpr struct {
	X Expr
}

************************************* GetaddrExpr: *************************************

func NewGetaddrExpr

func NewGetaddrExpr(x Expr) *GetaddrExpr

func (*GetaddrExpr) CIRString

func (e *GetaddrExpr) CIRString() string

func (*GetaddrExpr) Type

func (e *GetaddrExpr) Type() ctypes.Type

type Ident

type Ident struct {
	Name string
}

************************************* Ident: *************************************

func NewIdent

func NewIdent(s string) *Ident

func (*Ident) CIRString

func (i *Ident) CIRString() string

func (*Ident) IsExpr

func (i *Ident) IsExpr()

type IfStmt

type IfStmt struct {
	Cond  Expr
	Succs [2]int
}

************************************* IfStmt: *************************************

func NewIfStmt

func NewIfStmt(cond Expr, succs [2]int) *IfStmt

func (*IfStmt) CIRString

func (s *IfStmt) CIRString() string

type JumpStmt

type JumpStmt struct {
	Name string
}

************************************* JumpStmt: *************************************

func NewJumpStmt

func NewJumpStmt(name string) *JumpStmt

func (*JumpStmt) CIRString

func (s *JumpStmt) CIRString() string

type Label

type Label struct {
	Name string
}

************************************* Label: *************************************

func NewLabel

func NewLabel(name string) *Label

func (*Label) CIRString

func (s *Label) CIRString() string

type LoadExpr

type LoadExpr struct {
	// contains filtered or unexported fields
}

************************************* LoadExpr: *************************************

func NewLoadExpr

func NewLoadExpr(expr Expr) *LoadExpr

func (*LoadExpr) CIRString

func (e *LoadExpr) CIRString() string

func (*LoadExpr) Type

func (e *LoadExpr) Type() ctypes.Type

type MulExpr

type MulExpr struct {
	X Expr
	Y Expr
}

************************************* MulExpr: *************************************

func NewMulExpr

func NewMulExpr(x, y Expr) *MulExpr

func (*MulExpr) CIRString

func (e *MulExpr) CIRString() string

func (*MulExpr) Type

func (e *MulExpr) Type() ctypes.Type

type NotExpr

type NotExpr struct {
	X Expr
}

************************************* NotExpr: *************************************

func NewNotExpr

func NewNotExpr(x Expr) *NotExpr

func (*NotExpr) CIRString

func (e *NotExpr) CIRString() string

func (*NotExpr) Type

func (e *NotExpr) Type() ctypes.Type

type PhiEdge

type PhiEdge struct {
	Incoming int
	Value    Expr
}

************************************* PhiStmt: *************************************

type PhiStmt

type PhiStmt struct {
	IncomingBlockId Expr
	Dest            Expr
	Edges           []PhiEdge
}

func NewPhiStmt

func NewPhiStmt(incoming Expr, dest Expr, edges []PhiEdge) *PhiStmt

func (*PhiStmt) CIRString

func (s *PhiStmt) CIRString() string

type QuoExpr

type QuoExpr struct {
	X Expr
	Y Expr
}

************************************* QuoExpr: *************************************

func NewQuoExpr

func NewQuoExpr(x, y Expr) *QuoExpr

func (*QuoExpr) CIRString

func (e *QuoExpr) CIRString() string

func (*QuoExpr) Type

func (e *QuoExpr) Type() ctypes.Type

type RawExpr

type RawExpr struct {
	// contains filtered or unexported fields
}

************************************* RawExpr: *************************************

func NewRawExpr

func NewRawExpr(r string, t ctypes.Type) *RawExpr

func (*RawExpr) CIRString

func (e *RawExpr) CIRString() string

func (*RawExpr) Type

func (e *RawExpr) Type() ctypes.Type

type ReturnStmt

type ReturnStmt struct {
	Vars []Expr
}

************************************* ReturnStmt: *************************************

func NewReturnStmt

func NewReturnStmt(v []Expr) *ReturnStmt

func (*ReturnStmt) CIRString

func (s *ReturnStmt) CIRString() string

type Scope

type Scope struct {
	//父域指针,Scope.NewScope()设置该值
	Parent *Scope

	//在该域中定义的结构体
	Structs []*StructDecl

	//在该域中定义的函数
	Funcs []*FuncDecl

	//域中包含的语句
	Stmts []Stmt

	//在该域中定义的变量(含局部变量和临时变量,局部变量位于域头部结构体之后,临时变量可出现于域内任意位置)
	Vars []*VarDecl
	// contains filtered or unexported fields
}

************************************* Scope: CIR的域结构 Scope可近似理解为由大括号对{}括起来的语句块 *************************************

func NewScope

func NewScope(parent *Scope) *Scope

func (*Scope) AddAssignStmt

func (s *Scope) AddAssignStmt(l, r Expr) *AssignStmt

func (*Scope) AddBlackLine

func (s *Scope) AddBlackLine() *BlackLine

func (*Scope) AddExprStmt

func (s *Scope) AddExprStmt(x Expr) Stmt

func (*Scope) AddFuncDecl

func (s *Scope) AddFuncDecl(name string, result ctypes.Type, params []VarDecl) *FuncDecl

func (*Scope) AddIfStmt

func (s *Scope) AddIfStmt(cond Expr, succs [2]int) *IfStmt

func (*Scope) AddJumpStmt

func (s *Scope) AddJumpStmt(name string) *JumpStmt

func (*Scope) AddLabel

func (s *Scope) AddLabel(name string) *Label

func (*Scope) AddLocalVarDecl

func (s *Scope) AddLocalVarDecl(name string, t ctypes.Type) *VarDecl

func (*Scope) AddPhiStmt

func (s *Scope) AddPhiStmt(incoming Expr, dest Expr, edges []PhiEdge) *PhiStmt

func (*Scope) AddReturnStmt

func (s *Scope) AddReturnStmt(v []Expr) *ReturnStmt

func (*Scope) AddScope

func (s *Scope) AddScope() *Scope

func (*Scope) AddStoreStmt

func (s *Scope) AddStoreStmt(addr, value Expr) *StoreStmt

func (*Scope) AddStructDecl

func (s *Scope) AddStructDecl(name string, m []Var) *StructDecl

func (*Scope) AddTempVarDecl

func (s *Scope) AddTempVarDecl(name string, t ctypes.Type) *VarDeclStmt

func (*Scope) AddTupleDecl

func (s *Scope) AddTupleDecl(t ctypes.Tuple) *StructDecl

func (*Scope) CIRString

func (s *Scope) CIRString() string

func (*Scope) Lookup

func (s *Scope) Lookup(name string) (*Scope, Expr)

func (*Scope) Type

func (s *Scope) Type() ctypes.Type

type SelectExpr

type SelectExpr struct {
	// contains filtered or unexported fields
}

************************************* SelectExpr: *************************************

func NewSelectExpr

func NewSelectExpr(x, y Expr) *SelectExpr

func (*SelectExpr) CIRString

func (s *SelectExpr) CIRString() string

func (*SelectExpr) Type

func (s *SelectExpr) Type() ctypes.Type

type Stmt

type Stmt interface {
	CIRStringer
	// contains filtered or unexported methods
}

************************************* Stmt: *************************************

type StoreStmt

type StoreStmt struct {
	// contains filtered or unexported fields
}

************************************* StoreStmt: *************************************

func NewStoreStmt

func NewStoreStmt(addr, value Expr) *StoreStmt

func (*StoreStmt) CIRString

func (s *StoreStmt) CIRString() string

type StructDecl

type StructDecl struct {
	ctypes.Struct
}

************************************* StructDecl: 结构体声明 *************************************

func NewStructDecl

func NewStructDecl(name string, m []Var) *StructDecl

func (*StructDecl) CIRString

func (s *StructDecl) CIRString() string

type SubExpr

type SubExpr struct {
	X Expr
	Y Expr
}

************************************* SubExpr: *************************************

func NewSubExpr

func NewSubExpr(x, y Expr) *SubExpr

func (*SubExpr) CIRString

func (e *SubExpr) CIRString() string

func (*SubExpr) Type

func (e *SubExpr) Type() ctypes.Type

type Var

type Var struct {
	Name string

	AssociatedSSAObj interface{}
	// contains filtered or unexported fields
}

************************************* Var: *************************************

func NewVar

func NewVar(n string, t ctypes.Type) *Var

func (*Var) CIRString

func (i *Var) CIRString() string

func (*Var) Type

func (i *Var) Type() ctypes.Type

type VarDecl

type VarDecl struct {
	Var
	InitVal Expr
}

************************************* VarDecl: 变量声明 *************************************

func NewVarDecl

func NewVarDecl(name string, t ctypes.Type) *VarDecl

func (*VarDecl) CIRString

func (v *VarDecl) CIRString() string

type VarDeclStmt

type VarDeclStmt struct {
	VarDecl
}

************************************* VarDeclStmt: *************************************

func NewVarDeclStmt

func NewVarDeclStmt(name string, t ctypes.Type) *VarDeclStmt

func (*VarDeclStmt) CIRString

func (s *VarDeclStmt) CIRString() string

Directories

Path Synopsis
ctypes包定义C-IR的类型
ctypes包定义C-IR的类型

Jump to

Keyboard shortcuts

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