types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bool = &BoolType{}
View Source
var EmptyStringConstant *ir.Global
View Source
var I16 = &Int{Type: types.I16, TypeName: "int16", TypeSize: 18 / 8, Signed: true}
View Source
var I32 = &Int{Type: types.I32, TypeName: "int32", TypeSize: 32 / 8, Signed: true}
View Source
var I64 = &Int{Type: types.I64, TypeName: "int64", TypeSize: 64 / 8, Signed: true}
View Source
var I8 = &Int{Type: types.I8, TypeName: "int8", TypeSize: 8 / 8, Signed: true}
View Source
var ModuleStringType types.Type

Populated by compiler.go

View Source
var String = &StringType{}
View Source
var U128 = &Int{Type: types.I128, TypeName: "uint128", TypeSize: 128 / 8}
View Source
var U16 = &Int{Type: types.I16, TypeName: "uint16", TypeSize: 18 / 8}
View Source
var U256 = &Int{Type: types.I256, TypeName: "uint256", TypeSize: 256 / 8}
View Source
var U32 = &Int{Type: types.I32, TypeName: "uint32", TypeSize: 32 / 8}
View Source
var U64 = &Int{Type: types.I64, TypeName: "uint64", TypeSize: 64 / 8}
View Source
var U8 = &Int{Type: types.I8, TypeName: "uint8", TypeSize: 8 / 8}
View Source
var Uintptr = &Int{Type: types.I64, TypeName: "uintptr", TypeSize: 64 / 8}
View Source
var Void = &VoidType{}

Functions

This section is empty.

Types

type Array

type Array struct {
	Type     Type
	Len      uint64
	LlvmType types.Type
	// contains filtered or unexported fields
}

func (*Array) AddMethod

func (b *Array) AddMethod(name string, method *Method)

func (*Array) GetMethod

func (b *Array) GetMethod(name string) (*Method, bool)

func (Array) IsSigned

func (Array) IsSigned() bool

func (Array) LLVM

func (a Array) LLVM() types.Type

func (Array) Name

func (a Array) Name() string

func (Array) Size

func (Array) Size() int64

func (Array) Zero

func (a Array) Zero(block *ir.Block, alloca llvmValue.Value)

type BoolType

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

func (*BoolType) AddMethod

func (b *BoolType) AddMethod(name string, method *Method)

func (*BoolType) GetMethod

func (b *BoolType) GetMethod(name string) (*Method, bool)

func (BoolType) IsSigned

func (BoolType) IsSigned() bool

func (BoolType) LLVM

func (BoolType) LLVM() types.Type

func (BoolType) Name

func (BoolType) Name() string

func (BoolType) Size

func (BoolType) Size() int64

func (BoolType) Zero

func (b BoolType) Zero(block *ir.Block, alloca llvmValue.Value)

type Function

type Function struct {

	// LlvmFunction llvmValue.Named
	FuncType types.Type

	// The return type of the LLVM function (is always 1)
	LlvmReturnType Type
	// Return types of the Tre function
	ReturnTypes []Type

	IsVariadic    bool
	ArgumentTypes []Type
	IsExternal    bool

	// Is used when calling an interface method
	JumpFunction *ir.Func
	// contains filtered or unexported fields
}

func (*Function) AddMethod

func (b *Function) AddMethod(name string, method *Method)

func (*Function) GetMethod

func (b *Function) GetMethod(name string) (*Method, bool)

func (Function) IsSigned

func (Function) IsSigned() bool

func (Function) LLVM

func (f Function) LLVM() types.Type

func (Function) Name

func (f Function) Name() string

func (Function) Size

func (Function) Size() int64

func (Function) Zero

func (Function) Zero(*ir.Block, llvmValue.Value)

type Int

type Int struct {
	Type     *types.IntType
	TypeName string
	TypeSize int64
	Signed   bool
	// contains filtered or unexported fields
}

func (*Int) AddMethod

func (b *Int) AddMethod(name string, method *Method)

func (*Int) GetMethod

func (b *Int) GetMethod(name string) (*Method, bool)

func (Int) IsSigned

func (i Int) IsSigned() bool

func (Int) LLVM

func (i Int) LLVM() types.Type

func (Int) Name

func (i Int) Name() string

func (Int) Size

func (i Int) Size() int64

func (Int) Zero

func (i Int) Zero(block *ir.Block, alloca llvmValue.Value)

type Interface

