@@ -84,7 +84,6 @@ use syntax::codemap::span;
84
84
use syntax:: parse:: token;
85
85
use syntax:: parse:: token:: { special_idents} ;
86
86
use syntax:: print:: pprust:: stmt_to_str;
87
- use syntax:: visit;
88
87
use syntax:: { ast, ast_util, codemap, ast_map} ;
89
88
use syntax:: abi:: { X86 , X86_64 , Arm , Mips } ;
90
89
@@ -2621,57 +2620,6 @@ pub fn register_method(ccx: @mut CrateContext,
2621
2620
llfn
2622
2621
}
2623
2622
2624
- // The constant translation pass.
2625
- pub fn trans_constant ( ccx : & mut CrateContext , it : @ast:: item ) {
2626
- let _icx = push_ctxt ( "trans_constant" ) ;
2627
- match it. node {
2628
- ast:: item_enum( ref enum_definition, _) => {
2629
- let vi = ty:: enum_variants ( ccx. tcx ,
2630
- ast:: def_id { crate : ast:: LOCAL_CRATE ,
2631
- node : it. id } ) ;
2632
- let mut i = 0 ;
2633
- let path = item_path ( ccx, & it. id ) ;
2634
- for variant in ( * enum_definition) . variants . iter ( ) {
2635
- let p = vec:: append ( path. clone ( ) , [
2636
- path_name ( variant. node . name ) ,
2637
- path_name ( special_idents:: descrim)
2638
- ] ) ;
2639
- let s = mangle_exported_name ( ccx, p, ty:: mk_int ( ) ) . to_managed ( ) ;
2640
- let disr_val = vi[ i] . disr_val ;
2641
- note_unique_llvm_symbol ( ccx, s) ;
2642
- let discrim_gvar = do s. with_c_str |buf| {
2643
- unsafe {
2644
- llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2645
- }
2646
- } ;
2647
- unsafe {
2648
- llvm:: LLVMSetInitializer ( discrim_gvar, C_uint ( ccx, disr_val) ) ;
2649
- llvm:: LLVMSetGlobalConstant ( discrim_gvar, True ) ;
2650
- }
2651
- ccx. discrims . insert (
2652
- local_def ( variant. node . id ) , discrim_gvar) ;
2653
- ccx. discrim_symbols . insert ( variant. node . id , s) ;
2654
- i += 1 ;
2655
- }
2656
- }
2657
- _ => ( )
2658
- }
2659
- }
2660
-
2661
- struct TransConstantsVisitor { ccx : @mut CrateContext }
2662
-
2663
- impl visit:: Visitor < ( ) > for TransConstantsVisitor {
2664
- fn visit_item ( & mut self , i : @ast:: item , _: ( ) ) {
2665
- trans_constant ( self . ccx , i) ;
2666
- visit:: walk_item ( self , i, ( ) ) ;
2667
- }
2668
- }
2669
-
2670
- pub fn trans_constants ( ccx : @mut CrateContext , crate : & ast:: Crate ) {
2671
- let mut v = TransConstantsVisitor { ccx : ccx } ;
2672
- visit:: walk_crate ( & mut v, crate , ( ) ) ;
2673
- }
2674
-
2675
2623
pub fn vp2i ( cx : @mut Block , v : ValueRef ) -> ValueRef {
2676
2624
let ccx = cx. ccx ( ) ;
2677
2625
return PtrToInt ( cx, v, ccx. int_type ) ;
@@ -3050,11 +2998,6 @@ pub fn trans_crate(sess: session::Session,
3050
2998
link_meta,
3051
2999
analysis. reachable ) ;
3052
3000
3053
- {
3054
- let _icx = push_ctxt ( "data" ) ;
3055
- trans_constants ( ccx, crate ) ;
3056
- }
3057
-
3058
3001
{
3059
3002
let _icx = push_ctxt ( "text" ) ;
3060
3003
trans_mod ( ccx, & crate . module) ;
0 commit comments