mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
Move coroutine passes from Makefile to compiler itself
This is much more convenient.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user