This repository was archived by the owner on Jun 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed
Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 103103 """Enable the use of atomic instructions""" ,
104104 default = True )
105105
106- enable_constant_folding = BoolSetting (
107- """Enable the constant folding pass. This may be resource intensive""" ,
108- default = False )
109-
110106#
111107# Settings specific to the `baldrdash` calling convention.
112108#
Original file line number Diff line number Diff line change @@ -113,6 +113,16 @@ impl Context {
113113 Ok ( ( ) )
114114 }
115115
116+ /// Optimize the function with available optimizations.
117+ ///
118+ /// Since this can be resource intensive (and code-size inflating),
119+ /// it is separated from `Context::compile` to allow DCE to remove it
120+ /// if it's not used.
121+ pub fn optimize ( & mut self , isa : & TargetIsa ) -> CodegenResult < ( ) > {
122+ self . verify_if ( isa) ?;
123+ self . fold_constants ( isa)
124+ }
125+
116126 /// Compile the function.
117127 ///
118128 /// Run the function through all the passes necessary to generate code for the target ISA
@@ -124,10 +134,6 @@ impl Context {
124134 let _tt = timing:: compile ( ) ;
125135 self . verify_if ( isa) ?;
126136
127- if isa. flags ( ) . enable_constant_folding ( ) {
128- self . fold_constants ( isa) ?;
129- }
130-
131137 self . compute_cfg ( ) ;
132138 if isa. flags ( ) . opt_level ( ) != OptLevel :: Fastest {
133139 self . preopt ( isa) ?;
Original file line number Diff line number Diff line change @@ -380,7 +380,6 @@ mod tests {
380380 enable_nan_canonicalization = false\n \
381381 enable_simd = true\n \
382382 enable_atomics = true\n \
383- enable_constant_folding = false\n \
384383 baldrdash_prologue_words = 0\n \
385384 allones_funcaddrs = false\n \
386385 probestack_enabled = true\n \
You can’t perform that action at this time.
0 commit comments