Skip to content

Lower -profiling option to -debug-info-kind=line-tables-only #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.13.4)

if(NOT DEFINED BASE_LLVM_VERSION)
set(BASE_LLVM_VERSION 16.0.0)
Expand Down Expand Up @@ -84,6 +84,8 @@ if (NOT WIN32)
add_subdirectory( linux_linker bin)
endif()

use_rtti(FALSE)

if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ADDR 32)
else ()
Expand Down
2 changes: 1 addition & 1 deletion cl_headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ add_custom_target (
function(pack_to_obj SRC DST TAG)
add_custom_command (
OUTPUT ${DST}
DEPENDS ${SRC} linux_resource_linker
DEPENDS ${SRC} ${LINUX_RESOURCE_LINKER_COMMAND}
COMMAND ${LINUX_RESOURCE_LINKER_COMMAND} "${SRC}" "${DST}" "${TAG}"
COMMENT "Packing ${SRC}"
)
Expand Down
6 changes: 0 additions & 6 deletions common_clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Copyright (c) Intel Corporation (2009-2017).
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
Expand All @@ -63,11 +62,8 @@ Copyright (c) Intel Corporation (2009-2017).
#define CL_OUT_OF_HOST_MEMORY -6

#include "assert.h"
#include <algorithm>
#include <iosfwd>
#include <iterator>
#include <list>
#include <streambuf>
#ifdef _WIN32
#include <ctype.h>
#endif
Expand Down Expand Up @@ -265,8 +261,6 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
ProcessWarningOptions(*Diags, compiler->getDiagnosticOpts());

// Map memory buffers to a virtual file system

// Source file
MemFS->addFile(
optionsParser.getSourceName(), (time_t)0,
llvm::MemoryBuffer::getMemBuffer(
Expand Down
6 changes: 4 additions & 2 deletions options.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class OpenCLArgList : public llvm::opt::ArgList {

const char *MakeArgStringRef(llvm::StringRef str) const override;

virtual ~OpenCLArgList() {}

private:
/// List of argument strings used by the contained Args.
///
Expand All @@ -93,10 +95,10 @@ class OpenCLArgList : public llvm::opt::ArgList {
//
// OpenCL specific OptTable
//
class OpenCLOptTable : public llvm::opt::OptTable {
class OpenCLOptTable : public llvm::opt::GenericOptTable {
public:
OpenCLOptTable(llvm::ArrayRef<Info> pOptionInfos)
: OptTable(pOptionInfos) {}
: llvm::opt::GenericOptTable(pOptionInfos) {}

OpenCLArgList *ParseArgs(const char *szOptions, unsigned &missingArgIndex,
unsigned &missingArgCount) const;
Expand Down
19 changes: 12 additions & 7 deletions options_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Copyright (c) Intel Corporation (2009-2017).
#include <map>
#include <sstream>

#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
#define PREFIX(NAME, VALUE) \
const llvm::ArrayRef<llvm::StringLiteral> NAME = VALUE;
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES)
#include "opencl_clang_options.inc"
Expand All @@ -47,7 +48,7 @@ static const OptTable::Info ClangOptionsInfoTable[] = {
{ \
PREFIX, NAME, HELPTEXT, METAVAR, OPT_COMPILE_##ID, \
llvm::opt::Option::KIND##Class, PARAM, FLAGS, OPT_COMPILE_##GROUP, \
OPT_COMPILE_##ALIAS, ALIASARGS \
OPT_COMPILE_##ALIAS, ALIASARGS, VALUES \
} \
,
#include "opencl_clang_options.inc"
Expand Down Expand Up @@ -157,14 +158,18 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
// default:
// assert(false && "some unknown argument");
case OPT_COMPILE_profiling:
case OPT_COMPILE_g_Flag:
effectiveArgs.push_back("-debug-info-kind=limited");
effectiveArgs.push_back("-dwarf-version=4");
break;
case OPT_COMPILE_gline_tables_only_Flag:
effectiveArgs.push_back("-debug-info-kind=line-tables-only");
effectiveArgs.push_back("-dwarf-version=4");
break;
case OPT_COMPILE_g_Flag:
effectiveArgs.push_back("-debug-info-kind=limited");
effectiveArgs.push_back("-dwarf-version=4");
#ifdef _WIN32
// Do not use column information on Windows.
effectiveArgs.push_back("-gno-column-info");
#endif
break;
}
}

Expand Down Expand Up @@ -220,7 +225,7 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
// OpenCL v2.0 s6.9.u - Implicit function declaration is not supported.
// Behavior of clang is changed and now there is only warning about
// implicit function declarations. To be more user friendly and avoid
// unexpected indirect function calls in IR, let's force this warning to
// unexpected indirect function calls in BE, let's force this warning to
// error.
effectiveArgs.push_back("-Werror=implicit-function-declaration");

Expand Down
4 changes: 3 additions & 1 deletion pch_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Copyright (c) Intel Corporation (2009-2017).

#include "pch_mgr.h"

#include "llvm/Object/ELF.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Object/ELF.h"

#include <cstdlib>
#include <stdio.h>
Expand All @@ -35,6 +35,8 @@ struct auto_dlclose {
auto_dlclose(void *module) : m_pModule(module) {}

~auto_dlclose() {
if (m_pModule)
dlclose(m_pModule);
}

void *get() { return m_pModule; }
Expand Down