interp: avoid an extra TargetData argument
This can be easily calculated from the module datalayout string.
Этот коммит содержится в:
родитель
17ef7a5c32
коммит
da7f7eef00
3 изменённых файлов: 3 добавлений и 8 удалений
|
@ -187,11 +187,6 @@ func (c *Compiler) Module() llvm.Module {
|
||||||
return c.mod
|
return c.mod
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the LLVM target data object. Only valid after a successful compile.
|
|
||||||
func (c *Compiler) TargetData() llvm.TargetData {
|
|
||||||
return c.targetData
|
|
||||||
}
|
|
||||||
|
|
||||||
// selectGC picks an appropriate GC strategy if none was provided.
|
// selectGC picks an appropriate GC strategy if none was provided.
|
||||||
func (c *Compiler) selectGC() string {
|
func (c *Compiler) selectGC() string {
|
||||||
if c.GC != "" {
|
if c.GC != "" {
|
||||||
|
|
|
@ -24,7 +24,7 @@ type Eval struct {
|
||||||
|
|
||||||
// Run evaluates the function with the given name and then eliminates all
|
// Run evaluates the function with the given name and then eliminates all
|
||||||
// callers.
|
// callers.
|
||||||
func Run(mod llvm.Module, targetData llvm.TargetData, debug bool) error {
|
func Run(mod llvm.Module, debug bool) error {
|
||||||
if debug {
|
if debug {
|
||||||
println("\ncompile-time evaluation:")
|
println("\ncompile-time evaluation:")
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ func Run(mod llvm.Module, targetData llvm.TargetData, debug bool) error {
|
||||||
name := "runtime.initAll"
|
name := "runtime.initAll"
|
||||||
e := &Eval{
|
e := &Eval{
|
||||||
Mod: mod,
|
Mod: mod,
|
||||||
TargetData: targetData,
|
TargetData: llvm.NewTargetData(mod.DataLayout()),
|
||||||
Debug: debug,
|
Debug: debug,
|
||||||
dirtyGlobals: map[llvm.Value]struct{}{},
|
dirtyGlobals: map[llvm.Value]struct{}{},
|
||||||
}
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -145,7 +145,7 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
|
||||||
return errors.New("verification error after IR construction")
|
return errors.New("verification error after IR construction")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = interp.Run(c.Module(), c.TargetData(), config.dumpSSA)
|
err = interp.Run(c.Module(), config.dumpSSA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче