Move giant lookup table into another translation unit

Also, rewrote it as a constant variable instead of a function
that imperatively fills a map. It's shorter, faster the compile,
and (depending on how badly the compiler screws it up) maybe
faster to run.

And, of course, it starts breaking up that giant .cpp file.
This commit is contained in:
Chris Kitching
2017-10-16 19:30:45 +01:00
szülő 4e78738267
commit 803d3ffd9c
5 fájl változott, egészen pontosan 2811 új sor hozzáadva és 2817 régi sor törölve
+4 -1
Fájl megtekintése
@@ -29,7 +29,10 @@ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS}) link_directories(${LLVM_LIBRARY_DIRS})
add_definitions(${LLVM_DEFINITIONS}) add_definitions(${LLVM_DEFINITIONS})
add_llvm_executable(hipify-clang src/Cuda2Hip.cpp) add_llvm_executable(hipify-clang
src/Cuda2Hip.cpp
src/CUDA2HipMap.cpp
)
set(CMAKE_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++) set(CMAKE_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
set(CMAKE_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang) set(CMAKE_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
A különbségek nem kerülnek megjelenítésre, mivel a fájl túl nagy Load Diff
@@ -0,0 +1,21 @@
#pragma once
#include "llvm/ADT/StringRef.h"
#include <set>
#include <map>
#include "Types.h"
// TODO: This shouldn't really be here. More restructuring needed...
struct hipCounter {
llvm::StringRef hipName;
ConvTypes countType;
ApiTypes countApiType;
int unsupported;
};
#define HIP_UNSUPPORTED -1
// Static lookup tables for mapping the CUDA API to the HIP API.
extern const std::set<llvm::StringRef> CUDA_EXCLUDES;
extern const std::map<llvm::StringRef, hipCounter> CUDA_TO_HIP_RENAMES;
A különbségek nem kerülnek megjelenítésre, mivel a fájl túl nagy Load Diff
+47
Fájl megtekintése
@@ -0,0 +1,47 @@
#pragma once
enum ConvTypes {
CONV_VERSION = 0,
CONV_INIT,
CONV_DEVICE,
CONV_MEM,
CONV_KERN,
CONV_COORD_FUNC,
CONV_MATH_FUNC,
CONV_SPECIAL_FUNC,
CONV_STREAM,
CONV_EVENT,
CONV_OCCUPANCY,
CONV_CONTEXT,
CONV_PEER,
CONV_MODULE,
CONV_CACHE,
CONV_EXEC,
CONV_ERROR,
CONV_DEF,
CONV_TEX,
CONV_GL,
CONV_GRAPHICS,
CONV_SURFACE,
CONV_JIT,
CONV_D3D9,
CONV_D3D10,
CONV_D3D11,
CONV_VDPAU,
CONV_EGL,
CONV_THREAD,
CONV_OTHER,
CONV_INCLUDE,
CONV_INCLUDE_CUDA_MAIN_H,
CONV_TYPE,
CONV_LITERAL,
CONV_NUMERIC_LITERAL,
CONV_LAST
};
enum ApiTypes {
API_DRIVER = 0,
API_RUNTIME,
API_BLAS,
API_LAST
};