00001 #ifndef BACKEND_HXX 00002 #define BACKEND_HXX 00003 00004 /************************************************************************** 00005 * 00006 * Copyright (C) 2008, Johns Hopkins University. 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or 00010 * without modification, are permitted provided that the following 00011 * conditions are met: 00012 * 00013 * - Redistributions of source code must contain the above 00014 * copyright notice, this list of conditions, and the following 00015 * disclaimer. 00016 * 00017 * - Redistributions in binary form must reproduce the above 00018 * copyright notice, this list of conditions, and the following 00019 * disclaimer in the documentation and/or other materials 00020 * provided with the distribution. 00021 * 00022 * - Neither the names of the copyright holders nor the names of any 00023 * of any contributors may be used to endorse or promote products 00024 * derived from this software without specific prior written 00025 * permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00028 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00029 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00030 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00031 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00032 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00033 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00034 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00035 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00036 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00037 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 **************************************************************************/ 00040 00041 #include <iostream> 00042 #include "UocInfo.hxx" 00043 #include "AST.hxx" 00044 00053 typedef bool (*BackEndFn) (std::ostream& out, std::ostream& err, 00054 boost::shared_ptr<UocInfo> uoc); 00055 00056 typedef bool (*MidEndFn) (std::ostream& out, std::ostream& err); 00057 00058 00059 /* @brief Emit output in XML pretty-printed form. 00060 * 00061 * This target has not been maintained in a long time, and should 00062 * probably be dropped. 00063 */ 00064 bool XMLpp(std::ostream& out, std::ostream& err, boost::shared_ptr<UocInfo> uoc); 00065 /* Dump output in not-so-pretty XML form. 00066 * 00067 * This target has not been maintained in a long time, and should 00068 * probably be dropped. 00069 */ 00070 bool XMLdump(std::ostream& out, std::ostream& err, boost::shared_ptr<UocInfo> uoc); 00071 00072 /* @brief Emit output in XML pretty-printed form, including types */ 00073 bool XMLtypesPP(std::ostream& out, std::ostream& err, boost::shared_ptr<UocInfo> uoc); 00074 00075 /* @brief Emit a C header file containing the externalizable 00076 * declarations from every interface that was referenced by the input 00077 * units of compilation. 00078 */ 00079 bool EmitHeader(std::ostream& out, std::ostream& err, 00080 boost::shared_ptr<UocInfo> uoc); 00081 00082 /* @brief Emit a C source file that is the whole-program compilation 00083 * result for all input source files. 00084 * 00085 * The C file will include only those procedures that are reachable 00086 * from the entry points. 00087 */ 00088 bool EmitC(std::ostream& out, std::ostream& err, boost::shared_ptr<UocInfo> uoc); 00089 00090 /* @brief Emit a C source file as in EmitC, and compile the result to 00091 * an execuitable. 00092 */ 00093 bool EmitExe(std::ostream& out, std::ostream& err, boost::shared_ptr<UocInfo> uoc); 00094 00095 /* @brief Gather all of ths source units of compilation mentioned on 00096 * the command line into a quasi-archive file. 00097 * 00098 * This is a mid-end pass! 00099 */ 00100 bool EmitBitO(std::ostream& out, std::ostream& err); 00101 00102 struct BackEnd { 00104 std::string name; 00107 Pass needPass; 00111 OnePass oPass; 00114 BackEndFn fn; 00117 MidEndFn midfn; 00120 BackEndFn plfn; 00121 00123 unsigned long flags; 00124 00126 static size_t nBackEnd; 00129 static BackEnd backends[]; 00130 }; 00131 00137 #define BK_HDR_MODE 0x001u 00138 00143 #define BK_UOC_MODE 0x002u 00144 00148 #define BK_LINKING 0x004u 00149 00150 #endif /* BACKEND_HXX */
1.4.7