Merge pull request #1217 from dbabokin/dwarf
Adding --dwarf-version=X option to control emitted DWARF version.
This commit is contained in:
8
ispc.cpp
8
ispc.cpp
@@ -1102,6 +1102,11 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, boo
|
||||
#else /* LLVM 3.7+ */
|
||||
m_targetMachine->Options.MCOptions.AsmVerbose = true;
|
||||
#endif
|
||||
// Change default version of generated DWARF.
|
||||
if (g->generateDWARFVersion != 0) {
|
||||
m_targetMachine->Options.MCOptions.DwarfVersion = g->generateDWARFVersion;
|
||||
}
|
||||
|
||||
// Initialize TargetData/DataLayout in 3 steps.
|
||||
// 1. Get default data layout first
|
||||
std::string dl_string;
|
||||
@@ -1206,7 +1211,7 @@ Target::SupportedTargets() {
|
||||
"avx512skx-i32x16, "
|
||||
#endif
|
||||
"generic-x1, generic-x4, generic-x8, generic-x16, "
|
||||
"generic-x32, generic-x64, *-generic-x16, "
|
||||
"generic-x32, generic-x64, *-generic-x16"
|
||||
#ifdef ISPC_ARM_ENABLED
|
||||
", neon-i8x16, neon-i16x8, neon-i32x4"
|
||||
#endif
|
||||
@@ -1517,6 +1522,7 @@ Globals::Globals() {
|
||||
emitPerfWarnings = true;
|
||||
emitInstrumentation = false;
|
||||
generateDebuggingSymbols = false;
|
||||
generateDWARFVersion = 0;
|
||||
enableFuzzTest = false;
|
||||
fuzzTestSeed = -1;
|
||||
mangleFunctionsWithTarget = false;
|
||||
|
||||
8
ispc.h
8
ispc.h
@@ -606,6 +606,14 @@ struct Globals {
|
||||
program in its output. */
|
||||
bool generateDebuggingSymbols;
|
||||
|
||||
/** Require generation of DWARF of certain version (2, 3, 4). For
|
||||
default version, this field is set to 0. */
|
||||
// Hint: to verify dwarf version in the object file, run on Linux:
|
||||
// readelf --debug-dump=info object.o | grep -A 2 'Compilation Unit @'
|
||||
// on Mac:
|
||||
// xcrun dwarfdump -r0 object.o
|
||||
int generateDWARFVersion;
|
||||
|
||||
/** If true, function names are mangled by appending the target ISA and
|
||||
vector width to them. */
|
||||
bool mangleFunctionsWithTarget;
|
||||
|
||||
19
main.cpp
19
main.cpp
@@ -104,12 +104,13 @@ usage(int ret) {
|
||||
#ifdef ISPC_IS_WINDOWS
|
||||
printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n");
|
||||
#endif
|
||||
printf(" [--dwarf-version={2,3,4}]\t\tGenerate source-level debug information with given DWARF version (triggers -g)\n");
|
||||
printf(" [--emit-asm]\t\t\tGenerate assembly language file as output\n");
|
||||
printf(" [--emit-c++]\t\t\tEmit a C++ source file as output\n");
|
||||
printf(" [--emit-llvm]\t\t\tEmit LLVM bitode file as output\n");
|
||||
printf(" [--emit-obj]\t\t\tGenerate object file file as output (default)\n");
|
||||
printf(" [--force-alignment=<value>]\t\tForce alignment in memory allocations routine to be <value>\n");
|
||||
printf(" [-g]\t\t\t\tGenerate debugging information\n");
|
||||
printf(" [-g]\t\t\t\tGenerate source-level debug information\n");
|
||||
printf(" [--help]\t\t\t\tPrint help\n");
|
||||
printf(" [--help-dev]\t\t\tPrint help for developer options\n");
|
||||
printf(" [--host-stub <filename>]\t\tEmit host-side offload stub functions to file\n");
|
||||
@@ -121,12 +122,12 @@ usage(int ret) {
|
||||
printf(" fast\t\t\t\tUse high-performance but lower-accuracy math functions\n");
|
||||
printf(" svml\t\t\t\tUse the Intel(r) SVML math libraries\n");
|
||||
printf(" system\t\t\t\tUse the system's math library (*may be quite slow*)\n");
|
||||
printf(" [-MMM <filename>\t\t\t\tWrite #include dependencies to given file.\n");
|
||||
printf(" [-MMM <filename>\t\t\tWrite #include dependencies to given file.\n");
|
||||
printf(" [--no-omit-frame-pointer]\t\tDisable frame pointer omission. It may be useful for profiling\n");
|
||||
printf(" [--nostdlib]\t\t\tDon't make the ispc standard library available\n");
|
||||
printf(" [--nocpp]\t\t\t\tDon't run the C preprocessor\n");
|
||||
printf(" [-o <name>/--outfile=<name>]\tOutput filename (may be \"-\" for standard output)\n");
|
||||
printf(" [-O0/-O(1/2/3)]\t\t\t\tSet optimization level (off or on). Optimizations are on by default.\n");
|
||||
printf(" [-O0/-O(1/2/3)]\t\t\tSet optimization level (off or on). Optimizations are on by default.\n");
|
||||
printf(" [--opt=<option>]\t\t\tSet optimization option\n");
|
||||
printf(" disable-assertions\t\tRemove assertion statements from final code.\n");
|
||||
printf(" disable-fma\t\t\tDisable 'fused multiply-add' instructions (on targets that support them)\n");
|
||||
@@ -387,7 +388,17 @@ int main(int Argc, char *Argv[]) {
|
||||
else if (!strcmp(argv[i], "--dllexport"))
|
||||
g->dllExport = true;
|
||||
#endif
|
||||
else if (!strcmp(argv[i], "--print-target"))
|
||||
else if (!strncmp(argv[i], "--dwarf-version=", 16)) {
|
||||
int val = atoi(argv[i] + 16);
|
||||
if (2 <= val && val <=4) {
|
||||
g->generateDebuggingSymbols = true;
|
||||
g->generateDWARFVersion=val;
|
||||
} else {
|
||||
fprintf(stderr, "Invalid value for DWARF version: \"%s\" -- "
|
||||
"only 2, 3 and 4 are allowed.\n", argv[i]+16);
|
||||
usage(1);
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--print-target"))
|
||||
g->printTarget = true;
|
||||
else if (!strcmp(argv[i], "--no-omit-frame-pointer"))
|
||||
g->NoOmitFramePointer = true;
|
||||
|
||||
@@ -427,8 +427,8 @@ Module::Module(const char *fn) {
|
||||
ISPC_VERSION, __DATE__);
|
||||
#endif
|
||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_4 // LLVM 3.4+
|
||||
diCompileUnit =
|
||||
#endif // LLVM_3_4+
|
||||
diCompileUnit =
|
||||
#endif // LLVM_3_4+
|
||||
diBuilder->createCompileUnit(llvm::dwarf::DW_LANG_C99, /* lang */
|
||||
name, /* filename */
|
||||
directory, /* directory */
|
||||
|
||||
Reference in New Issue
Block a user