type Interface struct {
	SourceName      string
	RequiredMethods map[string]InterfaceMethod
	// contains filtered or unexported fields
}

func (*Interface) AddMethod

func (b *Interface) AddMethod(name string, method *Method)

func (*Interface) GetMethod

func (b *Interface) GetMethod(name string) (*Method, bool)

func (Interface) IsSigned

func (Interface) IsSigned() bool

func (Interface) JumpTable

func (i Interface) JumpTable() *types.StructType

func (Interface) LLVM

func (i Interface) LLVM() types.Type

func (Interface) Name

func (i Interface) Name() string

func (Interface) Size

func (Interface) Size() int64

func (Interface) SortedRequiredMethods

func (i Interface) SortedRequiredMethods() []string

SortedRequiredMethods returns a sorted slice of all method names The returned order is the order the methods will be layed out in the JumpTable

func (Interface) Zero

func (Interface) Zero(*ir.Block, llvmValue.Value)

type InterfaceMethod

type InterfaceMethod struct {
	LlvmJumpFunction llvmValue.Named

	ArgumentTypes []Type
	ReturnTypes   []Type
	// contains filtered or unexported fields
}

func (*InterfaceMethod) AddMethod

func (b *InterfaceMethod) AddMethod(name string, method *Method)

func (*InterfaceMethod) GetMethod

func (b *InterfaceMethod) GetMethod(name string) (*Method, bool)

func (InterfaceMethod) IsSigned

func (InterfaceMethod) IsSigned() bool

func (InterfaceMethod) LLVM

func (InterfaceMethod) LLVM() types.Type

func (InterfaceMethod) Name

func (InterfaceMethod) Name() string

func (InterfaceMethod) Size

func (InterfaceMethod) Size() int64

func (InterfaceMethod) Zero

func (InterfaceMethod) Zero(*ir.Block, llvmValue.Value)

type Method

type Method struct {
	Function        *Function
	LlvmFunction    llvmValue.Named
	PointerReceiver bool
	MethodName      string
	// contains filtered or unexported fields
}

func (*Method) AddMethod

func (b *Method) AddMethod(name string, method *Method)

func (*Method) GetMethod

func (b *Method) GetMethod(name string) (*Method, bool)

func (Method) IsSigned

func (Method) IsSigned() bool

func (Method) LLVM

func (m Method) LLVM() types.Type

func (Method) Name

func (m Method) Name() string

func (Method) Size

func (Method) Size() int64

func (Method) Zero

func (Method) Zero(*ir.Block, llvmValue.Value)

type MultiValue

type MultiValue struct {
	Types []Type
	// contains filtered or unexported fields
}

MultiValue is used when returning multiple values from a function

func (*MultiValue) AddMethod

func (b *MultiValue) AddMethod(name string, method *Method)

func (*MultiValue) GetMethod

func (b *MultiValue) GetMethod(name string) (*Method, bool)

func (MultiValue) IsSigned

func (MultiValue) IsSigned() bool

func (MultiValue) LLVM

func (m MultiValue) LLVM() types.Type

func (MultiValue) Name

func (m MultiValue) Name() string

func (MultiValue) Size

func (MultiValue) Size() int64

func (MultiValue) Zero

func (MultiValue) Zero(*ir.Block, llvmValue.Value)

type PackageInstance

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

func (*PackageInstance) AddMethod

func (b *PackageInstance) AddMethod(name string, method *Method)

func (*PackageInstance) GetFunc

func (p *PackageInstance) GetFunc(name string) (*Function, bool)

func (*PackageInstance) GetMethod

func (b *PackageInstance) GetMethod(name string) (*Method, bool)

func (PackageInstance) IsSigned

func (PackageInstance) IsSigned() bool

func (PackageInstance) LLVM

func (PackageInstance) LLVM() types.Type

func (PackageInstance) Name

func (p PackageInstance) Name() string

func (*PackageInstance) SetFunc

func (p *PackageInstance) SetFunc(name string, val *Function)

func (*PackageInstance) SetName

func (p *PackageInstance) SetName(name string)

func (PackageInstance) Size

func (PackageInstance) Size() int64

func (PackageInstance) Zero

func (PackageInstance) Zero(*ir.Block, llvmValue.Value)

type Pointer

type Pointer struct {
	Type                  Type
	IsNonAllocDereference bool

	LlvmType types.Type
	// contains filtered or unexported fields
}

func (*Pointer) AddMethod

func (b *Pointer) AddMethod(name string, method *Method)

