diff --git a/Makefile b/Makefile index ced7634bb..b5e8992de 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/%.bc: 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/%.o: 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) -coro-early -coro-split -coro-elide -Os -coro-cleanup -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 297fb4549..dbb9b3c96 100644 --- a/compiler.go +++ b/compiler.go @@ -1746,8 +1746,12 @@ 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 0e0ad3989..8d44f6a30 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 }