LLVM API Documentation

LinkTimeOptimizer.h
Go to the documentation of this file.
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 intended to be used by linkers which are C-only in
00012 // their implementation for performing LTO.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_C_LINKTIMEOPTIMIZER_H
00017 #define LLVM_C_LINKTIMEOPTIMIZER_H
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 /**
00024  * @defgroup LLVMCLinkTimeOptimizer Link Time Optimization
00025  * @ingroup LLVMC
00026  *
00027  * @{
00028  */
00029 
00030   /// This provides a dummy type for pointers to the LTO object.
00031   typedef void* llvm_lto_t;
00032 
00033   /// This provides a C-visible enumerator to manage status codes.
00034   /// This should map exactly onto the C++ enumerator LTOStatus.
00035   typedef enum llvm_lto_status {
00036     LLVM_LTO_UNKNOWN,
00037     LLVM_LTO_OPT_SUCCESS,
00038     LLVM_LTO_READ_SUCCESS,
00039     LLVM_LTO_READ_FAILURE,
00040     LLVM_LTO_WRITE_FAILURE,
00041     LLVM_LTO_NO_TARGET,
00042     LLVM_LTO_NO_WORK,
00043     LLVM_LTO_MODULE_MERGE_FAILURE,
00044     LLVM_LTO_ASM_FAILURE,
00045 
00046     //  Added C-specific error codes
00047     LLVM_LTO_NULL_OBJECT
00048   } llvm_lto_status_t;
00049 
00050   /// This provides C interface to initialize link time optimizer. This allows
00051   /// linker to use dlopen() interface to dynamically load LinkTimeOptimizer.
00052   /// extern "C" helps, because dlopen() interface uses name to find the symbol.
00053   extern llvm_lto_t llvm_create_optimizer(void);
00054   extern void llvm_destroy_optimizer(llvm_lto_t lto);
00055 
00056   extern llvm_lto_status_t llvm_read_object_file
00057     (llvm_lto_t lto, const char* input_filename);
00058   extern llvm_lto_status_t llvm_optimize_modules
00059     (llvm_lto_t lto, const char* output_filename);
00060 
00061 /**
00062  * @}
00063  */
00064 
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068 
00069 #endif