Move coroutine passes from Makefile to compiler itself

This is much more convenient.
Этот коммит содержится в:
Ayke van Laethem 2018-08-20 04:31:01 +02:00
родитель 03c8a8bd3a
коммит d9ca5f97fb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED
3 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -90,13 +90,13 @@ build/tgo: *.go
go build -o build/tgo -i . go build -o build/tgo -i .
# Build IR with the Go compiler. # Build IR with the Go compiler.
build/%.bc: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc build/%.o: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc
./build/tgo $(TGOFLAGS) -printir -runtime build/runtime-$(TARGET)-combined.bc -o $@ $(subst src/,,$<) ./build/tgo $(TGOFLAGS) -runtime build/runtime-$(TARGET)-combined.bc -o $@ $(subst src/,,$<)
# Compile and optimize bitcode file. # Compile and optimize bitcode file.
build/%.o: build/%.bc #build/%.o: build/%.bc
$(OPT) -coro-early -coro-split -coro-elide -Os -coro-cleanup -o $< $< # $(OPT) -coro-early -coro-split -coro-elide -Os -coro-cleanup -o $< $<
$(LLC) -filetype=obj -o $@ $< # $(LLC) -filetype=obj -o $@ $<
# Compile C sources for the runtime. # Compile C sources for the runtime.
build/%.bc: src/runtime/%.c src/runtime/*.h build/%.bc: src/runtime/%.c src/runtime/*.h

Просмотреть файл

@ -1746,8 +1746,12 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int) {
builder.PopulateFunc(funcPasses) builder.PopulateFunc(funcPasses)
modPasses := llvm.NewPassManager() modPasses := llvm.NewPassManager()
modPasses.AddCoroEarlyPass()
modPasses.AddCoroSplitPass()
modPasses.AddCoroElidePass()
defer modPasses.Dispose() defer modPasses.Dispose()
builder.Populate(modPasses) builder.Populate(modPasses)
modPasses.AddCoroCleanupPass()
modPasses.Run(c.mod) modPasses.Run(c.mod)
} }

Просмотреть файл

@ -55,7 +55,7 @@ func Compile(pkgName, runtimePath, outpath, target string, printIR, dumpSSA bool
if err := c.Verify(); err != nil { if err := c.Verify(); err != nil {
return err return err
} }
//c.Optimize(2, 1) // -O2 -Os c.Optimize(2, 1) // -O2 -Os
if err := c.Verify(); err != nil { if err := c.Verify(); err != nil {
return err return err
} }