@@ -312,8 +312,6 @@ class LangOptions : public LangOptionsBase {
312312 // / SYCL integration header to be generated by the device compiler
313313 std::string SYCLIntHeader;
314314
315- bool denormalIsIEEE = false ;
316-
317315 LangOptions ();
318316
319317 // Define accessors/mutators for language options of enumeration type.
@@ -387,33 +385,28 @@ class FPOptions {
387385 using RoundingMode = llvm::RoundingMode;
388386
389387public:
390- FPOptions ()
391- : fp_contract(LangOptions::FPC_Off), fenv_access(LangOptions::FEA_Off),
392- rounding (LangOptions::FPR_ToNearest),
393- exceptions(LangOptions::FPE_Ignore), allow_reassoc( 0 ), no_nans( 0 ),
394- no_infs( 0 ), no_signed_zeros( 0 ), allow_reciprocal( 0 ), approx_func( 0 ) {}
388+ FPOptions () : fp_contract(LangOptions::FPC_Off),
389+ fenv_access (LangOptions::FEA_Off),
390+ rounding(LangOptions::FPR_ToNearest),
391+ exceptions(LangOptions::FPE_Ignore)
392+ {}
395393
396394 // Used for serializing.
397- explicit FPOptions (unsigned I) { getFromOpaqueInt (I); }
395+ explicit FPOptions (unsigned I)
396+ : fp_contract(I & 3 ),
397+ fenv_access((I >> 2 ) & 1),
398+ rounding ((I >> 3 ) & 7),
399+ exceptions ((I >> 6 ) & 3)
400+ {}
398401
399402 explicit FPOptions (const LangOptions &LangOpts)
400403 : fp_contract(LangOpts.getDefaultFPContractMode()),
401404 fenv_access(LangOptions::FEA_Off),
402- rounding(static_cast <unsigned >(LangOpts.getFPRoundingMode())),
403- exceptions(LangOpts.getFPExceptionMode()),
404- allow_reassoc(LangOpts.FastMath || LangOpts.AllowFPReassoc),
405- no_nans(LangOpts.FastMath || LangOpts.NoHonorNaNs),
406- no_infs(LangOpts.FastMath || LangOpts.NoHonorInfs),
407- no_signed_zeros(LangOpts.FastMath || LangOpts.NoSignedZero),
408- allow_reciprocal(LangOpts.FastMath || LangOpts.AllowRecip),
409- approx_func(LangOpts.FastMath || LangOpts.ApproxFunc) {}
405+ rounding(LangOptions::FPR_ToNearest),
406+ exceptions(LangOptions::FPE_Ignore)
407+ {}
410408 // FIXME: Use getDefaultFEnvAccessMode() when available.
411409
412- void setFastMath (bool B = true ) {
413- allow_reassoc = no_nans = no_infs = no_signed_zeros = approx_func =
414- allow_reciprocal = B;
415- }
416-
417410 // / Return the default value of FPOptions that's used when trailing
418411 // / storage isn't required.
419412 static FPOptions defaultWithoutTrailingStorage (const LangOptions &LO);
@@ -448,18 +441,6 @@ class FPOptions {
448441 fenv_access = LangOptions::FEA_On;
449442 }
450443
451- void setFPPreciseEnabled (bool Value) {
452- if (Value) {
453- /* Precise mode implies fp_contract=on and disables ffast-math */
454- setFastMath (false );
455- setAllowFPContractWithinStatement ();
456- } else {
457- /* Precise mode implies fp_contract=fast and enables ffast-math */
458- setFastMath (true );
459- setAllowFPContractAcrossStatement ();
460- }
461- }
462-
463444 void setDisallowFEnvAccess () { fenv_access = LangOptions::FEA_Off; }
464445
465446 RoundingMode getRoundingMode () const {
@@ -478,22 +459,6 @@ class FPOptions {
478459 exceptions = EM;
479460 }
480461
481- // / FMF Flag queries
482- bool allowAssociativeMath () const { return allow_reassoc; }
483- bool noHonorNaNs () const { return no_nans; }
484- bool noHonorInfs () const { return no_infs; }
485- bool noSignedZeros () const { return no_signed_zeros; }
486- bool allowReciprocalMath () const { return allow_reciprocal; }
487- bool allowApproximateFunctions () const { return approx_func; }
488-
489- // / Flag setters
490- void setAllowAssociativeMath (bool B = true ) { allow_reassoc = B; }
491- void setNoHonorNaNs (bool B = true ) { no_nans = B; }
492- void setNoHonorInfs (bool B = true ) { no_infs = B; }
493- void setNoSignedZeros (bool B = true ) { no_signed_zeros = B; }
494- void setAllowReciprocalMath (bool B = true ) { allow_reciprocal = B; }
495- void setAllowApproximateFunctions (bool B = true ) { approx_func = B; }
496-
497462 bool isFPConstrained () const {
498463 return getRoundingMode () != RoundingMode::NearestTiesToEven ||
499464 getExceptionMode () != LangOptions::FPE_Ignore ||
@@ -503,23 +468,7 @@ class FPOptions {
503468 // / Used to serialize this.
504469 unsigned getAsOpaqueInt () const {
505470 return fp_contract | (fenv_access << 2 ) | (rounding << 3 ) |
506- (exceptions << 6 ) | (allow_reassoc << 8 ) | (no_nans << 9 ) |
507- (no_infs << 10 ) | (no_signed_zeros << 11 ) |
508- (allow_reciprocal << 12 ) | (approx_func << 13 );
509- }
510-
511- // / Used with getAsOpaqueInt() to manage the float_control pragma stack.
512- void getFromOpaqueInt (unsigned I) {
513- fp_contract = (static_cast <LangOptions::FPContractModeKind>(I & 3 ));
514- fenv_access = (static_cast <LangOptions::FEnvAccessModeKind>((I >> 2 ) & 1 ));
515- rounding = static_cast <unsigned >(static_cast <RoundingMode>((I >> 3 ) & 7 ));
516- exceptions = (static_cast <LangOptions::FPExceptionModeKind>((I >> 6 ) & 3 ));
517- allow_reassoc = ((I >> 8 ) & 1 );
518- no_nans = ((I >> 9 ) & 1 );
519- no_infs = ((I >> 10 ) & 1 );
520- no_signed_zeros = ((I >> 11 ) & 1 );
521- allow_reciprocal = ((I >> 12 ) & 1 );
522- approx_func = ((I >> 13 ) & 1 );
471+ (exceptions << 6 );
523472 }
524473
525474private:
@@ -530,25 +479,6 @@ class FPOptions {
530479 unsigned fenv_access : 1 ;
531480 unsigned rounding : 3 ;
532481 unsigned exceptions : 2 ;
533- // / Allow reassociation transformations for floating-point instructions.
534- unsigned allow_reassoc : 1 ;
535- // / No NaNs - Allow optimizations to assume the arguments and result
536- // / are not NaN. If an argument is a nan, or the result would be a nan,
537- // / it produces a :ref:`poison value <poisonvalues>` instead.
538- unsigned no_nans : 1 ;
539- // / No Infs - Allow optimizations to assume the arguments and result
540- // / are not +/-Inf. If an argument is +/-Inf, or the result would be +/-Inf,
541- // / it produces a :ref:`poison value <poisonvalues>` instead.
542- unsigned no_infs : 1 ;
543- // / No Signed Zeros - Allow optimizations to treat the sign of a zero
544- // / argument or result as insignificant.
545- unsigned no_signed_zeros : 1 ;
546- // / Allow Reciprocal - Allow optimizations to use the reciprocal
547- // / of an argument rather than perform division.
548- unsigned allow_reciprocal : 1 ;
549- // / Approximate functions - Allow substitution of approximate calculations
550- // / for functions (sin, log, sqrt, etc).
551- unsigned approx_func : 1 ;
552482};
553483
554484// / Describes the kind of translation unit being processed.
0 commit comments