mirror of https://github.com/microsoft/clang.git
uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists
Stop relying on `cl::opt` to pass along the driver's decision to preserve use-lists. Create a new `-cc1` option called `-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc). Note that despite its generic name, it *doesn't* do the right thing when -emit-llvm (LLVM assembly) yet. I'll hook that up soon. This doesn't really change the behaviour of the driver. The default is still to preserve use-lists for `clang -emit-llvm` and `clang -save-temps`, and nothing else. But it stops relying on global state (and also is a nicer interface for hackers using `clang -cc1`). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d651795330
commit
dce722961a
|
@ -403,6 +403,11 @@ def migrate : Flag<["-"], "migrate">,
|
|||
HelpText<"Migrate source code">;
|
||||
}
|
||||
|
||||
def emit_llvm_uselists : Flag<["-"], "emit-llvm-uselists">,
|
||||
HelpText<"Preserve order of LLVM use-lists when serializing">;
|
||||
def no_emit_llvm_uselists : Flag<["-"], "no-emit-llvm-uselists">,
|
||||
HelpText<"Don't preserve order of LLVM use-lists when serializing">;
|
||||
|
||||
def mt_migrate_directory : Separate<["-"], "mt-migrate-directory">,
|
||||
HelpText<"Directory for temporary files produced during ARC or ObjC migration">;
|
||||
def arcmt_check : Flag<["-"], "arcmt-check">,
|
||||
|
|
|
@ -145,6 +145,8 @@ VALUE_CODEGENOPT(StackProbeSize , 32, 4096) ///< Overrides default stack
|
|||
CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information
|
||||
///< in debug info.
|
||||
|
||||
CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
|
||||
|
||||
/// The user specified number of registers to be used for integral arguments,
|
||||
/// or 0 if unspecified.
|
||||
VALUE_CODEGENOPT(NumRegisterParameters, 32, 0)
|
||||
|
|
|
@ -603,7 +603,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
|
|||
|
||||
case Backend_EmitBC:
|
||||
getPerModulePasses()->add(
|
||||
createBitcodeWriterPass(*OS, shouldPreserveBitcodeUseListOrder()));
|
||||
createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists));
|
||||
break;
|
||||
|
||||
case Backend_EmitLL:
|
||||
|
|
|
@ -2683,10 +2683,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// loading the bitcode up in 'opt' or 'llc' and running passes gives the
|
||||
// same result as running passes here. For LTO, we don't need to preserve
|
||||
// the use-list order, since serialization to bitcode is part of the flow.
|
||||
if (JA.getType() == types::TY_LLVM_BC) {
|
||||
CmdArgs.push_back("-mllvm");
|
||||
CmdArgs.push_back("-preserve-bc-uselistorder");
|
||||
}
|
||||
if (JA.getType() == types::TY_LLVM_BC)
|
||||
CmdArgs.push_back("-emit-llvm-uselists");
|
||||
}
|
||||
|
||||
// We normally speed up the clang process a bit by skipping destructors at
|
||||
|
|
|
@ -405,6 +405,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
|||
// Default Dwarf version is 4 if we are generating debug information.
|
||||
Opts.DwarfVersion = 4;
|
||||
|
||||
if (const Arg *A =
|
||||
Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
|
||||
Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_emit_llvm_uselists;
|
||||
|
||||
Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
|
||||
Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
|
||||
Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// RUN: %clang -target x86_64-apple-darwin -emit-llvm -arch x86_64 %s -### 2>&1 \
|
||||
// RUN: | FileCheck %s
|
||||
// CHECK: "-emit-llvm-bc"
|
||||
// CHECK: "-preserve-bc-uselistorder"
|
||||
// CHECK: "-emit-llvm-uselists"
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin -flto -arch x86_64 %s -### 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=LTO %s
|
||||
// LTO: "-emit-llvm-bc"
|
||||
// LTO-NOT: "-preserve-bc-uselistorder"
|
||||
// LTO-NOT: "-emit-llvm-uselists"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \
|
||||
// RUN: | FileCheck %s
|
||||
// CHECK: "-o" "save-temps.i"
|
||||
// CHECK: "-preserve-bc-uselistorder"
|
||||
// CHECK: "-emit-llvm-uselists"
|
||||
// CHECK: "-disable-llvm-optzns"
|
||||
// CHECK: "-o" "save-temps.bc"
|
||||
// CHECK: "-o" "save-temps.s"
|
||||
|
@ -13,7 +13,7 @@
|
|||
// RUN: %clang -target x86_64-apple-darwin -save-temps=cwd -arch x86_64 %s -### 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=CWD
|
||||
// CWD: "-o" "save-temps.i"
|
||||
// CWD: "-preserve-bc-uselistorder"
|
||||
// CWD: "-emit-llvm-uselists"
|
||||
// CWD: "-disable-llvm-optzns"
|
||||
// CWD: "-o" "save-temps.bc"
|
||||
// CWD: "-o" "save-temps.s"
|
||||
|
|
Loading…
Reference in New Issue