llvmbackend

package
v0.0.0-...-6155d41 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "bool",
	},
	Type: types.I1,
}
View Source
var CallingConventions map[string]map[string]enum.CallingConv = map[string]map[string]enum.CallingConv{
	"arm64": {
		"darwin":  enum.CallingConvC,
		"linux":   enum.CallingConvC,
		"windows": enum.CallingConvC,
	},
	"amd64": {
		"darwin":  enum.CallingConvC,
		"linux":   enum.CallingConvC,
		"windows": enum.CallingConvWin64,
	},
}
View Source
var CurrentBackend interfaces.BackendInteface = nil
View Source
var FuncCalls map[string]*ir.InstCall
View Source
var Int16Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "int16",
	},
	Type: types.I16,
}
View Source
var Int32Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "int32",
	},
	Type: types.I32,
}
View Source
var Int64Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "int64",
	},
	Type: types.I64,
}
View Source
var Int8Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "int8",
	},
	Type: types.I8,
}
View Source
var IntType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "int",
	},
	Type: types.I64,
}
View Source
var LLVMProgramValues = &LLVMValuesMap{}
View Source
var LLVMScopeDataMap = &LLVMScopeData{}
View Source
var Methods map[string]*ast.Method
View Source
var RawStringType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "string",
	},
	Type: types.NewPointer(types.I8),
}
View Source
var Uint16Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "uint16",
	},
	Type: types.I16,
}
View Source
var Uint32Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "uint32",
	},
	Type: types.I32,
}
View Source
var Uint64Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "uint64",
	},
	Type: types.I64,
}
View Source
var Uint8Type = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "uint8",
	},
	Type: types.I8,
}
View Source
var UintType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "uint",
	},
	Type: types.I64,
}
View Source
var UnknownType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "unknown",
	},
	Type: types.Void,
}
View Source
var VoidType = &PrimitiveType{
	Class: &ast.Ast{
		Scope: "void",
	},
	Type: types.Void,
}

Functions

This section is empty.

Types

type AssignmentStep

type AssignmentStep struct {
	Source      *value.Value
	Destination *value.Value
}

type CallStep

type CallStep struct {
	Func   *ir.Func
	Params []*value.Value
}

type ConditionStep

type ConditionStep struct {
	Expression  *value.Value
	BranchTrue  *ir.Block
	BranchFalse *ir.Block
}

type DeclarationStep

type DeclarationStep struct {
	Name  string
	Value *value.Value
}

type ExecutionContext

type ExecutionContext struct {
	Context *ModuleContext
	Steps   []*Step
}
var LLVMExecutionContext *ExecutionContext = nil

func NewExecutionContext

func NewExecutionContext() *ExecutionContext

func (*ExecutionContext) FindLLIRMethod

func (e *ExecutionContext) FindLLIRMethod(name string) *option.Optional[*ir.Func]

func (*ExecutionContext) Init

func (e *ExecutionContext) Init()

type LLVMBackendImplementation

type LLVMBackendImplementation struct {
	Backend interfaces.BackendInteface
}

func (*LLVMBackendImplementation) AdditionToLLIRValue

func (impl *LLVMBackendImplementation) AdditionToLLIRValue(a *tokens.Addition, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) ComparisonToLLIRValue

func (impl *LLVMBackendImplementation) ComparisonToLLIRValue(c *tokens.Comparison, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) Declaration

func (*LLVMBackendImplementation) Declaration(scope *ast.Ast, decl *tokens.Declaration)

func (*LLVMBackendImplementation) EqualityToLLIRValue

func (impl *LLVMBackendImplementation) EqualityToLLIRValue(eq *tokens.Equality, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) ExpressionToLLIRValue

func (impl *LLVMBackendImplementation) ExpressionToLLIRValue(e *tokens.Expression, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) FuncCall

func (impls *LLVMBackendImplementation) FuncCall(scope *ast.Ast, f *tokens.FuncCall)

func (*LLVMBackendImplementation) LLVMAssignArgumentsToMethodArguments

func (impl *LLVMBackendImplementation) LLVMAssignArgumentsToMethodArguments(args []*tokens.Value, mth *ast.Method)

func (*LLVMBackendImplementation) LLVMGetAstMethod

func (impl *LLVMBackendImplementation) LLVMGetAstMethod(scope *ast.Ast, m *tokens.Method) *ast.Method

func (*LLVMBackendImplementation) LLVMImplementationForArch

func (impl *LLVMBackendImplementation) LLVMImplementationForArch(scope *ast.Ast, i *tokens.Implementation)

func (*LLVMBackendImplementation) LLVMImplementationForClass

func (impl *LLVMBackendImplementation) LLVMImplementationForClass(scope *ast.Ast, i *tokens.Implementation)

func (*LLVMBackendImplementation) LLVMImplementationToMethodTokens

func (impl *LLVMBackendImplementation) LLVMImplementationToMethodTokens(scope *ast.Ast, i *tokens.Implementation) []*tokens.Method

func (*LLVMBackendImplementation) LLVMResolveFuncContext

func (impl *LLVMBackendImplementation) LLVMResolveFuncContext(a *ast.Ast, funcName string) *option.Optional[*LocalContext]

