[PATCH] D31114: Refactor `initTargetOptions` out of `EmitAssemblyHelper::CreateTargetMachine` and use it to initialize TargetOptions for ThinLTO Backends

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 18 08:28:36 PDT 2017


tejohnson added a comment.

I think you won't get the correct handling of -emit-llvm and -emit-llvm-bc since we don't get the handling for Backend_Emit* in EmitAssemblyHelper::EmitAssembly.



================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:595
   llvm::Optional<llvm::Reloc::Model> RM;
   RM = llvm::StringSwitch<llvm::Reloc::Model>(CodeGenOpts.RelocationModel)
            .Case("static", llvm::Reloc::Static)
----------------
What about this - it isn't used in the TargetOptions. There are a few other things passed directly to createTargetMachine below. Will -fpic get handled correctly, e.g.? Ah, looks like lto::Config has fields for that and the code model etc, that are essentially getting the default values on this path (when used via clang - that will need to be set up in lto::Config in runThinLTOBackend as well.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:982
                               std::unique_ptr<raw_pwrite_stream> OS) {
+  EmitAssemblyHelper AsmHelper(Diags, HeaderOpts, CGOpts, TOpts, LOpts, M);
+
----------------
Why did this move?


https://reviews.llvm.org/D31114





More information about the cfe-commits mailing list