aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-16 22:43:43 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-16 22:43:43 +0000
commitef2abfee3ea16ec74942dc09e9e425f46aeb2582 (patch)
treea1fd544522e1d5e2708b9b2a6df1704a0734d0bd /Driver/clang.cpp
parentf592c929bd1f083abcc8199b24bb825fdd28df1c (diff)
Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
- Define pow[lf]?, sqrt[lf]? as builtins. - Add -fmath-errno option which binds to LangOptions.MathErrno - Add new builtin flag Builtin::Context::isConstWithoutErrno for functions which can be marked as const if errno isn't respected for math functions. Sema automatically marks these functions as const when they are defined, if MathErrno=0. - IRgen uses const attribute on sqrt and pow library functions to decide if it can use the llvm intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index d1ef871d6a..d0b3dafb31 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -213,9 +213,14 @@ InheritanceViewCls("cxx-inheritance-view",
//===----------------------------------------------------------------------===//
static llvm::cl::opt<bool>
Freestanding("ffreestanding",
- llvm::cl::desc("Assert that the compiler takes place in a "
+ llvm::cl::desc("Assert that the compilation takes place in a "
"freestanding environment"));
+static llvm::cl::opt<bool>
+MathErrno("fmath-errno",
+ llvm::cl::desc("Require math functions to respect errno."),
+ llvm::cl::init(true));
+
//===----------------------------------------------------------------------===//
// Analyzer Options.
//===----------------------------------------------------------------------===//
@@ -647,6 +652,8 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
if (Freestanding)
Options.Freestanding = 1;
+ Options.MathErrno = MathErrno;
+
// Override the default runtime if the user requested it.
if (NeXTRuntime)
Options.NeXTRuntime = 1;
@@ -1238,8 +1245,7 @@ static void ParseFile(Preprocessor &PP, MinimalAction *PA) {
//===----------------------------------------------------------------------===//
static llvm::cl::opt<bool>
-OptSize("Os",
- llvm::cl::desc("Optimize for size"));
+OptSize("Os", llvm::cl::desc("Optimize for size"));
// It might be nice to add bounds to the CommandLine library directly.
struct OptLevelParser : public llvm::cl::parser<unsigned> {