diff options
| author | Graydon Hoare <[email protected]> | 2010-10-04 15:55:12 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-10-04 15:55:12 -0700 |
| commit | 44e4b2d63aef1e6cb572acfa327ea2c3a36083e8 (patch) | |
| tree | d48f06f491e20d4f176c7e1435ba953ec549d72c /src/comp/lib | |
| parent | Support refcount-drop and conditional free in rustc. (diff) | |
| download | rust-44e4b2d63aef1e6cb572acfa327ea2c3a36083e8.tar.xz 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.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index f0cb65a2..220af154 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 { |