basic structure

This commit is contained in:
xushiwei
2024-04-15 00:48:04 +08:00
parent a1211a98e3
commit 55b310d266
13 changed files with 249 additions and 74 deletions

View File

@@ -16,6 +16,7 @@
package cl
/*
import (
llvm "tinygo.org/x/go-llvm"
)
@@ -42,3 +43,4 @@ var stdlibAliases = map[string]string{
func (b *builder) createAlias(alias llvm.Value) {
panic("todo")
}
*/

View File

@@ -16,6 +16,7 @@
package cl
/*
import (
"golang.org/x/tools/go/ssa"
llvm "tinygo.org/x/go-llvm"
@@ -35,3 +36,4 @@ func newBuilder(c *context, irbuilder llvm.Builder, f *ssa.Function) *builder {
func (b *builder) createFunction() {
panic("todo")
}
*/

View File

@@ -16,6 +16,7 @@
package cl
/*
import (
"go/types"
"os"
@@ -213,8 +214,8 @@ func NewPackage(moduleName string, pkg loader.Package, conf *Config) (ret Packag
// Predeclare trackPointer, which is used everywhere we use runtime.alloc.
c.getFunction(c.program.ImportedPackage("runtime").Members["trackPointer"].(*ssa.Function))
}
*/
*/
/*
// Compile all functions, methods, and global variables in this package.
irbuilder := c.ctx.NewBuilder()
defer irbuilder.Dispose()
@@ -232,7 +233,8 @@ func NewPackage(moduleName string, pkg loader.Package, conf *Config) (ret Packag
}),
)
}
*/
*/
/*
ret.Module = c.mod
err = c.errs.ToError()
return
@@ -271,3 +273,4 @@ func (p Package) WriteTo(f *os.File) (err error) {
}
return
}
*/

View File

@@ -16,6 +16,7 @@
package cl
/*
// Define unimplemented intrinsic functions.
//
// Some functions are either normally implemented in Go assembly (like
@@ -58,3 +59,4 @@ func (b *builder) defineMathOp() {
func (b *builder) defineMathBitsIntrinsic() bool {
panic("todo")
}
*/

View File

@@ -16,6 +16,7 @@
package cl
/*
import (
"go/types"
@@ -40,7 +41,8 @@ type functionInfo struct {
nobounds bool // go:nobounds
variadic bool // go:variadic (CGo only)
inline inlineType // go:inline
*/
*/
/*
linkName string // go:linkname, go:export - the IR function name
}
@@ -64,7 +66,7 @@ const (
inlineNone
)
*/
/*
// getFunctionInfo returns information about a function that is not directly
// present in *ssa.Function, such as the link name and whether it should be
// exported.
@@ -79,7 +81,8 @@ type globalInfo struct {
/*
linkName string // go:extern
align int // go:align
*/
*/
/*
section string // go:section
extern bool // go:extern
}
@@ -103,3 +106,4 @@ func (c *context) getGlobalInfo(g *ssa.Global) globalInfo {
func getAllMethods(prog *ssa.Program, typ types.Type) []*types.Selection {
panic("todo")
}
*/