Browse Source

Revert "Move coroutine passes from Makefile to compiler itself"

This reverts commit d9ca5f97fb.

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.
pull/6/head
Ayke van Laethem 6 years ago
parent
commit
a30ffa5c1e
No known key found for this signature in database GPG Key ID: E97FF5335DFDFDED
  1. 8
      Makefile
  2. 4
      compiler.go
  3. 2
      main.go

8
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

4
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)
}

2
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
}

Loading…
Cancel
Save