@@ -39,89 +39,91 @@ pub struct Config {
39
39
uint_type : UintTy ,
40
40
}
41
41
42
- pub static verbose: uint = 1 << 0 ;
43
- pub static time_passes: uint = 1 << 1 ;
44
- pub static count_llvm_insns: uint = 1 << 2 ;
45
- pub static time_llvm_passes: uint = 1 << 3 ;
46
- pub static trans_stats: uint = 1 << 4 ;
47
- pub static asm_comments: uint = 1 << 5 ;
48
- pub static no_verify: uint = 1 << 6 ;
49
- pub static borrowck_stats: uint = 1 << 7 ;
50
- pub static borrowck_note_pure: uint = 1 << 8 ;
51
- pub static borrowck_note_loan: uint = 1 << 9 ;
52
- pub static no_landing_pads: uint = 1 << 10 ;
53
- pub static debug_llvm: uint = 1 << 11 ;
54
- pub static count_type_sizes: uint = 1 << 12 ;
55
- pub static meta_stats: uint = 1 << 13 ;
56
- pub static no_opt: uint = 1 << 14 ;
57
- pub static gc: uint = 1 << 15 ;
58
- pub static debug_info: uint = 1 << 16 ;
59
- pub static extra_debug_info: uint = 1 << 17 ;
60
- pub static print_link_args: uint = 1 << 18 ;
61
- pub static no_debug_borrows: uint = 1 << 19 ;
62
- pub static lint_llvm: uint = 1 << 20 ;
63
- pub static print_llvm_passes: uint = 1 << 21 ;
64
- pub static no_vectorize_loops: uint = 1 << 22 ;
65
- pub static no_vectorize_slp: uint = 1 << 23 ;
66
- pub static no_prepopulate_passes: uint = 1 << 24 ;
67
- pub static use_softfp: uint = 1 << 25 ;
68
- pub static gen_crate_map: uint = 1 << 26 ;
69
- pub static prefer_dynamic: uint = 1 << 27 ;
70
- pub static no_integrated_as: uint = 1 << 28 ;
71
- pub static lto: uint = 1 << 29 ;
42
+ macro_rules! debugging_opts(
43
+ ( [ $opt: ident ] $cnt: expr ) => (
44
+ pub static $opt: u64 = 1 << $cnt;
45
+ ) ;
46
+ ( [ $opt: ident, $( $rest: ident) ,* ] $cnt: expr ) => (
47
+ pub static $opt: u64 = 1 << $cnt;
48
+ debugging_opts!( [ $( $rest) ,* ] $cnt + 1 )
49
+ )
50
+ )
72
51
73
- pub fn debugging_opts_map ( ) -> ~[ ( & ' static str , & ' static str , uint ) ] {
74
- ~[ ( "verbose" , "in general, enable more debug printouts" , verbose) ,
75
- ( "time-passes" , "measure time of each rustc pass" , time_passes) ,
52
+ debugging_opts ! (
53
+ [
54
+ VERBOSE ,
55
+ TIME_PASSES ,
56
+ COUNT_LLVM_INSNS ,
57
+ TIME_LLVM_PASSES ,
58
+ TRANS_STATS ,
59
+ ASM_COMMENTS ,
60
+ NO_VERIFY ,
61
+ BORROWCK_STATS ,
62
+ NO_LANDING_PADS ,
63
+ DEBUG_LLVM ,
64
+ COUNT_TYPE_SIZES ,
65
+ META_STATS ,
66
+ NO_OPT ,
67
+ GC ,
68
+ DEBUG_INFO ,
69
+ EXTRA_DEBUG_INFO ,
70
+ PRINT_LINK_ARGS ,
71
+ PRINT_LLVM_PASSES ,
72
+ NO_VECTORIZE_LOOPS ,
73
+ NO_VECTORIZE_SLP ,
74
+ NO_PREPOPULATE_PASSES ,
75
+ USE_SOFTFP ,
76
+ GEN_CRATE_MAP ,
77
+ PREFER_DYNAMIC ,
78
+ NO_INTEGRATED_AS ,
79
+ LTO
80
+ ]
81
+ 0
82
+ )
83
+
84
+ pub fn debugging_opts_map ( ) -> ~[ ( & ' static str , & ' static str , u64 ) ] {
85
+ ~[ ( "verbose" , "in general, enable more debug printouts" , VERBOSE ) ,
86
+ ( "time-passes" , "measure time of each rustc pass" , TIME_PASSES ) ,
76
87
( "count-llvm-insns" , "count where LLVM \
77
- instrs originate", count_llvm_insns ) ,
88
+ instrs originate", COUNT_LLVM_INSNS ) ,
78
89
( "time-llvm-passes" , "measure time of each LLVM pass" ,
79
- time_llvm_passes) ,
80
- ( "trans-stats" , "gather trans statistics" , trans_stats) ,
81
- ( "asm-comments" , "generate comments into the assembly (may change behavior)" , asm_comments) ,
82
- ( "no-verify" , "skip LLVM verification" , no_verify) ,
83
- ( "borrowck-stats" , "gather borrowck statistics" , borrowck_stats) ,
84
- ( "borrowck-note-pure" , "note where purity is req'd" ,
85
- borrowck_note_pure) ,
86
- ( "borrowck-note-loan" , "note where loans are req'd" ,
87
- borrowck_note_loan) ,
90
+ TIME_LLVM_PASSES ) ,
91
+ ( "trans-stats" , "gather trans statistics" , TRANS_STATS ) ,
92
+ ( "asm-comments" , "generate comments into the assembly (may change behavior)" ,
93
+ ASM_COMMENTS ) ,
94
+ ( "no-verify" , "skip LLVM verification" , NO_VERIFY ) ,
95
+ ( "borrowck-stats" , "gather borrowck statistics" , BORROWCK_STATS ) ,
88
96
( "no-landing-pads" , "omit landing pads for unwinding" ,
89
- no_landing_pads ) ,
90
- ( "debug-llvm" , "enable debug output from LLVM" , debug_llvm ) ,
97
+ NO_LANDING_PADS ) ,
98
+ ( "debug-llvm" , "enable debug output from LLVM" , DEBUG_LLVM ) ,
91
99
( "count-type-sizes" , "count the sizes of aggregate types" ,
92
- count_type_sizes) ,
93
- ( "meta-stats" , "gather metadata statistics" , meta_stats) ,
94
- ( "no-opt" , "do not optimize, even if -O is passed" , no_opt) ,
95
- ( "print-link-args" , "Print the arguments passed to the linker" , print_link_args) ,
96
- ( "gc" , "Garbage collect shared data (experimental)" , gc) ,
100
+ COUNT_TYPE_SIZES ) ,
101
+ ( "meta-stats" , "gather metadata statistics" , META_STATS ) ,
102
+ ( "no-opt" , "do not optimize, even if -O is passed" , NO_OPT ) ,
103
+ ( "print-link-args" , "Print the arguments passed to the linker" ,
104
+ PRINT_LINK_ARGS ) ,
105
+ ( "gc" , "Garbage collect shared data (experimental)" , GC ) ,
97
106
( "extra-debug-info" , "Extra debugging info (experimental)" ,
98
- extra_debug_info) ,
99
- ( "debug-info" , "Produce debug info (experimental)" , debug_info) ,
100
- ( "no-debug-borrows" ,
101
- "do not show where borrow checks fail" ,
102
- no_debug_borrows) ,
103
- ( "lint-llvm" ,
104
- "Run the LLVM lint pass on the pre-optimization IR" ,
105
- lint_llvm) ,
107
+ EXTRA_DEBUG_INFO ) ,
108
+ ( "debug-info" , "Produce debug info (experimental)" , DEBUG_INFO ) ,
106
109
( "print-llvm-passes" ,
107
110
"Prints the llvm optimization passes being run" ,
108
- print_llvm_passes ) ,
111
+ PRINT_LLVM_PASSES ) ,
109
112
( "no-prepopulate-passes" ,
110
113
"Don't pre-populate the pass managers with a list of passes, only use \
111
114
the passes from --passes",
112
- no_prepopulate_passes ) ,
115
+ NO_PREPOPULATE_PASSES ) ,
113
116
( "no-vectorize-loops" ,
114
117
"Don't run the loop vectorization optimization passes" ,
115
- no_vectorize_loops) ,
116
- ( "no-vectorize-slp" ,
117
- "Don't run LLVM's SLP vectorization passes" ,
118
- no_vectorize_slp) ,
119
- ( "soft-float" , "Generate software floating point library calls" , use_softfp) ,
120
- ( "gen-crate-map" , "Force generation of a toplevel crate map" , gen_crate_map) ,
121
- ( "prefer-dynamic" , "Prefer dynamic linking to static linking" , prefer_dynamic) ,
118
+ NO_VECTORIZE_LOOPS ) ,
119
+ ( "no-vectorize-slp" , "Don't run LLVM's SLP vectorization passes" ,
120
+ NO_VECTORIZE_SLP ) ,
121
+ ( "soft-float" , "Generate software floating point library calls" , USE_SOFTFP ) ,
122
+ ( "gen-crate-map" , "Force generation of a toplevel crate map" , GEN_CRATE_MAP ) ,
123
+ ( "prefer-dynamic" , "Prefer dynamic linking to static linking" , PREFER_DYNAMIC ) ,
122
124
( "no-integrated-as" ,
123
- "Use external assembler rather than LLVM's integrated one" , no_integrated_as ) ,
124
- ( "lto" , "Perform LLVM link-time optimizations" , lto ) ,
125
+ "Use external assembler rather than LLVM's integrated one" , NO_INTEGRATED_AS ) ,
126
+ ( "lto" , "Perform LLVM link-time optimizations" , LTO ) ,
125
127
]
126
128
}
127
129
@@ -168,7 +170,7 @@ pub struct Options {
168
170
parse_only : bool ,
169
171
no_trans : bool ,
170
172
no_analysis : bool ,
171
- debugging_opts : uint ,
173
+ debugging_opts : u64 ,
172
174
android_cross_path : Option < ~str > ,
173
175
/// Whether to write dependency files. It's (enabled, optional filename).
174
176
write_dependency_info : ( bool , Option < Path > ) ,
@@ -291,66 +293,56 @@ impl Session_ {
291
293
pub fn diagnostic ( & self ) -> @diagnostic:: SpanHandler {
292
294
self . span_diagnostic
293
295
}
294
- pub fn debugging_opt ( & self , opt : uint ) -> bool {
295
- ( self . opts . debugging_opts & opt) != 0 u
296
+ pub fn debugging_opt ( & self , opt : u64 ) -> bool {
297
+ ( self . opts . debugging_opts & opt) != 0
296
298
}
297
299
// This exists to help with refactoring to eliminate impossible
298
300
// cases later on
299
301
pub fn impossible_case ( & self , sp : Span , msg : & str ) -> ! {
300
302
self . span_bug ( sp, format ! ( "Impossible case reached: {}" , msg) ) ;
301
303
}
302
- pub fn verbose ( & self ) -> bool { self . debugging_opt ( verbose ) }
303
- pub fn time_passes ( & self ) -> bool { self . debugging_opt ( time_passes ) }
304
+ pub fn verbose ( & self ) -> bool { self . debugging_opt ( VERBOSE ) }
305
+ pub fn time_passes ( & self ) -> bool { self . debugging_opt ( TIME_PASSES ) }
304
306
pub fn count_llvm_insns ( & self ) -> bool {
305
- self . debugging_opt ( count_llvm_insns )
307
+ self . debugging_opt ( COUNT_LLVM_INSNS )
306
308
}
307
309
pub fn count_type_sizes ( & self ) -> bool {
308
- self . debugging_opt ( count_type_sizes )
310
+ self . debugging_opt ( COUNT_TYPE_SIZES )
309
311
}
310
312
pub fn time_llvm_passes ( & self ) -> bool {
311
- self . debugging_opt ( time_llvm_passes)
312
- }
313
- pub fn trans_stats ( & self ) -> bool { self . debugging_opt ( trans_stats) }
314
- pub fn meta_stats ( & self ) -> bool { self . debugging_opt ( meta_stats) }
315
- pub fn asm_comments ( & self ) -> bool { self . debugging_opt ( asm_comments) }
316
- pub fn no_verify ( & self ) -> bool { self . debugging_opt ( no_verify) }
317
- pub fn lint_llvm ( & self ) -> bool { self . debugging_opt ( lint_llvm) }
318
- pub fn borrowck_stats ( & self ) -> bool { self . debugging_opt ( borrowck_stats) }
319
- pub fn borrowck_note_pure ( & self ) -> bool {
320
- self . debugging_opt ( borrowck_note_pure)
321
- }
322
- pub fn borrowck_note_loan ( & self ) -> bool {
323
- self . debugging_opt ( borrowck_note_loan)
324
- }
325
- pub fn debug_borrows ( & self ) -> bool {
326
- self . opts . optimize == No && !self . debugging_opt ( no_debug_borrows)
313
+ self . debugging_opt ( TIME_LLVM_PASSES )
327
314
}
315
+ pub fn trans_stats ( & self ) -> bool { self . debugging_opt ( TRANS_STATS ) }
316
+ pub fn meta_stats ( & self ) -> bool { self . debugging_opt ( META_STATS ) }
317
+ pub fn asm_comments ( & self ) -> bool { self . debugging_opt ( ASM_COMMENTS ) }
318
+ pub fn no_verify ( & self ) -> bool { self . debugging_opt ( NO_VERIFY ) }
319
+ pub fn borrowck_stats ( & self ) -> bool { self . debugging_opt ( BORROWCK_STATS ) }
328
320
pub fn print_llvm_passes ( & self ) -> bool {
329
- self . debugging_opt ( print_llvm_passes )
321
+ self . debugging_opt ( PRINT_LLVM_PASSES )
330
322
}
331
323
pub fn no_prepopulate_passes ( & self ) -> bool {
332
- self . debugging_opt ( no_prepopulate_passes )
324
+ self . debugging_opt ( NO_PREPOPULATE_PASSES )
333
325
}
334
326
pub fn no_vectorize_loops ( & self ) -> bool {
335
- self . debugging_opt ( no_vectorize_loops )
327
+ self . debugging_opt ( NO_VECTORIZE_LOOPS )
336
328
}
337
329
pub fn no_vectorize_slp ( & self ) -> bool {
338
- self . debugging_opt ( no_vectorize_slp )
330
+ self . debugging_opt ( NO_VECTORIZE_SLP )
339
331
}
340
332
pub fn gen_crate_map ( & self ) -> bool {
341
- self . debugging_opt ( gen_crate_map )
333
+ self . debugging_opt ( GEN_CRATE_MAP )
342
334
}
343
335
pub fn prefer_dynamic ( & self ) -> bool {
344
- self . debugging_opt ( prefer_dynamic )
336
+ self . debugging_opt ( PREFER_DYNAMIC )
345
337
}
346
338
pub fn no_integrated_as ( & self ) -> bool {
347
- self . debugging_opt ( no_integrated_as )
339
+ self . debugging_opt ( NO_INTEGRATED_AS )
348
340
}
349
341
pub fn lto ( & self ) -> bool {
350
- self . debugging_opt ( lto )
342
+ self . debugging_opt ( LTO )
351
343
}
352
344
pub fn no_landing_pads ( & self ) -> bool {
353
- self . debugging_opt ( no_landing_pads )
345
+ self . debugging_opt ( NO_LANDING_PADS )
354
346
}
355
347
356
348
// pointless function, now...
@@ -396,7 +388,7 @@ pub fn basic_options() -> @Options {
396
388
parse_only : false ,
397
389
no_trans : false ,
398
390
no_analysis : false ,
399
- debugging_opts : 0 u ,
391
+ debugging_opts : 0 ,
400
392
android_cross_path : None ,
401
393
write_dependency_info : ( false , None ) ,
402
394
print_metas : ( false , false , false ) ,
0 commit comments