Debug flag for target's info was added
This commit is contained in:
9
ispc.cpp
9
ispc.cpp
@@ -418,7 +418,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, std::string genericAsSmth) :
|
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget, std::string genericAsSmth) :
|
||||||
m_target(NULL),
|
m_target(NULL),
|
||||||
m_targetMachine(NULL),
|
m_targetMachine(NULL),
|
||||||
m_dataLayout(NULL),
|
m_dataLayout(NULL),
|
||||||
@@ -1049,6 +1049,12 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, std
|
|||||||
|
|
||||||
m_valid = !error;
|
m_valid = !error;
|
||||||
|
|
||||||
|
if (printTarget) {
|
||||||
|
printf("Target Triple: %s\n", m_targetMachine->getTargetTriple().str().c_str());
|
||||||
|
printf("Target CPU: %s\n", m_targetMachine->getTargetCPU().str().c_str());
|
||||||
|
printf("Target Feature String: %s\n", m_targetMachine->getTargetFeatureString().str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1379,6 +1385,7 @@ Globals::Globals() {
|
|||||||
includeStdlib = true;
|
includeStdlib = true;
|
||||||
runCPP = true;
|
runCPP = true;
|
||||||
debugPrint = false;
|
debugPrint = false;
|
||||||
|
printTarget = false;
|
||||||
debugIR = -1;
|
debugIR = -1;
|
||||||
disableWarnings = false;
|
disableWarnings = false;
|
||||||
warningsAsErrors = false;
|
warningsAsErrors = false;
|
||||||
|
|||||||
5
ispc.h
5
ispc.h
@@ -207,7 +207,7 @@ public:
|
|||||||
/** Initializes the given Target pointer for a target of the given
|
/** Initializes the given Target pointer for a target of the given
|
||||||
name, if the name is a known target. Returns true if the
|
name, if the name is a known target. Returns true if the
|
||||||
target was initialized and false if the name is unknown. */
|
target was initialized and false if the name is unknown. */
|
||||||
Target(const char *arch, const char *cpu, const char *isa, bool pic, std::string genenricAsSmth = "");
|
Target(const char *arch, const char *cpu, const char *isa, bool pic, bool printTarget, std::string genenricAsSmth = "");
|
||||||
|
|
||||||
/** Returns a comma-delimited string giving the names of the currently
|
/** Returns a comma-delimited string giving the names of the currently
|
||||||
supported compilation targets. */
|
supported compilation targets. */
|
||||||
@@ -559,6 +559,9 @@ struct Globals {
|
|||||||
ispc's execution. */
|
ispc's execution. */
|
||||||
bool debugPrint;
|
bool debugPrint;
|
||||||
|
|
||||||
|
/** When \c true, target ISA will be printed during ispc's execution. */
|
||||||
|
bool printTarget;
|
||||||
|
|
||||||
/** Indicates which stages of optimization we want to dump. */
|
/** Indicates which stages of optimization we want to dump. */
|
||||||
std::set<int> debug_stages;
|
std::set<int> debug_stages;
|
||||||
|
|
||||||
|
|||||||
3
main.cpp
3
main.cpp
@@ -153,6 +153,7 @@ devUsage(int ret) {
|
|||||||
lPrintVersion();
|
lPrintVersion();
|
||||||
printf("\nusage (developer options): ispc\n");
|
printf("\nusage (developer options): ispc\n");
|
||||||
printf(" [--debug]\t\t\t\tPrint information useful for debugging ispc\n");
|
printf(" [--debug]\t\t\t\tPrint information useful for debugging ispc\n");
|
||||||
|
printf(" [--print-target]\t\t\tPrint target's information\n");
|
||||||
printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n");
|
printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n");
|
||||||
printf(" [--fuzz-test]\t\t\tRandomly perturb program input to test error conditions\n");
|
printf(" [--fuzz-test]\t\t\tRandomly perturb program input to test error conditions\n");
|
||||||
printf(" [--fuzz-seed=<value>]\t\tSeed value for RNG for fuzz testing\n");
|
printf(" [--fuzz-seed=<value>]\t\tSeed value for RNG for fuzz testing\n");
|
||||||
@@ -382,6 +383,8 @@ int main(int Argc, char *Argv[]) {
|
|||||||
g->debugPrint = true;
|
g->debugPrint = true;
|
||||||
else if (!strcmp(argv[i], "--dllexport"))
|
else if (!strcmp(argv[i], "--dllexport"))
|
||||||
g->dllExport = true;
|
g->dllExport = true;
|
||||||
|
else if (!strcmp(argv[i], "--print-target"))
|
||||||
|
g->printTarget = true;
|
||||||
else if (!strcmp(argv[i], "--instrument"))
|
else if (!strcmp(argv[i], "--instrument"))
|
||||||
g->emitInstrumentation = true;
|
g->emitInstrumentation = true;
|
||||||
else if (!strcmp(argv[i], "-g")) {
|
else if (!strcmp(argv[i], "-g")) {
|
||||||
|
|||||||
@@ -3055,7 +3055,7 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
{
|
{
|
||||||
if (target == NULL || strchr(target, ',') == NULL) {
|
if (target == NULL || strchr(target, ',') == NULL) {
|
||||||
// We're only compiling to a single target
|
// We're only compiling to a single target
|
||||||
g->target = new Target(arch, cpu, target, generatePIC);
|
g->target = new Target(arch, cpu, target, generatePIC, g->printTarget);
|
||||||
if (!g->target->isValid())
|
if (!g->target->isValid())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -3198,7 +3198,7 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
std::string treatGenericAsSmth = "";
|
std::string treatGenericAsSmth = "";
|
||||||
|
|
||||||
for (unsigned int i = 0; i < targets.size(); ++i) {
|
for (unsigned int i = 0; i < targets.size(); ++i) {
|
||||||
g->target = new Target(arch, cpu, targets[i].c_str(), generatePIC);
|
g->target = new Target(arch, cpu, targets[i].c_str(), generatePIC, g->printTarget);
|
||||||
if (!g->target->isValid())
|
if (!g->target->isValid())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -3293,7 +3293,7 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
}
|
}
|
||||||
Assert(firstTargetMachine != NULL);
|
Assert(firstTargetMachine != NULL);
|
||||||
|
|
||||||
g->target = new Target(arch, cpu, firstISA, generatePIC, treatGenericAsSmth);
|
g->target = new Target(arch, cpu, firstISA, generatePIC, false, treatGenericAsSmth);
|
||||||
if (!g->target->isValid()) {
|
if (!g->target->isValid()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user