func (*LLVMBackendImplementation) LLVMResolveLLIRType

func (impl *LLVMBackendImplementation) LLVMResolveLLIRType(a *ast.Ast, typ string) *option.Optional[*types.Type]

func (*LLVMBackendImplementation) LLVMTraitGetMethods

func (impl *LLVMBackendImplementation) LLVMTraitGetMethods(t *tokens.Trait) []*tokens.Method

func (*LLVMBackendImplementation) MultiplicationToLLIRValue

func (impl *LLVMBackendImplementation) MultiplicationToLLIRValue(m *tokens.Multiplication, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) NewClass

func (impls *LLVMBackendImplementation) NewClass(scope *ast.Ast, c *tokens.Class)

func (*LLVMBackendImplementation) NewDeclaration

func (impls *LLVMBackendImplementation) NewDeclaration(scope *ast.Ast, decl *tokens.Declaration)

func (*LLVMBackendImplementation) NewImplementation

func (impl *LLVMBackendImplementation) NewImplementation(scope *ast.Ast, i *tokens.Implementation)

func (*LLVMBackendImplementation) NewMethod

func (impl *LLVMBackendImplementation) NewMethod(scope *ast.Ast, m *tokens.Method)

func (*LLVMBackendImplementation) NewReturn

func (impl *LLVMBackendImplementation) NewReturn(scope *ast.Ast)

func (*LLVMBackendImplementation) NewReturnLiteral

func (impl *LLVMBackendImplementation) NewReturnLiteral(scope *ast.Ast, literal *tokens.Expression)

func (*LLVMBackendImplementation) NewTrait

func (impl *LLVMBackendImplementation) NewTrait(scope *ast.Ast, t *tokens.Trait)

func (*LLVMBackendImplementation) NewVariable

func (impl *LLVMBackendImplementation) NewVariable(scope *ast.Ast, f *tokens.Field)

func (*LLVMBackendImplementation) ParseExpression

func (*LLVMBackendImplementation) ParseExpression(scope *ast.Ast, exp *tokens.Expression)

func (*LLVMBackendImplementation) PrimaryToLLIRValue

func (impl *LLVMBackendImplementation) PrimaryToLLIRValue(p *tokens.Primary, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

func (*LLVMBackendImplementation) ProcessEntries

func (impls *LLVMBackendImplementation) ProcessEntries(scope *ast.Ast, entries []*tokens.Entry)

func (*LLVMBackendImplementation) TraitAssignToScope

func (impl *LLVMBackendImplementation) TraitAssignToScope(scope *ast.Ast, t *tokens.Trait)

func (*LLVMBackendImplementation) TypeRefGetLLIRType

func (impl *LLVMBackendImplementation) TypeRefGetLLIRType(t *tokens.TypeRef, scope *ast.Ast) types.Type

func (*LLVMBackendImplementation) UnaryToLLIRValue

func (impl *LLVMBackendImplementation) UnaryToLLIRValue(u *tokens.Unary, scope *ast.Ast, expressionType *tokens.TypeRef) value.Value

type LLVMScopeData

type LLVMScopeData map[string]*LLVMScopeInformation

type LLVMScopeInformation

type LLVMScopeInformation struct {
	ExecutionContext *ExecutionContext
	ProgramContext   *ModuleContext
	LocalContext     *LocalContext
	ChildContexts    map[string]*LocalContext
}

func LLVMGetScopeInformation

func LLVMGetScopeInformation(scope *ast.Ast) *LLVMScopeInformation

func (*LLVMScopeInformation) Init

func (info *LLVMScopeInformation) Init(a *ast.Ast)

type LLVMValueInformation

type LLVMValueInformation struct {
	Type      types.Type
	Value     value.Value
	GeckoType *tokens.TypeRef
}

func LLVMGetValueInformation

func LLVMGetValueInformation(variable *ast.Variable) *LLVMValueInformation

type LLVMValuesMap

type LLVMValuesMap map[string]*LLVMValueInformation

type LocalContext

type LocalContext struct {
	ModuleContext *ModuleContext
	Func          *ir.Func
	MainBlock     *ir.Block
	Branches      map[string]*ir.Block
	Types         map[string]*types.Type
}

func NewLocalContext

func NewLocalContext(fn *ir.Func) *LocalContext

func (*LocalContext) Init

func (l *LocalContext) Init(fn *ir.Func)

type ModuleContext

type ModuleContext struct {
	Module            *ir.Module
	GlobalDefinitions map[string]*ir.Global
	Methods           map[string]*ir.Func
}

func (*ModuleContext) Init

func (m *ModuleContext) Init()

type PrimitiveType

type PrimitiveType struct {
	Class *ast.Ast
	Type  types.Type
}

type Step

type Step struct {
	Call        *CallStep
	Condition   *ConditionStep
	Assignment  *AssignmentStep
	Declaration *DeclarationStep
}

type ValueAsContant

type ValueAsContant struct {
	value.Value
}

func (ValueAsContant) IsConstant

func (v ValueAsContant) IsConstant()

Jump to

Keyboard shortcuts

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