LLVM API Documentation
00001 //===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This header provides a C API to use the LLVM link time optimization 00011 // library. This is inteded to be used by linkers which are C-only in 00012 // their implementation for performing LTO. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef __LTO_CAPI_H__ 00017 #define __LTO_CAPI_H__ 00018 00019 #ifdef __cplusplus 00020 extern "C" { 00021 #endif 00022 00023 /// This provides a dummy type for pointers to the LTO object. 00024 typedef void* llvm_lto_t; 00025 00026 /// This provides a C-visible enumerator to manage status codes. 00027 /// This should map exactly onto the C++ enumerator LTOStatus. 00028 typedef enum llvm_lto_status { 00029 LLVM_LTO_UNKNOWN, 00030 LLVM_LTO_OPT_SUCCESS, 00031 LLVM_LTO_READ_SUCCESS, 00032 LLVM_LTO_READ_FAILURE, 00033 LLVM_LTO_WRITE_FAILURE, 00034 LLVM_LTO_NO_TARGET, 00035 LLVM_LTO_NO_WORK, 00036 LLVM_LTO_MODULE_MERGE_FAILURE, 00037 LLVM_LTO_ASM_FAILURE, 00038 00039 // Added C-specific error codes 00040 LLVM_LTO_NULL_OBJECT 00041 } llvm_lto_status_t; 00042 00043 /// This provides C interface to initialize link time optimizer. This allows 00044 /// linker to use dlopen() interface to dynamically load LinkTimeOptimizer. 00045 /// extern "C" helps, because dlopen() interface uses name to find the symbol. 00046 extern llvm_lto_t llvm_create_optimizer(void); 00047 extern void llvm_destroy_optimizer(llvm_lto_t lto); 00048 00049 extern llvm_lto_status_t llvm_read_object_file 00050 (llvm_lto_t lto, const char* input_filename); 00051 extern llvm_lto_status_t llvm_optimize_modules 00052 (llvm_lto_t lto, const char* output_filename); 00053 00054 #ifdef __cplusplus 00055 } 00056 #endif 00057 00058 #endif