aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler
diff options
context:
space:
mode:
authorJaden Weiss <[email protected]>2020-04-01 17:51:30 -0400
committerAyke <[email protected]>2020-04-02 15:06:58 +0200
commitccf8b378b35a478a315ccacd7dbbeaea6658cead (patch)
tree6f2b0755f9ffa26c2c311a71f07c852a0688e3c5 /compiler
parentae16b2c922f429ccd3986d8227e14724ed6346d8 (diff)
downloadtinygo-ccf8b378b35a478a315ccacd7dbbeaea6658cead.tar.gz
tinygo-ccf8b378b35a478a315ccacd7dbbeaea6658cead.zip
compiler: track PHI nodes
Diffstat (limited to 'compiler')
-rw-r--r--compiler/compiler.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/compiler.go b/compiler/compiler.go
index 33b5ab4fd..eaf73e221 100644
--- a/compiler/compiler.go
+++ b/compiler/compiler.go
@@ -1025,6 +1025,18 @@ func (b *builder) createFunctionDefinition() {
phi.llvm.AddIncoming([]llvm.Value{llvmVal}, []llvm.BasicBlock{llvmBlock})
}
}
+
+ if b.NeedsStackObjects() {
+ // Track phi nodes.
+ for _, phi := range b.phis {
+ insertPoint := llvm.NextInstruction(phi.llvm)
+ for !insertPoint.IsAPHINode().IsNil() {
+ insertPoint = llvm.NextInstruction(insertPoint)
+ }
+ b.SetInsertPointBefore(insertPoint)
+ b.trackValue(phi.llvm)
+ }
+ }
}
// createInstruction builds the LLVM IR equivalent instructions for the