@@ -304,8 +304,6 @@ class LangOptions : public LangOptionsBase {
304304 // / input is a header file (i.e. -x c-header).
305305 bool IsHeaderFile = false ;
306306
307- bool denormalIsIEEE = false ;
308-
309307 LangOptions ();
310308
311309 // Define accessors/mutators for language options of enumeration type.
@@ -379,33 +377,28 @@ class FPOptions {
379377 using RoundingMode = llvm::RoundingMode;
380378
381379public:
382- FPOptions ()
383- : fp_contract(LangOptions::FPC_Off), fenv_access(LangOptions::FEA_Off),
384- rounding (LangOptions::FPR_ToNearest),
385- exceptions(LangOptions::FPE_Ignore), allow_reassoc( 0 ), no_nans( 0 ),
386- no_infs( 0 ), no_signed_zeros( 0 ), allow_reciprocal( 0 ), approx_func( 0 ) {}
380+ FPOptions () : fp_contract(LangOptions::FPC_Off),
381+ fenv_access (LangOptions::FEA_Off),
382+ rounding(LangOptions::FPR_ToNearest),
383+ exceptions(LangOptions::FPE_Ignore)
384+ {}
387385
388386 // Used for serializing.
389- explicit FPOptions (unsigned I) { getFromOpaqueInt (I); }
387+ explicit FPOptions (unsigned I)
388+ : fp_contract(I & 3 ),
389+ fenv_access((I >> 2 ) & 1),
390+ rounding ((I >> 3 ) & 7),
391+ exceptions ((I >> 6 ) & 3)
392+ {}
390393
391394 explicit FPOptions (const LangOptions &LangOpts)
392395 : fp_contract(LangOpts.getDefaultFPContractMode()),
393396 fenv_access(LangOptions::FEA_Off),
394- rounding(static_cast <unsigned >(LangOpts.getFPRoundingMode())),
395- exceptions(LangOpts.getFPExceptionMode()),
396- allow_reassoc(LangOpts.FastMath || LangOpts.AllowFPReassoc),
397- no_nans(LangOpts.FastMath || LangOpts.NoHonorNaNs),
398- no_infs(LangOpts.FastMath || LangOpts.NoHonorInfs),
399- no_signed_zeros(LangOpts.FastMath || LangOpts.NoSignedZero),
400- allow_reciprocal(LangOpts.FastMath || LangOpts.AllowRecip),
401- approx_func(LangOpts.FastMath || LangOpts.ApproxFunc) {}
397+ rounding(LangOptions::FPR_ToNearest),
398+ exceptions(LangOptions::FPE_Ignore)
399+ {}
402400 // FIXME: Use getDefaultFEnvAccessMode() when available.
403401
404- void setFastMath (bool B = true ) {
405- allow_reassoc = no_nans = no_infs = no_signed_zeros = approx_func =
406- allow_reciprocal = B;
407- }
408-
409402 // / Return the default value of FPOptions that's used when trailing
410403 // / storage isn't required.
411404 static FPOptions defaultWithoutTrailingStorage (const LangOptions &LO);
@@ -440,18 +433,6 @@ class FPOptions {
440433 fenv_access = LangOptions::FEA_On;
441434 }
442435
443- void setFPPreciseEnabled (bool Value) {
444- if (Value) {
445- /* Precise mode implies fp_contract=on and disables ffast-math */
446- setFastMath (false );
447- setAllowFPContractWithinStatement ();
448- } else {
449- /* Precise mode implies fp_contract=fast and enables ffast-math */
450- setFastMath (true );
451- setAllowFPContractAcrossStatement ();
452- }
453- }
454-
455436 void setDisallowFEnvAccess () { fenv_access = LangOptions::FEA_Off; }
456437
457438 RoundingMode getRoundingMode () const {
@@ -470,22 +451,6 @@ class FPOptions {
470451 exceptions = EM;
471452 }
472453
473- // / FMF Flag queries
474- bool allowAssociativeMath () const { return allow_reassoc; }
475- bool noHonorNaNs () const { return no_nans; }
476- bool noHonorInfs () const { return no_infs; }
477- bool noSignedZeros () const { return no_signed_zeros; }
478- bool allowReciprocalMath () const { return allow_reciprocal; }
479- bool allowApproximateFunctions () const { return approx_func; }
480-
481- // / Flag setters
482- void setAllowAssociativeMath (bool B = true ) { allow_reassoc = B; }
483- void setNoHonorNaNs (bool B = true ) { no_nans = B; }
484- void setNoHonorInfs (bool B = true ) { no_infs = B; }
485- void setNoSignedZeros (bool B = true ) { no_signed_zeros = B; }
486- void setAllowReciprocalMath (bool B = true ) { allow_reciprocal = B; }
487- void setAllowApproximateFunctions (bool B = true ) { approx_func = B; }
488-
489454 bool isFPConstrained () const {
490455 return getRoundingMode () != RoundingMode::NearestTiesToEven ||
491456 getExceptionMode () != LangOptions::FPE_Ignore ||
@@ -495,23 +460,7 @@ class FPOptions {
495460 // / Used to serialize this.
496461 unsigned getAsOpaqueInt () const {
497462 return fp_contract | (fenv_access << 2 ) | (rounding << 3 ) |
498- (exceptions << 6 ) | (allow_reassoc << 8 ) | (no_nans << 9 ) |
499- (no_infs << 10 ) | (no_signed_zeros << 11 ) |
500- (allow_reciprocal << 12 ) | (approx_func << 13 );
501- }
502-
503- // / Used with getAsOpaqueInt() to manage the float_control pragma stack.
504- void getFromOpaqueInt (unsigned I) {
505- fp_contract = (static_cast <LangOptions::FPContractModeKind>(I & 3 ));
506- fenv_access = (static_cast <LangOptions::FEnvAccessModeKind>((I >> 2 ) & 1 ));
507- rounding = static_cast <unsigned >(static_cast <RoundingMode>((I >> 3 ) & 7 ));
508- exceptions = (static_cast <LangOptions::FPExceptionModeKind>((I >> 6 ) & 3 ));
509- allow_reassoc = ((I >> 8 ) & 1 );
510- no_nans = ((I >> 9 ) & 1 );
511- no_infs = ((I >> 10 ) & 1 );
512- no_signed_zeros = ((I >> 11 ) & 1 );
513- allow_reciprocal = ((I >> 12 ) & 1 );
514- approx_func = ((I >> 13 ) & 1 );
463+ (exceptions << 6 );
515464 }
516465
517466private:
@@ -522,25 +471,6 @@ class FPOptions {
522471 unsigned fenv_access : 1 ;
523472 unsigned rounding : 3 ;
524473 unsigned exceptions : 2 ;
525- // / Allow reassociation transformations for floating-point instructions.
526- unsigned allow_reassoc : 1 ;
527- // / No NaNs - Allow optimizations to assume the arguments and result
528- // / are not NaN. If an argument is a nan, or the result would be a nan,
529- // / it produces a :ref:`poison value <poisonvalues>` instead.
530- unsigned no_nans : 1 ;
531- // / No Infs - Allow optimizations to assume the arguments and result
532- // / are not +/-Inf. If an argument is +/-Inf, or the result would be +/-Inf,
533- // / it produces a :ref:`poison value <poisonvalues>` instead.
534- unsigned no_infs : 1 ;
535- // / No Signed Zeros - Allow optimizations to treat the sign of a zero
536- // / argument or result as insignificant.
537- unsigned no_signed_zeros : 1 ;
538- // / Allow Reciprocal - Allow optimizations to use the reciprocal
539- // / of an argument rather than perform division.
540- unsigned allow_reciprocal : 1 ;
541- // / Approximate functions - Allow substitution of approximate calculations
542- // / for functions (sin, log, sqrt, etc).
543- unsigned approx_func : 1 ;
544474};
545475
546476// / Describes the kind of translation unit being processed.
0 commit comments