sage3basic.h

Go to the documentation of this file.
00001 /*
00002  * this includes the forward declarations of all the sage node classes
00003  * from the generated files (i.e. gives just the class names.)
00004  *
00005  */
00006 
00007 #ifndef SAGE3_CLASSES_BASIC__H
00008 #define SAGE3_CLASSES_BASIC__H
00009 
00010 // DQ (11/12/2011): This is support to reduce the size of ROSE so that I can manage development on my laptop.
00011 // This option defines a subset of ROSE as required to support wotk on the new EDG front-end.
00012 // This is defined here becasuse it is not enough to define it in the rose_config.h
00013 // because that can't be read early enough to effect what header files are included.
00014 // #define ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
00015 
00016 // Much of ROSE's binary support uses the intX_t and uintX_t types (where X is a bit width), so we need to have the stdc printf
00017 // format macros defined for portability.  We do that here because it needs to be done before <inttypes.h> is included for the
00018 // first time, and we know that most source files for the ROSE library include this file (sage3basic.h) at or near the
00019 // beginning.  We don't want to define __STDC_FORMAT_MACROS in user code that includes "rose.h" (the user may define it), and
00020 // we need to define it in such a way that we won't get warning's if its already defined.  [RMP 2012-01-29]
00021 #ifndef __STDC_FORMAT_MACROS
00022 #define __STDC_FORMAT_MACROS
00023 #endif
00024 #include <inttypes.h>
00025 
00026 
00027 #include <semaphore.h>
00028 #include "fileoffsetbits.h"
00029 #include "rosedll.h"
00030 //tps (05/04/2010): Added compatibility
00031 #ifdef _MSC_VER
00032   #define snprintf _snprintf
00033 #endif
00034 
00035 // George Vulov (Aug. 23, 2010): This macro is not available in OS X by default
00036 #ifndef TEMP_FAILURE_RETRY
00037 #define TEMP_FAILURE_RETRY(expression) \
00038     ({ \
00039         long int _result; \
00040         do _result = (long int) (expression); \
00041         while (_result == -1L && errno == EINTR); \
00042         _result; \
00043     })
00044 #endif
00045 
00046 // DQ (4/21/2009): Note that this header file will include the STL string header file 
00047 // which will include sys/stat.h, so the _FILE_OFFSET_BITS macro must be already set 
00048 // to avoid an ODR violation when using ROSE on 32-bit systems.
00049 // DQ (11/10/2007): Added support for ROSE specific paths to be available. These are 
00050 // useful for tools built using ROSE, they are not presently being used within ROSE.
00051 // RPM (8/22/2008): Commented out because it contains info that prevents us from making
00052 // optimal use of ccache. "rose_paths.h" contains info that changes every time we
00053 // configure. Can it be included at a finer granularity than this?
00054 // DQ (8/25/2008): Turn this back on since it breaks ROSE for everyone else.  We 
00055 // are searching for a better solution.
00056 #include "rose_paths.h"
00057 
00058 
00059 // DQ (5/30/2004): Added to permit warnings to be placed in the source code so that
00060 // issues can be addressed later but called out during development (and eliminated
00061 // from the final released version of the source code).
00062 #define PRINT_DEVELOPER_WARNINGS 0
00063 // #define PRINT_DEVELOPER_WARNINGS 1
00064 
00065 // Part of debuging use of SUN 6.1 compiler
00066 #if defined(__WIN32__) || defined (__WIN16__)
00067 #error "WIN macros should not be defined (test in sage3.h)"
00068 #endif
00069 
00070 // Part of debuging use of SUN 6.1 compiler
00071 #if defined(__MSDOS__) && defined(_Windows)
00072 #error "MSDOS macros should not be defined"
00073 #endif
00074 
00075 // DQ (4/21/2009): Added test to debug use of _FILE_OFFSET_BITS macro in controling size of "struct stat"
00076 // #if defined(_FILE_OFFSET_BITS)
00077 // #warning "The _FILE_OFFSET_BITS macro should not be set yet!"
00078 // #endif
00079 
00080 // DQ (4/21/2009): This macro is set too late!
00081 // Force 64-bit file offsets in struct stat
00082 // #define _FILE_OFFSET_BITS 64
00083 #include <sys/stat.h>
00084 
00085 //#include <cstdlib> // For abort()
00086 #include <algorithm>
00087 #include <fstream>
00088 
00089 // DQ (9/24/2004): Try again to remove use of set parent side effect in EDG/Sage III connection! This works!!!
00090 #define REMOVE_SET_PARENT_FUNCTION
00091 
00092 // DQ (6/12/2007): Force checking for valid pointers to IR nodes being overwritten.
00093 #define DEBUG_SAGE_ACCESS_FUNCTIONS 0
00094 // DQ (6/12/2007): Force assertion test to fail such cases caught when DEBUG_SAGE_ACCESS_FUNCTIONS == 1, else just report error.
00095 #define DEBUG_SAGE_ACCESS_FUNCTIONS_ASSERTION 0
00096 
00097 // DQ (10/12/2004): Remove the resetTemplateName() from use within the EDG/Sage connection
00098 // because it will (where required) force calls to generate the qualified name which
00099 // requires the parent pointer to have already been set.  Since we defer the 
00100 // setting of the parent pointers until post processing of the Sage III AST.
00101 // It is now called within the AstFixup.C.
00102 #define USE_RESET_TEMPLATE_NAME false
00103 
00104 #if 0
00105 // DQ (5/22/2005):
00106 // This is often turned of during development because it is annoying (until we can actually 
00107 // remove numerous functions where they are declared).  Also not clear what versions of GNU 
00108 // support it.
00109 
00110 // Use the new GNU attribute mechanism to add more information to the source code
00111 // By specifying funcations and variables as depreicated we can start the remove
00112 // some functions and data members from Sage III.
00113 #define ROSE_DEPRECATED_FUNCTION __attribute__ ((deprecated))
00114 #define ROSE_DEPRECATED_VARIABLE __attribute__ ((deprecated))
00115 #else
00116 // DQ (9/8/2004): Allow these to get turned of to simplify debugging while we have not yet removed their use.
00117 #define ROSE_DEPRECATED_FUNCTION 
00118 #define ROSE_DEPRECATED_VARIABLE 
00119 #endif
00120 
00121 // DQ (12/22/2007): Name of implicit Fortran "main" when building the program function.
00122 #define ROSE_IMPLICIT_FORTRAN_PROGRAM_NAME "rose_fortran_main"
00123 
00124 // DQ (10/6/2004): We have tracked down and noted all locations where a Sage III member function modifies its input parameters.
00125 // The locations where this happens are marked with a print statement which this macro permits us to turn off when we want to
00126 // either make an intermediate release of just not see the warning messages.  Many side-effects have been removed and some are 
00127 // pending more details discussions internally.  I would like to goal to be a simple rule that input parameters to constructors
00128 // are not modified by the constructor or any function called within the constructor body.  A stronger rule would be that the
00129 // input parameters to any access function which gets and data member of sets a data member would not modified its input 
00130 // parameters. Same idea but applied to all access functions, not just constructors.  It is not clear if we need go further.
00131 // Clearly it might be important to have some function that modify their input parameters but a simple design would disallow it!
00132 #define PRINT_SIDE_EFFECT_WARNINGS false
00133 
00134 
00135 // DQ (10/21/2004): We require a relaxed level of internal error checking for manually generated AST fragments!
00136 // This is required for get through the current regression tests associated with the loop processing code which
00137 // does not follwo the new rules for what qualifies as a valid AST.  Time is needed for the AST Interface code 
00138 // to be adapted to the new rules.  Not clear how this will effect the unparser!!!
00139 // In the future we want to make this value "TRUE" this is a work around until then.
00140 #ifdef _MSC_VER
00141 #define STRICT_ERROR_CHECKING 0
00142 #else
00143 #define STRICT_ERROR_CHECKING false
00144 #endif
00145 
00146 // DQ (11/7/2007): Reimplementation of "fixup" support for the AST copy mechanism.
00147 // This version separates the fixup into three phases:
00148 // Use three files to organize the separate functions (parent/scope setup, symbol table setup, and symbol references).
00149 // Order of operations:
00150 //    1) Setup scopes on all declaration (e.g. SgInitializedName objects).
00151 //    2) Setup the symbol table.
00152 //        template instantiations must be added to to the symbol tables as defined by their scope
00153 //        because they may be located outside of their scope (indicated by their template declaration).
00154 //        We might need a test and set policy.
00155 //        Use the help map to support error checking in the symbol table construction.  Check that 
00156 //        scopes are not in the original AST (not keys in the help map).
00157 //    3) Setup the references (SgVarRefExp objects pointers to SgVariableSymbol objects) 
00158 #define ALT_FIXUP_COPY 1
00159 
00160 
00161 // AJ (10/21/2004) : the current version of g++ 3.2.3 has the "hash_map" deprecated - this
00162 // deprecated hash_map is // in the global namespace and generates a warning every time
00163 // the file gets included. The "ext/hash_map" is the newer version of the hash_map but
00164 // it is no longer in the global namespace or std ( since the hash_map is not part of
00165 // the standard STL) but in the compiler specific namespace (__gnu_cxx). Because of this,
00166 // we have opted for using the newer version and explicitly using the namespace __gnu_cxx
00167 // See below the using namespace section. If there is a need to change this to a more 
00168 // standard include "hash_map", please make sure you have selected the right namespace for 
00169 // using the hash_map and modify the section below
00170 // for that.
00171 // Liao, 7/10/2009 
00172 //#if __GNUC__ > 4 ||
00173 //  (__GNUC__ == 4 && (__GNUC_MINOR__ > 3 ||
00174 //                   (__GNUC_MINOR__ == 3 &&
00175 //                    __GNUC_PATCHLEVEL__ >= 0)))
00176 //#include <unordered_map>
00177 //#else   
00178 
00179 
00180 
00181 //#endif
00182 #if 1
00183 #ifdef _MSC_VER
00184 // DQ (11/4/2009): MS Visual Studio version of hash_multimap
00185 //#include <cliext/hash_map>
00186 #else
00187 // DQ (11/4/2009): Use the GNU depricated stuff (what works in ROSE at the moment)
00188 // tps (01/25/2010) : deprecated - does not work in setup.h
00189 // CH (04/28/2010) : We don't need it anymore
00190 //#include <ext/hash_map>
00191 #endif
00192 #endif
00193 
00194 // tps (01/22/2010) :refactored
00195 #include "rosedefs.h"
00196 // Support for preprocessors declarations and comments
00197 #include "rose_attributes_list.h"
00198 
00199 // Include ROSE common utility function library
00200 #include "string_functions.h"
00201 #include "escape.h"
00202 
00203 // Include support for Brian Gunney's command line parser tool (nice work)
00204 #include "sla.h"
00205 
00206 
00207 // DQ (3/29/2006): I sure would like to remove this since it 
00208 // has a potential to effect other files from other projects
00209 // used with ROSE.
00210 // #define INLINE
00211 
00212 // DQ (9/21/2005): Support for memory pools.
00213 // This allows for a total number of IR nodes (for each type of IR node) of
00214 // (MAX_NUMBER_OF_MEMORY_BLOCKS * DEFAULT_CLASS_ALLOCATION_POOL_SIZE)
00215 // It might be better to use an STL vector here since they we don't have
00216 // an upper bound on the number of IR nodes of each type!!!
00217 // #define DEFAULT_CLASS_ALLOCATION_POOL_SIZE 1000
00218 
00219 // Typical values used to testing the AST File I/O are 1 or 2, but larger values
00220 // are required for better performance.  At some point the value should be evaluated
00221 // as even a value of 1000 is likely a bit small for larger whole applications.
00222 // #define DEFAULT_CLASS_ALLOCATION_POOL_SIZE 1000
00223 // #define DEFAULT_CLASS_ALLOCATION_POOL_SIZE 1
00224 // #define DEFAULT_CLASS_ALLOCATION_POOL_SIZE 2
00225 #define DEFAULT_CLASS_ALLOCATION_POOL_SIZE 1000
00226 
00227 // DQ (3/7/2010):Added error checking.
00228 #if DEFAULT_CLASS_ALLOCATION_POOL_SIZE < 1
00229    #error "DEFAULT_CLASS_ALLOCATION_POOL_SIZE must be greater than zero!"
00230 #endif
00231 
00232 // DQ (3/7/2010): This is no longer used (for several years) and we use an STL based implementation.
00233 // #define MAX_NUMBER_OF_MEMORY_BLOCKS        1000
00234 
00235 
00236 // DQ (9/231/2005): Map these to the C library memory alloction/deallocation functions.
00237 // These could use alternative allocators which allocate on page boundaries in the future.
00238 // This is part of the support for memory pools for the Sage III IR nodes.
00239 // #define ROSE_MALLOC malloc
00240 // #define ROSE_FREE free
00241 // DQ (9/9/2008): Don't let this be confused by a member function called "free" in Robb's work.
00242 #define ROSE_MALLOC ::malloc
00243 #define ROSE_FREE ::free
00244 
00245 // DQ (10/6/2006): Allow us to skip the support for caching so that we can measure the effects.
00246 #define SKIP_BLOCK_NUMBER_CACHING 0
00247 #define SKIP_MANGLED_NAME_CACHING 0
00248 
00249 #define USE_OLD_BINARY_EXECUTABLE_IR_NODES 0
00250 
00251 #define USING_OLD_EXECUTABLE_FORMAT_SUPPORT 0
00252 #if USING_OLD_EXECUTABLE_FORMAT_SUPPORT
00253 // DQ (12/8/2008): Build a forward declaration for the input parameter type for the 
00254 // SgAsmFileHeader class constructor.
00255 namespace Exec { namespace ELF { class ElfFileHeader; }; };
00256 #endif
00257 
00258 
00259 // DQ (12/28/2009): Moved from Cxx_Grammar.h to simplify splitting large files generated by ROSETTA.
00260 #include "AstAttributeMechanism.h"
00261 
00262 // DQ (12/29/2009): This permits the optional use of smaller generated header files for the IR.
00263 // Without this option the generated header file for the ROSE IR is nearly 300K in size, and
00264 // this can be a problem for some compilers (MSVC).  This is part of work to optionally reduce
00265 // the sizes of some of the larger ROSETTA generated files in ROSE. Later this will be controled
00266 // using a configure command line option to ROSE (at configure time).
00267 // #define ROSE_USING_SMALL_GENERATED_HEADER_FILES 1
00268 
00269 // This is an Autoconf conditional macro (so it should not be defined).
00270 #ifdef ROSE_USE_SMALLER_GENERATED_FILES
00271 // #warning "ROSE_USE_SMALLER_GENERATED_FILES is defined"
00272    #define ROSE_USING_SMALL_GENERATED_HEADER_FILES 1
00273 #endif
00274 
00275 // DQ (9/21/2005): This is the simplest way to include this here
00276 // This is the definition of the Sage III IR classes (generated header).
00277 #include <Cxx_Grammar.h>
00278 
00279 // Disable CC++ extensions (we want to support only the C++ Standard)
00280 #undef CCPP_EXTENSIONS_ALLOWED
00281 
00282 // This should be a simple include (without dependence upon ROSE_META_PROGRAM
00283 #include "utility_functions.h"
00284 
00285 // Markus Schordan: temporary fixes for Ast flaws (modified by DQ)
00286 #include <typeinfo>
00287 
00288 // DQ (12/9/2004): The name of this file has been changed to be the new location
00289 // of many future Sage III AST manipulation functions in the future.  A namespace
00290 // (SageInterface) is defined in sageInterface.h.
00291 #include "sageInterface.h"
00292 
00293 
00294 // DQ (3/29/2006): Moved Rich's support for better name mangling to a 
00295 // separate file (out of the code generation via ROSETTA).
00296 #include "manglingSupport.h"
00297 
00298 // Markus Kowarschik: we use the new mechanism of handling preprocessing info;
00299 // i.e., we output the preprocessing info attached to the AST nodes.
00300 // See the detailed explanation of the mechanisms in the beginning of file
00301 // attachPreprocessingInfo.C
00302 #define USE_OLD_MECHANISM_OF_HANDLING_PREPROCESSING_INFO 0
00303 
00304 // DQ (9/1/2006): It is currently an error to normalize the source file names stored 
00305 // in the SgProject IR node to be absolute paths if they didn't originally appear 
00306 // that way on the commandline.  We have partial support for this but it is a bug
00307 // at the moment to use this.  However, we do now (work by Andreas) normalize the
00308 // source file name when input to EDG so that all Sg_File_Info objects store an
00309 // absolute path (unless modified using a #line directive, see test2004_60.C as an 
00310 // example).  The current work is an incremental solution.
00311 #define USE_ABSOLUTE_PATHS_IN_SOURCE_FILE_LIST 0
00312 
00313 #include "RoseBin_support.h"
00314 // DQ (7/6/2005): Added to support performance analysis of ROSE.
00315 // This is located in ROSE/src/midend/astDiagnostics
00316 #include "AstPerformance.h"
00317 
00318 
00319 // DQ (4/10/2010): Moved Dwarf and Intel Pin headers to here from rose.h.
00320 // DQ (11/7/2008): Added Dwarf support to ROSE AST (applies only to binary executables generated with dwarf debugging information).
00321 #ifndef _MSC_VER
00322 // tps (11/23/2009) : Commented out right now to make progress in Windows
00323    #if USE_ROSE_DWARF_SUPPORT
00324       #include "dwarfSupport.h"
00325    #endif
00326 
00327 // DQ (3/8/2009): Added support for Intel Pin (Dynamic binary Instrumentation)
00328 // tps (11/23/2009) : Commented out right now to make progress in Windows
00329    #ifdef USE_ROSE_INTEL_PIN_SUPPORT
00330 // Note that pin.H (in it's header files) will define "TRUE" and "FALSE" as macros.
00331       #include "IntelPinSupport.h"
00332    #endif
00333 #endif
00334 
00335 #ifdef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
00336    #include "transformationSupport.h"
00337 #endif
00338 
00339 #endif
00340 
00341 
00342 
00343 

Generated on Sat May 19 00:53:07 2012 for ROSE by  doxygen 1.4.7