Intel SPMD Program Compiler  1.12.0
Classes | Macros | Functions
main.cpp File Reference

main() entrypoint implementation for ispc More...

#include "ispc.h"
#include "module.h"
#include "type.h"
#include "util.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <llvm/Support/Debug.h>
#include <llvm/Support/Signals.h>
#include <llvm/Support/TargetRegistry.h>
#include <llvm/Support/TargetSelect.h>
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

class  ArgFactory
 
class  FileArgFactory
 
class  StringArgFactory
 

Macros

#define MAX_NUM_ARGS   (512)
 

Functions

static void lPrintVersion ()
 
static void usage (int ret)
 
static void devUsage (int ret)
 
static void lAddSingleArg (char *arg, int &argc, char *argv[MAX_NUM_ARGS])
 
static void lAddArgsFromFactory (ArgFactory &Args, int &argc, char *argv[MAX_NUM_ARGS])
 
static void lAddArgsFromFile (FILE *file, int &argc, char *argv[MAX_NUM_ARGS])
 
static void lAddArgsFromString (const char *string, int &argc, char *argv[MAX_NUM_ARGS])
 
static void lGetAllArgs (int Argc, char *Argv[], int &argc, char *argv[MAX_NUM_ARGS])
 
static void lSignal (void *)
 
static int ParsingPhaseName (char *stage)
 
static std::set< int > ParsingPhases (char *stages)
 
static void lParseInclude (const char *path)
 
int main (int Argc, char *Argv[])
 

Detailed Description

main() entrypoint implementation for ispc

Definition in file main.cpp.

Macro Definition Documentation

◆ MAX_NUM_ARGS

#define MAX_NUM_ARGS   (512)

Definition at line 67 of file main.cpp.

Referenced by main(), and StringArgFactory::StringArgFactory().

Function Documentation

◆ devUsage()

static void devUsage ( int  ret)
static

Definition at line 178 of file main.cpp.

References lPrintVersion().

Referenced by main().

◆ lAddArgsFromFactory()

static void lAddArgsFromFactory ( ArgFactory Args,
int &  argc,
char *  argv[MAX_NUM_ARGS] 
)
static

Add all args from a given factory to the argc/argv passed as parameters, which could include recursing into another ArgFactory.

Definition at line 294 of file main.cpp.

References ArgFactory::GetNextArg(), and lAddSingleArg().

Referenced by lAddArgsFromFile(), and lAddArgsFromString().

◆ lAddArgsFromFile()

static void lAddArgsFromFile ( FILE *  file,
int &  argc,
char *  argv[MAX_NUM_ARGS] 
)
static

Parse an open file for arguments and add them to the argc/argv passed as parameters

Definition at line 304 of file main.cpp.

References lAddArgsFromFactory().

Referenced by lAddSingleArg().

◆ lAddArgsFromString()

static void lAddArgsFromString ( const char *  string,
int &  argc,
char *  argv[MAX_NUM_ARGS] 
)
static

Parse a string for arguments and add them to the argc/argv passed as parameters

Definition at line 310 of file main.cpp.

References lAddArgsFromFactory().

Referenced by lGetAllArgs().

◆ lAddSingleArg()

static void lAddSingleArg ( char *  arg,
int &  argc,
char *  argv[MAX_NUM_ARGS] 
)
static

Add a single argument to the argc/argv passed as parameters. If the argument is of the form <filename> and <filename> exists and is readable, the arguments in the file will be inserted into argc/argv in place of the original argument.

Definition at line 319 of file main.cpp.

References lAddArgsFromFile().

Referenced by lAddArgsFromFactory(), lGetAllArgs(), and StringArgFactory::StringArgFactory().

◆ lGetAllArgs()

static void lGetAllArgs ( int  Argc,
char *  Argv[],
int &  argc,
char *  argv[MAX_NUM_ARGS] 
)
static

We take arguments from both the command line as well as from the ISPC_ARGS environment variable - and each of these can include a file containing additional arguments using <filename>. This function returns a new set of arguments representing the ones from all these sources merged together.

Definition at line 344 of file main.cpp.

References lAddArgsFromString(), and lAddSingleArg().

Referenced by main().

◆ lParseInclude()

static void lParseInclude ( const char *  path)
static

Definition at line 396 of file main.cpp.

References g, and Globals::includePath.

Referenced by main().

◆ lPrintVersion()

static void lPrintVersion ( )
static

Definition at line 69 of file main.cpp.

Referenced by devUsage(), main(), and usage().

◆ lSignal()

static void lSignal ( void *  )
static

Definition at line 357 of file main.cpp.

References FATAL.

Referenced by main().

◆ main()

int main ( int  Argc,
char *  Argv[] 
)

Definition at line 418 of file main.cpp.

References Module::Asm, Module::Bitcode, Module::BitcodeText, Globals::codegenOptLevel, Module::CompileAndOutput(), Globals::cppArgs, Module::CXX, Globals::debug_stages, Globals::debugIR, Globals::debugPrint, devUsage(), Opt::disableAsserts, Opt::disableBlendedMaskedStores, Opt::disableCoalescing, Opt::disableCoherentControlFlow, Opt::disableFMA, Opt::disableGatherScatterFlattening, Opt::disableGatherScatterOptimizations, Opt::disableHandlePseudoMemoryOps, Globals::disableLineWrap, Opt::disableMaskAllOnOptimizations, Opt::disableMaskedStoreToStore, Opt::disableUniformControlFlow, Opt::disableUniformMemoryOptimizations, Globals::disableWarnings, Globals::dllExport, Globals::dumpFile, Globals::emitInstrumentation, Globals::emitPerfWarnings, Globals::enableFuzzTest, Opt::fastMaskedVload, Opt::fastMath, Opt::force32BitAddressing, Opt::forceAlignedMemory, Globals::forceAlignment, Globals::forceColoredOutput, Globals::fuzzTestSeed, g, Globals::generateDebuggingSymbols, Module::GenerateFlatDeps, Module::GenerateMakeRuleForDeps, Module::GeneratePIC, Globals::includeStdlib, Opt::level, lGetAllArgs(), lParseInclude(), lPrintVersion(), lSignal(), Globals::Math_ISPC, Globals::Math_ISPCFast, Globals::Math_SVML, Globals::Math_System, Globals::mathLib, MAX_NUM_ARGS, Module::NoFlags, Globals::NoOmitFramePointer, Globals::noPragmaOnce, Module::Object, Globals::off_stages, Globals::opt, OS_ERROR, OS_PS4, OS_WINDOWS, Module::OutputDepsToStdout, ParsingPhaseName(), ParsingPhases(), Globals::printTarget, Globals::quiet, Globals::runCPP, StringToOS(), Target::SupportedOSes(), Globals::target_os, Opt::unrollLoops, usage(), Warning(), and Globals::warningsAsErrors.

◆ ParsingPhaseName()

static int ParsingPhaseName ( char *  stage)
static

Definition at line 359 of file main.cpp.

References LAST_OPT_NUMBER.

Referenced by main(), and ParsingPhases().

◆ ParsingPhases()

static std::set<int> ParsingPhases ( char *  stages)
static

Definition at line 375 of file main.cpp.

References Assert, and ParsingPhaseName().

Referenced by main().

◆ usage()

static void usage ( int  ret)
static