about summary refs log tree commit diff
path: root/src/comp/lib
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-10-04 15:55:12 -0700
committerGraydon Hoare <graydon@mozilla.com>2010-10-04 15:55:12 -0700
commit44e4b2d63aef1e6cb572acfa327ea2c3a36083e8 (patch)
treed48f06f491e20d4f176c7e1435ba953ec549d72c /src/comp/lib
parenta87e81b9292d49f1aa09cdcd928113305ad73a53 (diff)
downloadrust-44e4b2d63aef1e6cb572acfa327ea2c3a36083e8.tar.gz
rust-44e4b2d63aef1e6cb572acfa327ea2c3a36083e8.zip
Teach rustc about phi nodes, block relationships. Translate if- and block-expressions.
Diffstat (limited to 'src/comp/lib')
-rw-r--r--src/comp/lib/llvm.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs
index f0cb65a2082..220af154e0e 100644
--- a/src/comp/lib/llvm.rs
+++ b/src/comp/lib/llvm.rs
@@ -1006,8 +1006,14 @@ obj builder(BuilderRef B) {
 
 
     /* Miscellaneous instructions */
-    fn Phi(TypeRef Ty) -> ValueRef {
-        ret llvm.LLVMBuildPhi(B, Ty, _str.buf(""));
+    fn Phi(TypeRef Ty, vec[ValueRef] vals, vec[BasicBlockRef] bbs) -> ValueRef {
+        auto phi = llvm.LLVMBuildPhi(B, Ty, _str.buf(""));
+        check (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
+        llvm.LLVMAddIncoming(phi,
+                             _vec.buf[ValueRef](vals),
+                             _vec.buf[BasicBlockRef](bbs),
+                             _vec.len[ValueRef](vals));
+        ret phi;
     }
 
     fn Call(ValueRef Fn, vec[ValueRef] Args) -> ValueRef {