Implement -cl-unsafe-math-optimizations

llvm-svn: 120879
This commit is contained in:
Peter Collingbourne 2010-12-04 01:51:14 +00:00
parent 0ba5ac8544
commit b8d9995c0e
4 changed files with 6 additions and 0 deletions

View File

@ -603,3 +603,5 @@ def cl_single_precision_constant : Flag<"-cl-single-precision-constant">,
HelpText<"OpenCL only. Treat double precision floating-point constant as single precision constant.">; HelpText<"OpenCL only. Treat double precision floating-point constant as single precision constant.">;
def cl_finite_math_only : Flag<"-cl-finite-math-only">, def cl_finite_math_only : Flag<"-cl-finite-math-only">,
HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">; HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">;
def cl_unsafe_math_optimizations : Flag<"-cl-unsafe-math-optimizations">,
HelpText<"OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable">;

View File

@ -75,6 +75,7 @@ public:
unsigned UnitAtATime : 1; /// Unused. For mirroring GCC optimization unsigned UnitAtATime : 1; /// Unused. For mirroring GCC optimization
/// selection. /// selection.
unsigned UnrollLoops : 1; /// Control whether loops are unrolled. unsigned UnrollLoops : 1; /// Control whether loops are unrolled.
unsigned UnsafeFPMath : 1; /// Allow unsafe floating point optzns.
unsigned UnwindTables : 1; /// Emit unwind tables. unsigned UnwindTables : 1; /// Emit unwind tables.
unsigned VerifyModule : 1; /// Control whether the module should be run unsigned VerifyModule : 1; /// Control whether the module should be run
/// through the LLVM Verifier. /// through the LLVM Verifier.
@ -139,6 +140,7 @@ public:
TimePasses = 0; TimePasses = 0;
UnitAtATime = 1; UnitAtATime = 1;
UnrollLoops = 0; UnrollLoops = 0;
UnsafeFPMath = 0;
UnwindTables = 0; UnwindTables = 0;
VerifyModule = 1; VerifyModule = 1;

View File

@ -186,6 +186,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
llvm::NoInfsFPMath = CodeGenOpts.NoInfsFPMath; llvm::NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
llvm::NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath; llvm::NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS; NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
llvm::UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
llvm::UseSoftFloat = CodeGenOpts.SoftFloat; llvm::UseSoftFloat = CodeGenOpts.SoftFloat;
UnwindTablesMandatory = CodeGenOpts.UnwindTables; UnwindTablesMandatory = CodeGenOpts.UnwindTables;

View File

@ -903,6 +903,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.RelaxAll = Args.hasArg(OPT_mrelax_all); Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer); Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
Opts.SoftFloat = Args.hasArg(OPT_msoft_float); Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
Opts.UnsafeFPMath = Args.hasArg(OPT_cl_unsafe_math_optimizations);
Opts.UnwindTables = Args.hasArg(OPT_munwind_tables); Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic"); Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");