#include <stdint.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <signal.h>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <getopt.h>
#include <langinfo.h>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
#include "BoostCompat.hxx"
#include <libsherpa/util.hxx>
#include "Version.hxx"
#include "UocInfo.hxx"
#include "Options.hxx"
#include "AST.hxx"
#include "backend.hxx"
#include "Instantiate.hxx"
#include "TvPrinter.hxx"
#include "MixFix.hxx"
Go to the source code of this file.
Defines | |
| #define | BITC_COMPILER_MODE 0x1u |
| #define | BITC_INTERPRETER_MODE 0x2u |
| #define | BITC_CURRENT_MODE BITC_COMPILER_MODE |
| #define | LOPT_SHOWLEX 257 |
| #define | LOPT_SHOWPARSE 258 |
| #define | LOPT_DUMPAFTER 259 |
| #define | LOPT_SHOWPASSNMS 260 |
| #define | LOPT_NOSTDINC 261 |
| #define | LOPT_NOSTDLIB 262 |
| #define | LOPT_RAW_TVARS 263 |
| #define | LOPT_FQ_TYPES 264 |
| #define | LOPT_SA_TCC 265 |
| #define | LOPT_SHOWPASSES 266 |
| #define | LOPT_PPFQNS 267 |
| #define | LOPT_DUMPTYPES 268 |
| #define | LOPT_STOPAFTER 269 |
| #define | LOPT_PPDECORATE 270 |
| #define | LOPT_SHOW_TYPES 271 |
| #define | LOPT_XML_TYPES 272 |
| #define | LOPT_NOGC 273 |
| #define | LOPT_NOPRELUDE 274 |
| #define | LOPT_HEURISTIC 275 |
| #define | LOPT_HELP 276 |
| #define | LOPT_EMIT 277 |
| #define | LOPT_SYSTEM 278 |
| #define | LOPT_NOALLOC 279 |
| #define | LOPT_MIXDEBUG 280 |
| #define | LOPT_USAGE 281 |
Functions | |
| void | help () |
| Print usage information and exit. | |
| void | fatal () |
| Cease processing after fatal error. | |
| void | AddLinkArgumentForGCC (const std::string &s) |
| Add an argument to be passed to the linker either before or after the generated BitC object file. | |
| void | AddCompileArgumentForGCC (const std::string &s) |
| Add an argument to be passed to the compiler before or after the generated BitC C file. | |
| BackEnd * | FindBackEnd (const char *nm) |
| Find the backend corresponding to the specified target type. | |
| void | handle_sigsegv (int param) |
| Catch certain memory errors that plagued us for a while in GCPtr. | |
| filesystem::path | ResolveLibPath (std::string name) |
| Resolve a library name to a path. | |
| int | main (int argc, char *argv[]) |
Variables | |
| option | longopts [] |
| static bool | SawFirstBitcInput = false |
| Record whether we have seen any BitC input file yet. | |
There are three input file extensions:
.bitc - bitc interface files .bits - bitc source files .bito - bitc "object" files.
This compiler basically operates in three modes:
This mode can be identified by the presence of the -c option on the command line. If -c is specified, no output will be emitted.
This usage can be identified by the presence of the -h option on the command line, but has no effect if -c is also specified.
Note that -h is a convenience shorthand for --lang h.
This mode can be identified by the absence of either the -c or the -h options on the command line.
Definition in file bitcc.cxx.
| void AddCompileArgumentForGCC | ( | const std::string & | s | ) |
Add an argument to be passed to the compiler before or after the generated BitC C file.
Definition at line 287 of file bitcc.cxx.
References Options::CompilePreOptionsGCC, and SawFirstBitcInput.
Referenced by main().
| void AddLinkArgumentForGCC | ( | const std::string & | s | ) |
Add an argument to be passed to the linker either before or after the generated BitC object file.
Definition at line 275 of file bitcc.cxx.
References Options::LinkPostOptionsGCC, Options::LinkPreOptionsGCC, and SawFirstBitcInput.
Referenced by main().
| void fatal | ( | ) |
| BackEnd* FindBackEnd | ( | const char * | nm | ) |
Find the backend corresponding to the specified target type.
Definition at line 300 of file bitcc.cxx.
References BackEnd::backends, and BackEnd::nBackEnd.
Referenced by main().
| void handle_sigsegv | ( | int | param | ) |
| void help | ( | ) |
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 365 of file bitcc.cxx.
References UocInfo::addAllCandidateEPs(), AddCompileArgumentForGCC(), AddLinkArgumentForGCC(), AUTOCONF_LIBDIR, Options::backEnd, BackEnd::backends, BITC_VERSION, BK_HDR_MODE, BK_LINKING, BK_UOC_MODE, UocInfo::CompileFromFile(), Options::CompilePreOptionsGCC, UocInfo::CreateUnifiedUoC(), OnePassInfo::descrip, PassInfo::descrip, Options::dumpAfterMidEnd, Options::dumpTypesAfterMidEnd, Options::entryPts, UocInfo::findAllDefForms(), FindBackEnd(), flags, BackEnd::flags, BackEnd::fn, Options::FQtypes, handle_sigsegv(), help(), Options::heuristicInference, if(), UocInfo::ifList, UocInfo::importInterface(), Options::inputs, Options::libDirs, Options::LinkPostOptionsGCC, loc, longopts, LOPT_DUMPAFTER, LOPT_DUMPTYPES, LOPT_EMIT, LOPT_FQ_TYPES, LOPT_HELP, LOPT_HEURISTIC, LOPT_MIXDEBUG, LOPT_NOALLOC, LOPT_NOGC, LOPT_NOPRELUDE, LOPT_NOSTDINC, LOPT_NOSTDLIB, LOPT_PPDECORATE, LOPT_PPFQNS, LOPT_RAW_TVARS, LOPT_SA_TCC, LOPT_SHOW_TYPES, LOPT_SHOWLEX, LOPT_SHOWPARSE, LOPT_SHOWPASSES, LOPT_SHOWPASSNMS, LOPT_STOPAFTER, LOPT_SYSTEM, LOPT_USAGE, LOPT_XML_TYPES, BackEnd::midfn, mixfix_init(), Options::mixfixDebug, OnePassInfo::name, PassInfo::name, BackEnd::needPass, Options::noAlloc, Options::noGC, Options::noPrelude, UocInfo::onePassInfo, Options::outputFileName, UocInfo::passInfo, BackEnd::plfn, Options::ppDecorate, Options::ppFQNS, Options::rawTvars, ResolveLibPath(), SawFirstBitcInput, UocInfo::searchPath, Options::show_usage, Options::showAllTccs, Options::showLex, Options::showParse, Options::showPasses, Options::showTypesUocs, UocInfo::srcList, Options::SystemDirs, Options::useStdInc, Options::useStdLib, Options::verbose, and Options::xmlTypesUocs.
| filesystem::path ResolveLibPath | ( | std::string | name | ) |
Resolve a library name to a path.
This is called when we see -lname or -l name on the command line. The name will be passed as an argument here. What we need to do here is check the currently known library paths for a resolution. If we find a file matching "libname.bita" on the search path, we add it to the list of inputs.
In some cases, -lmumble will indicate simultaneously a need to add an input file named ..../libmumble.bita and also an archive library named .../libmumble.a. This arises in libbitc, for example, where some of the library is implemented in C.
Unfortunately, this means that the absence of .../libmumble.bita does not reliably indicate an error.
Definition at line 341 of file bitcc.cxx.
References boost::filesystem::is_regular_file(), and Options::libDirs.
Referenced by main().
bool SawFirstBitcInput = false [static] |
Record whether we have seen any BitC input file yet.
This determines whether a command line link argument should be presented to the linker before or after the object file comprising the BitC portion of the program.
Definition at line 270 of file bitcc.cxx.
Referenced by AddCompileArgumentForGCC(), AddLinkArgumentForGCC(), and main().
1.4.7