diff options
| author | Graydon Hoare <[email protected]> | 2010-11-22 17:41:26 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-11-22 17:41:32 -0800 |
| commit | e05d7c3ac1e72edff337719fe58da69e959c4cf4 (patch) | |
| tree | b040d23dac019f8caf1157b385e4b6f915696815 /src/comp/middle/trans.rs | |
| parent | rustc: "Expected" and "actual" were swapped. Also un-XFAIL compile-fail/arg-c... (diff) | |
| download | rust-e05d7c3ac1e72edff337719fe58da69e959c4cf4.tar.xz rust-e05d7c3ac1e72edff337719fe58da69e959c4cf4.zip | |
Support mach types in rustc, enable 5 more tests.
Diffstat (limited to 'src/comp/middle/trans.rs')
| -rw-r--r-- | src/comp/middle/trans.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9bc1f19c..f7ee82f6 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -529,6 +529,27 @@ impure fn trans_lit(@block_ctxt cx, &ast.lit lit) -> result { case (ast.lit_uint(?u)) { ret res(cx, C_int(u as int)); } + case (ast.lit_mach_int(?tm, ?i)) { + // FIXME: the entire handling of mach types falls apart + // if target int width is larger than host, at the moment; + // re-do the mach-int types using 'big' when that works. + auto t = T_int(); + alt (tm) { + case (common.ty_u8) { t = T_i8(); } + case (common.ty_u16) { t = T_i16(); } + case (common.ty_u32) { t = T_i32(); } + case (common.ty_u64) { t = T_i64(); } + + case (common.ty_i8) { t = T_i8(); } + case (common.ty_i16) { t = T_i16(); } + case (common.ty_i32) { t = T_i32(); } + case (common.ty_i64) { t = T_i64(); } + case (_) { + cx.fcx.ccx.sess.bug("bad mach int literal type"); + } + } + ret res(cx, C_integral(i, t)); + } case (ast.lit_char(?c)) { ret res(cx, C_integral(c as int, T_char())); } |