[PATCH] D63978: Very early work on interface stub merger plumbing.
Puyan Lotfi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 30 10:13:57 PDT 2019
plotfi updated this revision to Diff 207224.
plotfi added a comment.
had some accidentally not-removed stray print output and/or expletives, apologies.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63978/new/
https://reviews.llvm.org/D63978
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/lib/Driver/ToolChains/Gnu.h
Index: clang/lib/Driver/ToolChains/Gnu.h
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.h
+++ clang/lib/Driver/ToolChains/Gnu.h
@@ -45,6 +45,21 @@
: Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {}
};
+namespace ifstool {
+class LLVM_LIBRARY_VISIBILITY Merger : public GnuTool {
+public:
+ Merger(const ToolChain &TC) : GnuTool("IFS::Merger", "merger", TC) {}
+
+ bool hasIntegratedCPP() const override { return false; }
+ bool isLinkJob() const override { return true; }
+
+ void ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::opt::ArgList &TCArgs,
+ const char *LinkingOutput) const override;
+};
+} // end namespace ifstool
+
/// Directly call GNU Binutils' assembler and linker.
namespace gnutools {
class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool {
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -341,6 +341,21 @@
!Args.hasArg(options::OPT_static_pie);
}
+void tools::ifstool::Merger::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+ llvm::errs() << "Construct merger job\n";
+ SmallVector<const char *, 16> CmdArgs;
+ const char *Exec = "/path/to/llvm-ifs";
+ CmdArgs.push_back("-o");
+ CmdArgs.push_back(Output.getFilename());
+ for (auto Input : Inputs)
+ CmdArgs.push_back(Input.getFilename());
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
+}
+
void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -286,7 +286,6 @@
(PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) ||
(PhaseArg = DAL.getLastArg(options::OPT_rewrite_legacy_objc)) ||
(PhaseArg = DAL.getLastArg(options::OPT__migrate)) ||
- (PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs)) ||
(PhaseArg = DAL.getLastArg(options::OPT__analyze,
options::OPT__analyze_auto)) ||
(PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
@@ -301,6 +300,10 @@
FinalPhase = phases::Assemble;
// Otherwise do everything.
+ } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs))) {
+ FinalPhase = phases::Link;
+ SkipPhases.insert(phases::Backend);
+ SkipPhases.insert(phases::Assemble);
} else
FinalPhase = phases::Link;
@@ -3900,6 +3903,9 @@
T = combineAssembleBackend(ActionChain, Inputs, CollapsedOffloadAction);
if (!T)
T = combineBackendCompile(ActionChain, Inputs, CollapsedOffloadAction);
+ if (!T && C.getArgs().getLastArg(options::OPT_emit_iterface_stubs) &&
+ isa<LinkJobAction>(BaseAction))
+ T = new tools::ifstool::Merger(TC);
if (!T) {
Inputs = BaseAction->getInputs();
T = TC.SelectTool(*BaseAction);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63978.207224.patch
Type: text/x-patch
Size: 3664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190630/0ec0d097/attachment.bin>
More information about the cfe-commits
mailing list