From a30ffa5c1eac88b16f8c916b59a94c5766f51c79 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 20 Aug 2018 20:17:51 +0200 Subject: [PATCH] Revert "Move coroutine passes from Makefile to compiler itself" This reverts commit d9ca5f97fb014ae8805fa8efa235d277539b8a30. There is a problem with coroutines that I haven't solved yet. Reverting makes it work, for now. Also, use a better coroutines flag for the LLVM opt tool. --- Makefile | 8 ++++---- compiler.go | 4 ---- main.go | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b5e8992de..2805d72c9 100644 --- a/Makefile +++ b/Makefile @@ -90,13 +90,13 @@ build/tgo: *.go go build -o build/tgo -i . # Build IR with the Go compiler. -build/%.o: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc +build/%.bc: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc ./build/tgo $(TGOFLAGS) -runtime build/runtime-$(TARGET)-combined.bc -o $@ $(subst src/,,$<) # Compile and optimize bitcode file. -#build/%.o: build/%.bc -# $(OPT) -coro-early -coro-split -coro-elide -Os -coro-cleanup -o $< $< -# $(LLC) -filetype=obj -o $@ $< +build/%.o: build/%.bc + $(OPT) -Os -enable-coroutines -o $< $< + $(LLC) -filetype=obj -o $@ $< # Compile C sources for the runtime. build/%.bc: src/runtime/%.c src/runtime/*.h diff --git a/compiler.go b/compiler.go index dbb9b3c96..297fb4549 100644 --- a/compiler.go +++ b/compiler.go @@ -1746,12 +1746,8 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int) { builder.PopulateFunc(funcPasses) modPasses := llvm.NewPassManager() - modPasses.AddCoroEarlyPass() - modPasses.AddCoroSplitPass() - modPasses.AddCoroElidePass() defer modPasses.Dispose() builder.Populate(modPasses) - modPasses.AddCoroCleanupPass() modPasses.Run(c.mod) } diff --git a/main.go b/main.go index 8d44f6a30..0e0ad3989 100644 --- a/main.go +++ b/main.go @@ -55,7 +55,7 @@ func Compile(pkgName, runtimePath, outpath, target string, printIR, dumpSSA bool if err := c.Verify(); err != nil { return err } - c.Optimize(2, 1) // -O2 -Os + //c.Optimize(2, 1) // -O2 -Os if err := c.Verify(); err != nil { return err }