about summary refs log tree commit diff
path: root/src/comp/lib
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-07-22 13:10:59 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-07-22 13:10:59 +0200
commitb45d973552c116b90185add4ddb5e4d32bb5cb9b (patch)
tree0c25314fbaae708373f61a7a176b5bc6ca0114be /src/comp/lib
parent5864d4e13aa6280eb1a7652990d2b7e08770e83f (diff)
downloadrust-b45d973552c116b90185add4ddb5e4d32bb5cb9b.tar.gz
rust-b45d973552c116b90185add4ddb5e4d32bb5cb9b.zip
Rewrite trans_cast, float->float and float->int casts
Diffstat (limited to 'src/comp/lib')
-rw-r--r--src/comp/lib/llvm.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs
index bb7dd4f2621..f2260922c56 100644
--- a/src/comp/lib/llvm.rs
+++ b/src/comp/lib/llvm.rs
@@ -1543,6 +1543,16 @@ fn type_to_str_inner(type_names names, &TypeRef[] outer0, TypeRef ty) -> str {
     }
 }
 
+fn float_width(TypeRef llt) -> uint {
+    ret alt llvm::LLVMGetTypeKind(llt) {
+      1 { 32u }
+      2 { 64u }
+      3 { 80u }
+      4 | 5 { 128u }
+      _ { fail "llvm_float_width called on a non-float type"; 0u }
+    };
+}
+
 fn fn_ty_param_tys(TypeRef fn_ty) -> TypeRef[] {
     auto args = ivec::init_elt(0 as TypeRef,
                                llvm::LLVMCountParamTypes(fn_ty));