1 //===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface -------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This header provides a C API to use the LLVM link time optimization 11 // library. This is intended to be used by linkers which are C-only in 12 // their implementation for performing LTO. 13 // 14 //===----------------------------------------------------------------------===// 15 16 module llvm.c.linkTimeOptimizer; 17 18 extern(C) nothrow: 19 20 /** 21 * @defgroup LLVMCLinkTimeOptimizer Link Time Optimization 22 * @ingroup LLVMC 23 * 24 * @{ 25 */ 26 27 /// This provides a dummy type for pointers to the LTO object. 28 alias llvm_lto_t = void*; 29 30 /// This provides a C-visible enumerator to manage status codes. 31 /// This should map exactly onto the C++ enumerator LTOStatus. 32 enum llvm_lto_status { 33 UNKNOWN, 34 OPT_SUCCESS, 35 READ_SUCCESS, 36 READ_FAILURE, 37 WRITE_FAILURE, 38 NO_TARGET, 39 NO_WORK, 40 MODULE_MERGE_FAILURE, 41 ASM_FAILURE, 42 43 // Added C-specific error codes 44 NULL_OBJECT 45 } 46 alias llvm_lto_status_t = llvm_lto_status; 47 48 /// This provides C interface to initialize link time optimizer. This allows 49 /// linker to use dlopen() interface to dynamically load LinkTimeOptimizer. 50 /// extern "C" helps, because dlopen() interface uses name to find the symbol. 51 extern llvm_lto_t llvm_create_optimizer(); 52 extern void llvm_destroy_optimizer(llvm_lto_t lto); 53 54 extern llvm_lto_status_t llvm_read_object_file 55 (llvm_lto_t lto, const(char)* input_filename); 56 extern llvm_lto_status_t llvm_optimize_modules 57 (llvm_lto_t lto, const(char)* output_filename); 58 59 /** 60 * @} 61 */