@@ -85,7 +85,6 @@ use syntax::codemap::span;
85
85
use syntax:: parse:: token;
86
86
use syntax:: parse:: token:: { special_idents} ;
87
87
use syntax:: print:: pprust:: stmt_to_str;
88
- use syntax:: visit;
89
88
use syntax:: { ast, ast_util, codemap, ast_map} ;
90
89
use syntax:: abi:: { X86 , X86_64 , Arm , Mips } ;
91
90
@@ -2609,57 +2608,6 @@ pub fn register_method(ccx: @mut CrateContext,
2609
2608
llfn
2610
2609
}
2611
2610
2612
- // The constant translation pass.
2613
- pub fn trans_constant ( ccx : & mut CrateContext , it : @ast:: item ) {
2614
- let _icx = push_ctxt ( "trans_constant" ) ;
2615
- match it. node {
2616
- ast:: item_enum( ref enum_definition, _) => {
2617
- let vi = ty:: enum_variants ( ccx. tcx ,
2618
- ast:: def_id { crate : ast:: LOCAL_CRATE ,
2619
- node : it. id } ) ;
2620
- let mut i = 0 ;
2621
- let path = item_path ( ccx, & it. id ) ;
2622
- for variant in ( * enum_definition) . variants . iter ( ) {
2623
- let p = vec:: append ( path. clone ( ) , [
2624
- path_name ( variant. node . name ) ,
2625
- path_name ( special_idents:: descrim)
2626
- ] ) ;
2627
- let s = mangle_exported_name ( ccx, p, ty:: mk_int ( ) ) . to_managed ( ) ;
2628
- let disr_val = vi[ i] . disr_val ;
2629
- note_unique_llvm_symbol ( ccx, s) ;
2630
- let discrim_gvar = do s. with_c_str |buf| {
2631
- unsafe {
2632
- llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2633
- }
2634
- } ;
2635
- unsafe {
2636
- llvm:: LLVMSetInitializer ( discrim_gvar, C_uint ( ccx, disr_val) ) ;
2637
- llvm:: LLVMSetGlobalConstant ( discrim_gvar, True ) ;
2638
- }
2639
- ccx. discrims . insert (
2640
- local_def ( variant. node . id ) , discrim_gvar) ;
2641
- ccx. discrim_symbols . insert ( variant. node . id , s) ;
2642
- i += 1 ;
2643
- }
2644
- }
2645
- _ => ( )
2646
- }
2647
- }
2648
-
2649
- struct TransConstantsVisitor { ccx : @mut CrateContext }
2650
-
2651
- impl visit:: Visitor < ( ) > for TransConstantsVisitor {
2652
- fn visit_item ( & mut self , i : @ast:: item , _: ( ) ) {
2653
- trans_constant ( self . ccx , i) ;
2654
- visit:: walk_item ( self , i, ( ) ) ;
2655
- }
2656
- }
2657
-
2658
- pub fn trans_constants ( ccx : @mut CrateContext , crate : & ast:: Crate ) {
2659
- let mut v = TransConstantsVisitor { ccx : ccx } ;
2660
- visit:: walk_crate ( & mut v, crate , ( ) ) ;
2661
- }
2662
-
2663
2611
pub fn vp2i ( cx : @mut Block , v : ValueRef ) -> ValueRef {
2664
2612
let ccx = cx. ccx ( ) ;
2665
2613
return PtrToInt ( cx, v, ccx. int_type ) ;
@@ -3038,11 +2986,6 @@ pub fn trans_crate(sess: session::Session,
3038
2986
link_meta,
3039
2987
analysis. reachable ) ;
3040
2988
3041
- {
3042
- let _icx = push_ctxt ( "data" ) ;
3043
- trans_constants ( ccx, crate ) ;
3044
- }
3045
-
3046
2989
{
3047
2990
let _icx = push_ctxt ( "text" ) ;
3048
2991
trans_mod ( ccx, & crate . module) ;
0 commit comments