From 67d135ae40b121a138e334a175d0e02dbb54eeca Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Mon, 12 Aug 2013 18:29:43 +0000 Subject: Misc enhancements to LTO: 1. Add some helper classes for partitions. They are designed in a way such that the top-level LTO driver will not see much difference with or without partitioning. 2. Introduce work-dir. Now all intermediate files generated during LTO phases will be saved under work-dir. User can specify the workdir via -lto-workdir=/path/to/dir. By default the work-dir will be erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1. TODO: Erase the workdir, if the linker exit prematurely. We are currently not able to remove directory on signal. The support routines simply ignore directory. 3. Add one new API lto_codegen_get_files_need_remove(). Linker and LTO plugin will communicate via this API about which files (including directories) need to removed before linker exit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188188 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lto/LTOPostIPODriver.h | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tools/lto/LTOPostIPODriver.h (limited to 'tools/lto/LTOPostIPODriver.h') diff --git a/tools/lto/LTOPostIPODriver.h b/tools/lto/LTOPostIPODriver.h new file mode 100644 index 0000000000..c1813b9989 --- /dev/null +++ b/tools/lto/LTOPostIPODriver.h @@ -0,0 +1,52 @@ +//===---------- LTOPostIPODriver.h - PostIPO Driver -----------------------===// +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declare the PostIPODriver class which is the driver for +// Post-IPO compilation phase. +// +//===----------------------------------------------------------------------===// + +#ifndef LTO_POSTIPO_DRIVER_H +#define LTO_POSTIPO_DRIVER_H + +#include "llvm/Target/TargetMachine.h" + +namespace lto { + class IPOPartMgr; + class IPOFileMgr; + class IPOFile; + + class PostIPODriver { + public: + typedef enum { + PIDV_Invalid, + PIDV_SERIAL, // No partition + PIDV_MultiThread, // Each partition is compiled by a thread + PIDV_MultiProc, // Each partition is compiled by a process + PIDV_MakeUtil // Partitions compilation is driven by a make-utility + } VariantTy; + + PostIPODriver(VariantTy Var, TargetMachine *TM, IPOPartMgr &IPM, + IPOFileMgr &IFM, bool ToMergeObjs = false); + + // Return the single resulting object file. If there is no prior + // compilation failure, this function may return NULL iff: + // 1) Partition is enabled, and + // 2) Multiple partitions are generated, and + // 3) It is not asked to merge together the objects corresponding to the + // the partions. + IPOFile *getSingleObjFile() const; + + bool Compile(std::string &ErrMsg); + + private: + void *DrvImpl; + VariantTy DrvStyle; + }; +} + +#endif // LTO_POSTIPO_DRIVER_H -- cgit v1.2.3