[cfe-commits] r66972 - in /cfe/trunk: Driver/clang.cpp include/clang/AST/Builtins.h include/clang/Basic/LangOptions.h lib/AST/ASTContext.cpp lib/AST/Builtins.cpp
Chris Lattner
sabre at nondot.org
Fri Mar 13 15:38:49 PDT 2009
Author: lattner
Date: Fri Mar 13 17:38:49 2009
New Revision: 66972
URL: http://llvm.org/viewvc/llvm-project?rev=66972&view=rev
Log:
wire up a new -fno-builtin option, make it control things like simplifylibcalls,
etc and make freestanding imply it.
Modified:
cfe/trunk/Driver/clang.cpp
cfe/trunk/include/clang/AST/Builtins.h
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/Builtins.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=66972&r1=66971&r2=66972&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Mar 13 17:38:49 2009
@@ -231,6 +231,11 @@
"freestanding environment"));
static llvm::cl::opt<bool>
+NoBuiltin("fno-builtin",
+ llvm::cl::desc("Disable implicit builtin knowledge of functions"));
+
+
+static llvm::cl::opt<bool>
MathErrno("fmath-errno",
llvm::cl::desc("Require math functions to respect errno"),
llvm::cl::init(true), llvm::cl::AllowInverse);
@@ -650,8 +655,11 @@
if (EnableBlocks.getPosition())
Options.Blocks = EnableBlocks;
+ if (NoBuiltin)
+ Options.NoBuiltin = 1;
if (Freestanding)
- Options.Freestanding = 1;
+ Options.Freestanding = Options.NoBuiltin = 1;
+
if (EnableHeinousExtensions)
Options.HeinousExtensions = 1;
@@ -1195,7 +1203,7 @@
// FIXME: There are llvm-gcc options to control these selectively.
Opts.InlineFunctions = (Opts.OptimizationLevel > 1);
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
- Opts.SimplifyLibCalls = !Freestanding;
+ Opts.SimplifyLibCalls = !NoBuiltin;
#ifdef NDEBUG
Opts.VerifyModule = 0;
Modified: cfe/trunk/include/clang/AST/Builtins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Builtins.h?rev=66972&r1=66971&r2=66972&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Builtins.h (original)
+++ cfe/trunk/include/clang/AST/Builtins.h Fri Mar 13 17:38:49 2009
@@ -56,7 +56,7 @@
/// appropriate builtin ID # and mark any non-portable builtin identifiers as
/// such.
void InitializeBuiltins(IdentifierTable &Table, const TargetInfo &Target,
- bool Freestanding = false);
+ bool NoBuiltins = false);
/// Builtin::GetName - Return the identifier name for the specified builtin,
/// e.g. "__builtin_abs".
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=66972&r1=66971&r2=66972&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Fri Mar 13 17:38:49 2009
@@ -48,6 +48,7 @@
unsigned NeXTRuntime : 1; // Use NeXT runtime.
unsigned Freestanding : 1; // Freestanding implementation
+ unsigned NoBuiltin : 1; // Do not use builtin functions (-fno-builtin)
unsigned ThreadsafeStatics : 1; // Whether static initializers are protected
// by locks.
@@ -75,7 +76,7 @@
GC = ObjC1 = ObjC2 = ObjCNonFragileABI = 0;
C99 = Microsoft = CPlusPlus = CPlusPlus0x = NoExtensions = 0;
CXXOperatorNames = PascalStrings = Boolean = WritableStrings = 0;
- Exceptions = NeXTRuntime = Freestanding = 0;
+ Exceptions = NeXTRuntime = Freestanding = NoBuiltin = 0;
LaxVectorConversions = 1;
HeinousExtensions = 0;
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=66972&r1=66971&r2=66972&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Mar 13 17:38:49 2009
@@ -39,7 +39,7 @@
{
if (size_reserve > 0) Types.reserve(size_reserve);
InitBuiltinTypes();
- BuiltinInfo.InitializeBuiltins(idents, Target, LangOpts.Freestanding);
+ BuiltinInfo.InitializeBuiltins(idents, Target, LangOpts.NoBuiltin);
TUDecl = TranslationUnitDecl::Create(*this);
}
Modified: cfe/trunk/lib/AST/Builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Builtins.cpp?rev=66972&r1=66971&r2=66972&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Builtins.cpp (original)
+++ cfe/trunk/lib/AST/Builtins.cpp Fri Mar 13 17:38:49 2009
@@ -38,12 +38,11 @@
/// such.
void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
const TargetInfo &Target,
- bool Freestanding) {
+ bool NoBuiltins) {
// Step #1: mark all target-independent builtins with their ID's.
for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
if (!BuiltinInfo[i].Suppressed &&
- (!Freestanding ||
- !strchr(BuiltinInfo[i].Attributes, 'f')))
+ (!NoBuiltins || !strchr(BuiltinInfo[i].Attributes, 'f')))
Table.get(BuiltinInfo[i].Name).setBuiltinID(i);
// Step #2: Get target builtins.
@@ -52,7 +51,7 @@
// Step #3: Register target-specific builtins.
for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
if (!TSRecords[i].Suppressed &&
- (!Freestanding ||
+ (!NoBuiltins ||
(TSRecords[i].Attributes &&
!strchr(TSRecords[i].Attributes, 'f'))))
Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);
More information about the cfe-commits
mailing list