[cfe-commits] r120544 - in /cfe/trunk: include/clang/Driver/Types.def include/clang/Frontend/FrontendAction.h include/clang/Frontend/LangStandards.def lib/Driver/Types.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/FrontendActions.cpp lib/Frontend/FrontendOptions.cpp
Peter Collingbourne
peter at pcc.me.uk
Tue Nov 30 19:15:20 PST 2010
Author: pcc
Date: Tue Nov 30 21:15:20 2010
New Revision: 120544
URL: http://llvm.org/viewvc/llvm-project?rev=120544&view=rev
Log:
Driver, Frontend: add CUDA language support
Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Frontend/FrontendAction.h
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Frontend/FrontendOptions.cpp
Modified: cfe/trunk/include/clang/Driver/Types.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Tue Nov 30 21:15:20 2010
@@ -42,6 +42,7 @@
TYPE("cpp-output", PP_C, INVALID, "i", "u")
TYPE("c", C, PP_C, 0, "u")
TYPE("cl", CL, PP_C, 0, "u")
+TYPE("cuda", CUDA, PP_CXX, 0, "u")
TYPE("objective-c-cpp-output", PP_ObjC, INVALID, "mi", "u")
TYPE("objective-c", ObjC, PP_ObjC, 0, "u")
TYPE("c++-cpp-output", PP_CXX, INVALID, "ii", "u")
Modified: cfe/trunk/include/clang/Frontend/FrontendAction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendAction.h?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendAction.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendAction.h Tue Nov 30 21:15:20 2010
@@ -37,6 +37,7 @@
IK_PreprocessedObjC,
IK_PreprocessedObjCXX,
IK_OpenCL,
+ IK_CUDA,
IK_AST,
IK_LLVM_IR
};
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Tue Nov 30 21:15:20 2010
@@ -80,4 +80,9 @@
"OpenCL 1.0",
BCPLComment | C99 | Digraphs | HexFloat)
+// CUDA
+LANGSTANDARD(cuda, "cuda",
+ "NVIDIA CUDA(tm)",
+ BCPLComment | CPlusPlus | Digraphs)
+
#undef LANGSTANDARD
Modified: cfe/trunk/lib/Driver/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Tue Nov 30 21:15:20 2010
@@ -78,6 +78,7 @@
case TY_Asm:
case TY_C: case TY_PP_C:
case TY_CL:
+ case TY_CUDA:
case TY_ObjC: case TY_PP_ObjC:
case TY_CXX: case TY_PP_CXX:
case TY_ObjCXX: case TY_PP_ObjCXX:
@@ -151,6 +152,7 @@
.Case("CC", TY_CXX)
.Case("cl", TY_CL)
.Case("cp", TY_CXX)
+ .Case("cu", TY_CUDA)
.Case("hh", TY_CXXHeader)
.Case("ll", TY_LLVM_IR)
.Case("hpp", TY_CXXHeader)
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Nov 30 21:15:20 2010
@@ -302,6 +302,7 @@
case IK_ObjC: return "objective-c";
case IK_ObjCXX: return "objective-c++";
case IK_OpenCL: return "cl";
+ case IK_CUDA: return "cuda";
case IK_PreprocessedC: return "cpp-output";
case IK_PreprocessedCXX: return "c++-cpp-output";
case IK_PreprocessedObjC: return "objective-c-cpp-output";
@@ -1113,6 +1114,7 @@
.Case("cl", IK_OpenCL)
.Case("c", IK_C)
.Case("cl", IK_OpenCL)
+ .Case("cuda", IK_CUDA)
.Case("c++", IK_CXX)
.Case("objective-c", IK_ObjC)
.Case("objective-c++", IK_ObjCXX)
@@ -1254,6 +1256,9 @@
case IK_OpenCL:
LangStd = LangStandard::lang_opencl;
break;
+ case IK_CUDA:
+ LangStd = LangStandard::lang_cuda;
+ break;
case IK_Asm:
case IK_C:
case IK_PreprocessedC:
@@ -1289,6 +1294,9 @@
Opts.LaxVectorConversions = 1;
}
+ if (LangStd == LangStandard::lang_cuda)
+ Opts.CUDA = 1;
+
// OpenCL and C++ both have bool, true, false keywords.
Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Tue Nov 30 21:15:20 2010
@@ -204,6 +204,7 @@
case IK_ObjC:
case IK_ObjCXX:
case IK_OpenCL:
+ case IK_CUDA:
break;
case IK_None:
Modified: cfe/trunk/lib/Frontend/FrontendOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendOptions.cpp?rev=120544&r1=120543&r2=120544&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendOptions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendOptions.cpp Tue Nov 30 21:15:20 2010
@@ -26,6 +26,7 @@
.Cases("C", "cc", "cp", IK_CXX)
.Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
.Case("cl", IK_OpenCL)
+ .Case("cu", IK_CUDA)
.Cases("ll", "bc", IK_LLVM_IR)
.Default(IK_C);
}
More information about the cfe-commits
mailing list