diff options
| author | Graydon Hoare <[email protected]> | 2010-09-28 14:01:21 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-09-28 14:01:21 -0700 |
| commit | 5a4cb3ef36bc0610284c5e67c239363d3757df71 (patch) | |
| tree | a1648adb11d18d0d3767a5ebf0b6b52d75ca8ed8 /src/comp/lib/llvm.rs | |
| parent | Translate literal int, char, bool and str types, as well as logging them. (diff) | |
| download | rust-5a4cb3ef36bc0610284c5e67c239363d3757df71.tar.xz rust-5a4cb3ef36bc0610284c5e67c239363d3757df71.zip | |
Translate a modest selection of easy binops.
Diffstat (limited to 'src/comp/lib/llvm.rs')
| -rw-r--r-- | src/comp/lib/llvm.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index ac8dd76f..f0cb65a2 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -41,6 +41,21 @@ const uint LLVMColdCallConv = 9u; const uint LLVMX86StdcallCallConv = 64u; const uint LLVMX86FastcallCallConv = 65u; +// Consts for the LLVM IntPredicate type, pre-cast to uint. +// FIXME: as above. + +const uint LLVMIntEQ = 32; +const uint LLVMIntNE = 33; +const uint LLVMIntUGT = 34; +const uint LLVMIntUGE = 35; +const uint LLVMIntULT = 36; +const uint LLVMIntULE = 37; +const uint LLVMIntSGT = 38; +const uint LLVMIntSGE = 39; +const uint LLVMIntSLT = 40; +const uint LLVMIntSLE = 41; + + native mod llvm = llvm_lib { type ModuleRef; @@ -626,7 +641,7 @@ native mod llvm = llvm_lib { TypeRef DestTy, sbuf Name) -> ValueRef; /* Comparisons */ - fn LLVMBuildICmp(BuilderRef B, IntPredicate Op, + fn LLVMBuildICmp(BuilderRef B, uint Op, ValueRef LHS, ValueRef RHS, sbuf Name) -> ValueRef; fn LLVMBuildFCmp(BuilderRef B, RealPredicate Op, @@ -981,7 +996,7 @@ obj builder(BuilderRef B) { /* Comparisons */ - fn ICmp(IntPredicate Op, ValueRef LHS, ValueRef RHS) -> ValueRef { + fn ICmp(uint Op, ValueRef LHS, ValueRef RHS) -> ValueRef { ret llvm.LLVMBuildICmp(B, Op, LHS, RHS, _str.buf("")); } |