mirror of https://github.com/microsoft/clang.git
Reverted the "[CUDA/OpenMP] Define only some host macros during device compilation"
The changes were breaking CUDA compilation. Reverted revisions: r340681 D50845 [CUDA/OpenMP] Define only some host macros during device compilation r340772 D51312 [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading r340967 D51441 Add predefined macro __gnu_linux__ for proper aux-triple git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341115 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4ff1ad2346
commit
dfb6e35a90
|
@ -1099,50 +1099,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
||||||
TI.getTargetDefines(LangOpts, Builder);
|
TI.getTargetDefines(LangOpts, Builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize macros based on AuxTargetInfo.
|
|
||||||
static void InitializePredefinedAuxMacros(const TargetInfo &AuxTI,
|
|
||||||
const LangOptions &LangOpts,
|
|
||||||
MacroBuilder &Builder) {
|
|
||||||
auto AuxTriple = AuxTI.getTriple();
|
|
||||||
|
|
||||||
// Define basic target macros needed by at least bits/wordsize.h and
|
|
||||||
// bits/mathinline.h.
|
|
||||||
// On PowerPC, explicitely set _CALL_ELF macro needed for gnu/stubs.h.
|
|
||||||
switch (AuxTriple.getArch()) {
|
|
||||||
case llvm::Triple::x86_64:
|
|
||||||
Builder.defineMacro("__x86_64__");
|
|
||||||
break;
|
|
||||||
case llvm::Triple::ppc64:
|
|
||||||
Builder.defineMacro("__powerpc64__");
|
|
||||||
Builder.defineMacro("_CALL_ELF", "1");
|
|
||||||
break;
|
|
||||||
case llvm::Triple::ppc64le:
|
|
||||||
Builder.defineMacro("__powerpc64__");
|
|
||||||
Builder.defineMacro("_CALL_ELF", "2");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// libc++ needs to find out the object file format and threading API.
|
|
||||||
if (AuxTriple.getOS() == llvm::Triple::Linux) {
|
|
||||||
Builder.defineMacro("__ELF__");
|
|
||||||
Builder.defineMacro("__linux__");
|
|
||||||
Builder.defineMacro("__gnu_linux__");
|
|
||||||
// Used in features.h. If this is omitted, math.h doesn't declare float
|
|
||||||
// versions of the functions in bits/mathcalls.h.
|
|
||||||
if (LangOpts.CPlusPlus)
|
|
||||||
Builder.defineMacro("_GNU_SOURCE");
|
|
||||||
} else if (AuxTriple.isOSDarwin()) {
|
|
||||||
Builder.defineMacro("__APPLE__");
|
|
||||||
Builder.defineMacro("__MACH__");
|
|
||||||
} else if (AuxTriple.isOSWindows()) {
|
|
||||||
Builder.defineMacro("_WIN32");
|
|
||||||
if (AuxTriple.isWindowsGNUEnvironment())
|
|
||||||
Builder.defineMacro("__MINGW32__");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// InitializePreprocessor - Initialize the preprocessor getting it and the
|
/// InitializePreprocessor - Initialize the preprocessor getting it and the
|
||||||
/// environment ready to process a single file. This returns true on error.
|
/// environment ready to process a single file. This returns true on error.
|
||||||
///
|
///
|
||||||
|
@ -1164,9 +1120,13 @@ void clang::InitializePreprocessor(
|
||||||
|
|
||||||
// Install things like __POWERPC__, __GNUC__, etc into the macro table.
|
// Install things like __POWERPC__, __GNUC__, etc into the macro table.
|
||||||
if (InitOpts.UsePredefines) {
|
if (InitOpts.UsePredefines) {
|
||||||
InitializePredefinedMacros(PP.getTargetInfo(), LangOpts, FEOpts, Builder);
|
// FIXME: This will create multiple definitions for most of the predefined
|
||||||
|
// macros. This is not the right way to handle this.
|
||||||
if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
|
if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
|
||||||
InitializePredefinedAuxMacros(*PP.getAuxTargetInfo(), LangOpts, Builder);
|
InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
|
||||||
|
Builder);
|
||||||
|
|
||||||
|
InitializePredefinedMacros(PP.getTargetInfo(), LangOpts, FEOpts, Builder);
|
||||||
|
|
||||||
// Install definitions to make Objective-C++ ARC work well with various
|
// Install definitions to make Objective-C++ ARC work well with various
|
||||||
// C++ Standard Library implementations.
|
// C++ Standard Library implementations.
|
||||||
|
|
Loading…
Reference in New Issue