func (*Pointer) GetMethod

func (b *Pointer) GetMethod(name string) (*Method, bool)

func (Pointer) IsSigned

func (Pointer) IsSigned() bool

func (Pointer) LLVM

func (p Pointer) LLVM() types.Type

func (Pointer) Name

func (p Pointer) Name() string

func (Pointer) Size

func (p Pointer) Size() int64

func (Pointer) Zero

func (Pointer) Zero(*ir.Block, llvmValue.Value)

type Slice

type Slice struct {
	Type     Type // type of the items in the slice []int => int
	LlvmType types.Type
	// contains filtered or unexported fields
}

func (*Slice) AddMethod

func (b *Slice) AddMethod(name string, method *Method)

func (*Slice) GetMethod

func (b *Slice) GetMethod(name string) (*Method, bool)

func (Slice) IsSigned

func (Slice) IsSigned() bool

func (Slice) LLVM

func (s Slice) LLVM() types.Type

func (Slice) Name

func (Slice) Name() string

func (Slice) Size

func (Slice) Size() int64

func (Slice) SliceZero

func (s Slice) SliceZero(block *ir.Block, mallocFunc llvmValue.Named, initCap int, emptySlice llvmValue.Value)

func (Slice) Zero

func (Slice) Zero(*ir.Block, llvmValue.Value)

type StringType

type StringType struct {
	Type types.Type
	// contains filtered or unexported fields
}

func (*StringType) AddMethod

func (b *StringType) AddMethod(name string, method *Method)

func (*StringType) GetMethod

func (b *StringType) GetMethod(name string) (*Method, bool)

func (StringType) IsSigned

func (StringType) IsSigned() bool

func (StringType) LLVM

func (StringType) LLVM() types.Type

func (StringType) Name

func (StringType) Name() string

func (StringType) Size

func (StringType) Size() int64

func (StringType) Zero

func (s StringType) Zero(block *ir.Block, alloca llvmValue.Value)

type Struct

type Struct struct {
	Members       map[string]Type
	MemberIndexes map[string]int

	IsHeapAllocated bool

	SourceName string
	Type       types.Type
	// contains filtered or unexported fields
}

func (*Struct) AddMethod

func (b *Struct) AddMethod(name string, method *Method)

func (*Struct) GetMethod

func (b *Struct) GetMethod(name string) (*Method, bool)

func (Struct) IsSigned

func (Struct) IsSigned() bool

func (Struct) LLVM

func (s Struct) LLVM() types.Type

func (Struct) Name

func (s Struct) Name() string

func (Struct) Size

func (s Struct) Size() int64

func (Struct) Zero

func (s Struct) Zero(block *ir.Block, alloca llvmValue.Value)

type Type

type Type interface {
	LLVM() types.Type
	Name() string

	// Size of type in bytes
	Size() int64

	AddMethod(string, *Method)
	GetMethod(string) (*Method, bool)

	Zero(*ir.Block, llvmValue.Value)

	IsSigned() bool
}

type UntypedConstantNumber

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

func (*UntypedConstantNumber) AddMethod

func (b *UntypedConstantNumber) AddMethod(name string, method *Method)

func (*UntypedConstantNumber) GetMethod

func (b *UntypedConstantNumber) GetMethod(name string) (*Method, bool)

func (UntypedConstantNumber) IsSigned

func (UntypedConstantNumber) IsSigned() bool

func (UntypedConstantNumber) LLVM

func (m UntypedConstantNumber) LLVM() types.Type

func (UntypedConstantNumber) Name

func (m UntypedConstantNumber) Name() string

func (UntypedConstantNumber) Size

func (UntypedConstantNumber) Size() int64

func (UntypedConstantNumber) Zero

func (UntypedConstantNumber) Zero(*ir.Block, llvmValue.Value)

type VoidType

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

func (*VoidType) AddMethod

func (b *VoidType) AddMethod(name string, method *Method)

func (*VoidType) GetMethod

func (b *VoidType) GetMethod(name string) (*Method, bool)

func (VoidType) IsSigned

func (VoidType) IsSigned() bool

func (VoidType) LLVM

func (VoidType) LLVM() types.Type

func (VoidType) Name

func (VoidType) Name() string

func (VoidType) Size

func (VoidType) Size() int64

func (VoidType) Zero

func (VoidType) Zero(*ir.Block, llvmValue.Value)

Jump to

Keyboard shortcuts

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