From 91e96a27ab45500a0ab6cf7656a2d179f6a7e98a Mon Sep 17 00:00:00 2001 From: Jackson Woodruff Date: Mon, 27 Jan 2020 17:16:08 +0000 Subject: [PATCH] Add -fno-idl flag to disable idl. --- include/clang/Driver/Options.td | 1 + include/clang/Frontend/CodeGenOptions.def | 1 + lib/CodeGen/BackendUtil.cpp | 2 +- lib/Driver/ToolChains/Clang.cpp | 3 +++ lib/Frontend/CompilerInvocation.cpp | 4 ++++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 7da45d277490..56e4024131d6 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1361,6 +1361,7 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Group; def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; def fno_inline : Flag<["-"], "fno-inline">, Group, Flags<[CC1Option]>; +def fno_idl : Flag<["-"], "fno-idl">, Group, Flags<[CC1Option]>; def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group, HelpText<"Disables the experimental global instruction selector">; def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index a7e71f7ac016..eb765bc31c73 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -137,6 +137,7 @@ CODEGENOPT(NoTrappingMath , 1, 0) ///< Set when -fno-trapping-math is enabled CODEGENOPT(NoNaNsFPMath , 1, 0) ///< Assume FP arguments, results not NaN. CODEGENOPT(FlushDenorm , 1, 0) ///< Allow FP denorm numbers to be flushed to zero CODEGENOPT(CorrectlyRoundedDivSqrt, 1, 0) ///< -cl-fp32-correctly-rounded-divide-sqrt +CODEGENOPT(EnableIDL, 1, 1) ///< Enable IDL Pass /// When false, this attempts to generate code as if the result of an /// overflowing conversion matches the overflowing behavior of a target's native diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index c70afe03fbfe..79578410898e 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -682,7 +682,7 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM, if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (true) PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast, + if (CodeGenOpts.EnableIDL) PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast, addConstraintResearchPasses); if (!CodeGenOpts.SampleProfileFile.empty()) diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index 8e9c4c6aecb8..0c18c6306baa 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -4321,6 +4321,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_fno_inline)) CmdArgs.push_back("-fno-inline"); + if (Args.hasArg(options::OPT_fno_idl)) + CmdArgs.push_back("-fno-idl"); + if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions, options::OPT_finline_hint_functions, options::OPT_fno_inline_functions)) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 78e6babd0251..a36085430b42 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#include #include "clang/Frontend/CompilerInvocation.h" #include "TestModuleFileExtension.h" #include "clang/Basic/Builtins.h" @@ -552,6 +553,9 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Args.hasFlag(OPT_fdebug_pass_manager, OPT_fno_debug_pass_manager, /* Default */ false); + // Enable IDL unless otherwise specified. + Opts.EnableIDL = !Args.hasArg(OPT_fno_idl); + if (Arg *A = Args.getLastArg(OPT_fveclib)) { StringRef Name = A->getValue(); if (Name == "Accelerate")