llvm::cl::desc("Assert that the compilation takes place in a "
"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"),
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;
// 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;
/// 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".
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.
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;
{
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);
}
/// 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.
// 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);