Move runtime.TargetBits out of the compiler
Этот коммит содержится в:
родитель
9fca0e99b5
коммит
42cddd3260
4 изменённых файлов: 10 добавлений и 21 удалений
14
compiler.go
14
compiler.go
|
@ -254,19 +254,6 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
|||
g.llvmGlobal = global
|
||||
if !strings.HasPrefix(g.LinkName(), "_extern_") {
|
||||
global.SetLinkage(llvm.InternalLinkage)
|
||||
if g.LinkName() == "runtime.TargetBits" {
|
||||
bitness := c.targetData.PointerSize() * 8
|
||||
if bitness < 32 {
|
||||
// Only 8 and 32+ architectures supported at the moment.
|
||||
// On 8 bit architectures, pointers are normally bigger
|
||||
// than 8 bits to do anything meaningful.
|
||||
// TODO: clean up this hack to support 16-bit
|
||||
// architectures.
|
||||
bitness = 8
|
||||
}
|
||||
global.SetInitializer(llvm.ConstInt(llvm.Int8Type(), uint64(bitness), false))
|
||||
global.SetGlobalConstant(true)
|
||||
} else {
|
||||
initializer, err := getZeroValue(llvmType)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -274,7 +261,6 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
|||
global.SetInitializer(initializer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Declare all functions.
|
||||
for _, f := range c.ir.Functions {
|
||||
|
|
|
@ -6,3 +6,6 @@ const GOARCH = "amd64"
|
|||
|
||||
// The length type used inside strings and slices.
|
||||
type lenType uint32
|
||||
|
||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||
const TargetBits = 64
|
||||
|
|
|
@ -6,3 +6,6 @@ const GOARCH = "wasm"
|
|||
|
||||
// The length type used inside strings and slices.
|
||||
type lenType uint32
|
||||
|
||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||
const TargetBits = 32
|
||||
|
|
|
@ -6,9 +6,6 @@ import (
|
|||
|
||||
const Compiler = "tgo"
|
||||
|
||||
// The bitness of the CPU (e.g. 8, 32, 64). Set by the compiler as a constant.
|
||||
var TargetBits uint8
|
||||
|
||||
func Sleep(d Duration) {
|
||||
// This function is treated specially by the compiler: when goroutines are
|
||||
// used, it is transformed into a llvm.coro.suspend() call.
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче