@@ -6,20 +6,20 @@ import lib::llvm::{True, False};
6
6
import lib:: llvm:: llvm:: { ModuleRef , TypeRef , ValueRef } ;
7
7
import driver:: session;
8
8
import driver:: session:: session;
9
- import middle :: { trans , trans_common } ;
10
- import middle:: trans_common :: { crate_ctxt, val_ty, C_bytes , C_int ,
11
- C_named_struct , C_struct , T_enum_variant ,
12
- block_ctxt, result, rslt, bcx_ccx, bcx_tcx,
13
- type_has_static_size, umax, umin, align_to,
14
- tydesc_info} ;
9
+ import trans :: base ;
10
+ import middle:: trans :: common :: { crate_ctxt, val_ty, C_bytes , C_int ,
11
+ C_named_struct , C_struct , T_enum_variant ,
12
+ block_ctxt, result, rslt, bcx_ccx, bcx_tcx,
13
+ type_has_static_size, umax, umin, align_to,
14
+ tydesc_info} ;
15
15
import back:: abi;
16
16
import middle:: ty;
17
17
import middle:: ty:: field;
18
18
import syntax:: ast;
19
19
import syntax:: ast_util:: dummy_sp;
20
20
import syntax:: util:: interner;
21
21
import util:: common;
22
- import trans_build :: { Load , Store , Add , GEPi } ;
22
+ import trans :: build :: { Load , Store , Add , GEPi } ;
23
23
import syntax:: codemap:: span;
24
24
25
25
import core:: { vec, str} ;
@@ -68,7 +68,7 @@ const shape_tydesc: u8 = 28u8;
68
68
const shape_send_tydesc: u8 = 29u8 ;
69
69
70
70
// FIXME: This is a bad API in trans_common.
71
- fn C_u8 ( n : u8 ) -> ValueRef { ret trans_common :: C_u8 ( n as uint ) ; }
71
+ fn C_u8 ( n : u8 ) -> ValueRef { ret trans :: common :: C_u8 ( n as uint ) ; }
72
72
73
73
fn hash_res_info ( ri : res_info ) -> uint {
74
74
let h = 5381 u;
@@ -134,8 +134,8 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
134
134
// follow from how elem_t doesn't contain params.
135
135
// (Could add a postcondition to type_contains_params,
136
136
// once we implement Issue #586.)
137
- check ( trans_common :: type_has_static_size ( ccx, elem_t) ) ;
138
- let llty = trans :: type_of ( ccx, elem_t) ;
137
+ check ( trans :: common :: type_has_static_size ( ccx, elem_t) ) ;
138
+ let llty = base :: type_of ( ccx, elem_t) ;
139
139
min_size += llsize_of_real ( ccx, llty) ;
140
140
min_align += llalign_of_real ( ccx, llty) ;
141
141
}
@@ -213,11 +213,11 @@ fn compute_static_enum_size(ccx: @crate_ctxt, largest_variants: [uint],
213
213
// FIXME: there should really be a postcondition
214
214
// on enum_variants that would obviate the need for
215
215
// this check. (Issue #586)
216
- check ( trans_common :: type_has_static_size ( ccx, typ) ) ;
217
- lltys += [ trans :: type_of ( ccx, typ) ] ;
216
+ check ( trans :: common :: type_has_static_size ( ccx, typ) ) ;
217
+ lltys += [ base :: type_of ( ccx, typ) ] ;
218
218
}
219
219
220
- let llty = trans_common :: T_struct ( lltys) ;
220
+ let llty = trans :: common :: T_struct ( lltys) ;
221
221
let dp = llsize_of_real ( ccx, llty) as u16 ;
222
222
let variant_align = llalign_of_real ( ccx, llty) as u8 ;
223
223
@@ -294,13 +294,10 @@ fn s_send_tydesc(_tcx: ty_ctxt) -> u8 {
294
294
}
295
295
296
296
fn mk_ctxt ( llmod : ModuleRef ) -> ctxt {
297
- let llshapetablesty = trans_common:: T_named_struct ( "shapes" ) ;
298
- let llshapetables =
299
- str:: as_buf ( "shapes" ,
300
- { |buf|
301
- lib:: llvm:: llvm:: LLVMAddGlobal ( llmod, llshapetablesty,
302
- buf)
303
- } ) ;
297
+ let llshapetablesty = trans:: common:: T_named_struct ( "shapes" ) ;
298
+ let llshapetables = str:: as_buf ( "shapes" , { |buf|
299
+ lib:: llvm:: llvm:: LLVMAddGlobal ( llmod, llshapetablesty, buf)
300
+ } ) ;
304
301
305
302
ret { mutable next_tag_id : 0u16 ,
306
303
pad : 0u16 ,
@@ -584,7 +581,7 @@ fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
584
581
let len = interner:: len ( ccx. shape_cx . resources ) ;
585
582
while i < len {
586
583
let ri = interner:: get ( ccx. shape_cx . resources , i) ;
587
- dtors += [ trans_common :: get_res_dtor ( ccx, ri. did , ri. t ) ] ;
584
+ dtors += [ trans :: common :: get_res_dtor ( ccx, ri. did , ri. t ) ] ;
588
585
i += 1 u;
589
586
}
590
587
@@ -594,9 +591,9 @@ fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
594
591
fn gen_shape_tables ( ccx : @crate_ctxt ) {
595
592
let lltagstable = gen_enum_shapes ( ccx) ;
596
593
let llresourcestable = gen_resource_shapes ( ccx) ;
597
- trans_common :: set_struct_body ( ccx. shape_cx . llshapetablesty ,
598
- [ val_ty ( lltagstable) ,
599
- val_ty ( llresourcestable) ] ) ;
594
+ trans :: common :: set_struct_body ( ccx. shape_cx . llshapetablesty ,
595
+ [ val_ty ( lltagstable) ,
596
+ val_ty ( llresourcestable) ] ) ;
600
597
601
598
let lltables =
602
599
C_named_struct ( ccx. shape_cx . llshapetablesty ,
@@ -627,7 +624,7 @@ type tag_metrics = {
627
624
fn size_of ( bcx : @block_ctxt , t : ty:: t ) -> result {
628
625
let ccx = bcx_ccx ( bcx) ;
629
626
if check type_has_static_size ( ccx, t) {
630
- rslt ( bcx, llsize_of ( ccx, trans :: type_of ( ccx, t) ) )
627
+ rslt ( bcx, llsize_of ( ccx, base :: type_of ( ccx, t) ) )
631
628
} else {
632
629
let { bcx, sz, align: _ } = dynamic_metrics ( bcx, t) ;
633
630
rslt ( bcx, sz)
@@ -637,7 +634,7 @@ fn size_of(bcx: @block_ctxt, t: ty::t) -> result {
637
634
fn align_of ( bcx : @block_ctxt , t : ty:: t ) -> result {
638
635
let ccx = bcx_ccx ( bcx) ;
639
636
if check type_has_static_size ( ccx, t) {
640
- rslt ( bcx, llalign_of ( ccx, trans :: type_of ( ccx, t) ) )
637
+ rslt ( bcx, llalign_of ( ccx, base :: type_of ( ccx, t) ) )
641
638
} else {
642
639
let { bcx, sz: _ , align } = dynamic_metrics ( bcx, t) ;
643
640
rslt ( bcx, align)
@@ -647,7 +644,7 @@ fn align_of(bcx: @block_ctxt, t: ty::t) -> result {
647
644
fn metrics ( bcx : @block_ctxt , t : ty:: t ) -> metrics {
648
645
let ccx = bcx_ccx ( bcx) ;
649
646
if check type_has_static_size ( ccx, t) {
650
- let llty = trans :: type_of ( ccx, t) ;
647
+ let llty = base :: type_of ( ccx, t) ;
651
648
{ bcx: bcx, sz: llsize_of ( ccx, llty) , align: llalign_of ( ccx, llty) }
652
649
} else {
653
650
dynamic_metrics ( bcx, t)
@@ -696,7 +693,7 @@ fn static_size_of_enum(cx: @crate_ctxt, t: ty::t)
696
693
// express that with constrained types.
697
694
check ( type_has_static_size ( cx, tup_ty) ) ;
698
695
let this_size =
699
- llsize_of_real ( cx, trans :: type_of ( cx, tup_ty) ) ;
696
+ llsize_of_real ( cx, base :: type_of ( cx, tup_ty) ) ;
700
697
if max_size < this_size { max_size = this_size; }
701
698
}
702
699
cx. enum_sizes . insert ( t, max_size) ;
@@ -735,7 +732,7 @@ fn dynamic_metrics(cx: @block_ctxt, t: ty::t) -> metrics {
735
732
alt ty:: struct ( bcx_tcx ( cx) , t) {
736
733
ty:: ty_param ( p, _) {
737
734
let ti = none :: < @tydesc_info > ;
738
- let { bcx, val: tydesc } = trans :: get_tydesc ( cx, t, false , ti) . result ;
735
+ let { bcx, val: tydesc } = base :: get_tydesc ( cx, t, false , ti) . result ;
739
736
let szptr = GEPi ( bcx, tydesc, [ 0 , abi:: tydesc_field_size] ) ;
740
737
let aptr = GEPi ( bcx, tydesc, [ 0 , abi:: tydesc_field_align] ) ;
741
738
{ bcx: bcx, sz: Load ( bcx, szptr) , align: Load ( bcx, aptr) }
0 commit comments