Rewrite trans_cast, float->float and float->int casts

This commit is contained in:
Marijn Haverbeke
2011-07-22 13:10:59 +02:00
parent 5864d4e13a
commit b45d973552
4 changed files with 71 additions and 48 deletions

View File

@@ -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));