aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle/trans.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-04-25 16:17:14 -0700
committerGraydon Hoare <[email protected]>2011-04-25 16:40:25 -0700
commitda328b1ba951bf2dbeb188120ab6344115a28631 (patch)
tree7313c9f7edf929248890e7fde5baa13b3fd64153 /src/comp/middle/trans.rs
parentrustc: Add a SAVE_TEMPS option to the Makefile for use when debugging stage1 ... (diff)
downloadrust-da328b1ba951bf2dbeb188120ab6344115a28631.tar.xz
rust-da328b1ba951bf2dbeb188120ab6344115a28631.zip
Kick ty_var and ty_local entries out of the type store. Pre-compute presence of var, local, param and bound_params in types.
Diffstat (limited to 'src/comp/middle/trans.rs')
-rw-r--r--src/comp/middle/trans.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 40294862..8d8c9926 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -120,7 +120,7 @@ type local_ctxt = rec(vec[str] path,
vec[ast.ty_param] obj_typarams,
vec[ast.obj_field] obj_fields,
@crate_ctxt ccx);
-
+
type self_vt = rec(ValueRef v, ty.t t);
@@ -1565,7 +1565,7 @@ fn get_tydesc(&@block_ctxt cx, ty.t t) -> result {
// Does it contain a type param? If so, generate a derived tydesc.
let uint n_params = ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t);
- if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t) > 0u) {
+ if (n_params > 0u) {
auto tys = linearize_ty_params(cx, t);
check (n_params == _vec.len[uint](tys._0));
@@ -4312,7 +4312,8 @@ fn trans_bind_thunk(@local_ctxt cx,
if (out_arg.mode == ast.val) {
val = bcx.build.Load(val);
- } else if (ty.count_ty_params(cx.ccx.tcx, out_arg.ty) > 0u) {
+ } else if (ty.type_contains_params(cx.ccx.tcx,
+ out_arg.ty)) {
check (out_arg.mode == ast.alias);
val = bcx.build.PointerCast(val, llout_arg_ty);
}
@@ -4325,7 +4326,7 @@ fn trans_bind_thunk(@local_ctxt cx,
case (none[@ast.expr]) {
let ValueRef passed_arg = llvm.LLVMGetParam(llthunk, a);
- if (ty.count_ty_params(cx.ccx.tcx, out_arg.ty) > 0u) {
+ if (ty.type_contains_params(cx.ccx.tcx, out_arg.ty)) {
check (out_arg.mode == ast.alias);
passed_arg = bcx.build.PointerCast(passed_arg,
llout_arg_ty);
@@ -4593,7 +4594,7 @@ fn trans_arg_expr(@block_ctxt cx,
bcx = re.bcx;
}
- if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, arg.ty) > 0u) {
+ if (ty.type_contains_params(cx.fcx.lcx.ccx.tcx, arg.ty)) {
auto lldestty = lldestty0;
if (arg.mode == ast.val) {
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
@@ -4655,7 +4656,7 @@ fn trans_args(@block_ctxt cx,
if (ty.type_has_dynamic_size(cx.fcx.lcx.ccx.tcx, retty)) {
llargs += vec(bcx.build.PointerCast
(llretslot, T_typaram_ptr(cx.fcx.lcx.ccx.tn)));
- } else if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, retty) != 0u) {
+ } else if (ty.type_contains_params(cx.fcx.lcx.ccx.tcx, retty)) {
// It's possible that the callee has some generic-ness somewhere in
// its return value -- say a method signature within an obj or a fn
// type deep in a structure -- which the caller has a concrete view