@@ -530,6 +530,14 @@ def emscripten(filename, append_ext=True, extra_args=[]):
530
530
531
531
return filename + '.o.js'
532
532
533
+ @staticmethod
534
+ def can_build_standalone ():
535
+ return not Settings .BUILD_AS_SHARED_LIB and not Settings .LINKABLE
536
+
537
+ @staticmethod
538
+ def can_use_unsafe_opts ():
539
+ return Settings .USE_TYPED_ARRAYS == 2
540
+
533
541
@staticmethod
534
542
def pick_llvm_opts (optimization_level ):
535
543
'''
@@ -543,28 +551,28 @@ def pick_llvm_opts(optimization_level):
543
551
llvm-as < /dev/null | opt -std-compile-opts -disable-output -debug-pass=Arguments
544
552
'''
545
553
assert 0 <= optimization_level <= 3
546
- safe = Settings . USE_TYPED_ARRAYS != 2
554
+ unsafe = Building . can_use_unsafe_opts ()
547
555
opts = []
548
556
if optimization_level > 0 :
549
- if not safe :
557
+ if unsafe :
550
558
opts .append ('-disable-inlining' ) # we prefer to let closure compiler do our inlining, to avoid overly aggressive inlining
551
559
# -Ox opts do -globaldce, which removes stuff that is needed for libraries and linkables
552
- if not Settings . BUILD_AS_SHARED_LIB and not Settings . LINKABLE :
560
+ if Building . can_build_standalone () :
553
561
opts .append ('-O%d' % optimization_level )
554
562
else :
555
563
opts .append ('-std-compile-opts' )
556
564
#print '[unsafe: %s]' % ','.join(opts)
557
565
else :
558
- allow_nonportable = not safe
566
+ allow_nonportable = False
559
567
optimize_size = True
560
- use_aa = not safe
568
+ use_aa = False
561
569
562
570
# PassManagerBuilder::populateModulePassManager
563
571
if allow_nonportable and use_aa : # ammo.js results indicate this can be nonportable
564
572
opts .append ('-tbaa' )
565
573
opts .append ('-basicaa' ) # makes fannkuch slow but primes fast
566
574
567
- if not Settings . BUILD_AS_SHARED_LIB and not Settings . LINKABLE :
575
+ if Building . can_build_standalone () :
568
576
opts .append ('-internalize' )
569
577
570
578
opts .append ('-globalopt' )
@@ -624,7 +632,7 @@ def pick_llvm_opts(optimization_level):
624
632
625
633
opts .append ('-strip-dead-prototypes' )
626
634
627
- if not Settings . BUILD_AS_SHARED_LIB and not Settings . LINKABLE :
635
+ if Building . can_build_standalone () :
628
636
opts .append ('-globaldce' )
629
637
630
638
if optimization_level > 1 : opts .append ('-constmerge' )
0 commit comments