The codegen test would imply adding a -cl-std=2.0 option to Clang, which it currently does not have. This is because the types should only be recognised if the CL 2.0 standard is explicitly asked for (the default is to operate on 1.2 mode). Adding that option is a peripheral issue. I've added the types on the header test under the appropriate "#if defined" but when I tried to do the same on the .cl file, I found out that the test parser does not recognise the preprocessor macro and therefore was causing the test to (incorrectly) fail. As such, I reverted the test.
As for the AS for the other types, I copy-pasted the code from event_t. That's the reason why I'm actually using the "0". Are you suggesting I should change event_t to use something else, and by consequence the new types too? That would be a separate issue. My guess is that these types are allocated on the stack, which by llvm convention will always be 0. The new types are used by new builtins. I don't think there are any other special semantics to it. I've added extension checks on the MSAA types, but I'm not sure if this is the right place. New patch attached. Pedro On Thu, 11 Jun 2015 at 10:33 Anastasia Stulova <anastasia.stul...@arm.com> wrote: > Hi Pedro, > > Could we also add a Codegen test? Also it would be better not to use > constant directly as address space as the mapping could ideally be changed. > Is there any reason why you generate pointers to private AS? > > Are there any operations allowed on new types? Any semantical checks > needed? > > If MSAA types are part of an extension and not a part of the general > standard we should ideally diagnose that extension is enabled when they are > being used. > > Regards, > Anastasia > ________________________________________ > From: cfe-commits-boun...@cs.uiuc.edu [cfe-commits-boun...@cs.uiuc.edu] > On Behalf Of Pedro Ferreira [arkang...@gmail.com] > Sent: Thursday, June 11, 2015 8:18 AM > To: cfe-commits@cs.uiuc.edu > Subject: [PATCH] OpenCL: Add new types for OpenCL 2.0 > > Hi all, > > This patch adds the new OpenCL types for 2.0 described at > https://www.khronos.org/registry/cl/sdk/2.0/docs/man/xhtml/otherDataTypes.html > < > https://urldefense.proofpoint.com/v2/url?u=https-3A__www.khronos.org_registry_cl_sdk_2.0_docs_man_xhtml_otherDataTypes.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=42YnWExwxwpeU6GPDY2_3RFxCqQakUbj_CXZsMsQ2jU&s=REOBNoaDio7qDyIDCqmXhxFvZYjMOK6vuXAttjOVsNI&e= > > > I also opened https://llvm.org/bugs/show_bug.cgi?id=23794< > https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23794&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=42YnWExwxwpeU6GPDY2_3RFxCqQakUbj_CXZsMsQ2jU&s=TAV4suAMaHgdIPA83Da3pQl7c68On7bAFWtnrUbt_Uk&e=> > for this. I keep forgetting you prefer patches sent to this mailing list. > This also adds lldb entries (fixes switch warnings). > > The types are: > > image2d_depth_t > image2d_array_depth_t > image2d_msaa_t > image2d_array_msaa_t > image2d_msaa_depth_t > image2d_array_msaa_depth_t > queue_t > ndrange_t > clk_event_t > reserve_id_t > > let me know if something looks wrong, > Pedro > > -- IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > > ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, > Registered in England & Wales, Company No: 2557590 > ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, > Registered in England & Wales, Company No: 2548782 > >
Index: include/clang/AST/ASTContext.h =================================================================== --- include/clang/AST/ASTContext.h (revision 239461) +++ include/clang/AST/ASTContext.h (working copy) @@ -829,9 +829,12 @@ CanQualType ObjCBuiltinIdTy, ObjCBuiltinClassTy, ObjCBuiltinSelTy; CanQualType ObjCBuiltinBoolTy; CanQualType OCLImage1dTy, OCLImage1dArrayTy, OCLImage1dBufferTy; - CanQualType OCLImage2dTy, OCLImage2dArrayTy; + CanQualType OCLImage2dTy, OCLImage2dArrayTy, OCLImage2dDepthTy; + CanQualType OCLImage2dArrayDepthTy, OCLImage2dMSAATy, OCLImage2dArrayMSAATy; + CanQualType OCLImage2dMSAADepthTy, OCLImage2dArrayMSAADepthTy; CanQualType OCLImage3dTy; - CanQualType OCLSamplerTy, OCLEventTy; + CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy; + CanQualType OCLQueueTy, OCLNDRangeTy, OCLReserveIDTy; // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. mutable QualType AutoDeductTy; // Deduction against 'auto'. Index: include/clang/AST/BuiltinTypes.def =================================================================== --- include/clang/AST/BuiltinTypes.def (revision 239461) +++ include/clang/AST/BuiltinTypes.def (working copy) @@ -160,6 +160,12 @@ BUILTIN_TYPE(OCLImage1dBuffer, OCLImage1dBufferTy) BUILTIN_TYPE(OCLImage2d, OCLImage2dTy) BUILTIN_TYPE(OCLImage2dArray, OCLImage2dArrayTy) +BUILTIN_TYPE(OCLImage2dDepth, OCLImage2dDepthTy) +BUILTIN_TYPE(OCLImage2dArrayDepth, OCLImage2dArrayDepthTy) +BUILTIN_TYPE(OCLImage2dMSAA, OCLImage2dMSAATy) +BUILTIN_TYPE(OCLImage2dArrayMSAA, OCLImage2dArrayMSAATy) +BUILTIN_TYPE(OCLImage2dMSAADepth, OCLImage2dMSAADepthTy) +BUILTIN_TYPE(OCLImage2dArrayMSAADepth, OCLImage2dArrayMSAADepthTy) BUILTIN_TYPE(OCLImage3d, OCLImage3dTy) // OpenCL sampler_t. @@ -168,6 +174,18 @@ // OpenCL event_t. BUILTIN_TYPE(OCLEvent, OCLEventTy) +// OpenCL clk_event_t. +BUILTIN_TYPE(OCLClkEvent, OCLClkEventTy) + +// OpenCL queue_t. +BUILTIN_TYPE(OCLQueue, OCLQueueTy) + +// OpenCL ndrange_t. +BUILTIN_TYPE(OCLNDRange, OCLNDRangeTy) + +// OpenCL reserve_id_t. +BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy) + // This represents the type of an expression whose type is // totally unknown, e.g. 'T::foo'. It is permitted for this to // appear in situations where the structure of the type is Index: include/clang/AST/Type.h =================================================================== --- include/clang/AST/Type.h (revision 239461) +++ include/clang/AST/Type.h (working copy) @@ -1598,6 +1598,12 @@ bool isImage1dBufferT() const; // OpenCL image1d_buffer_t bool isImage2dT() const; // OpenCL image2d_t bool isImage2dArrayT() const; // OpenCL image2d_array_t + bool isImage2dDepthT() const; // Opencl image_2d_depth_t + bool isImage2dArrayDepthT() const; // Opencl image_2d_array_depth_t + bool isImage2dMSAAT() const; // Opencl image_2d_msaa_t + bool isImage2dArrayMSAAT() const; // Opencl image_2d_array_msaa_t + bool isImage2dMSAATDepth() const; // Opencl image_2d_msaa_depth_t + bool isImage2dArrayMSAATDepth() const; // Opencl image_2d_array_msaa_depth_t bool isImage3dT() const; // OpenCL image3d_t bool isImageType() const; // Any OpenCL image type @@ -1604,6 +1610,10 @@ bool isSamplerT() const; // OpenCL sampler_t bool isEventT() const; // OpenCL event_t + bool isClkEventT() const; // OpenCL clk_event_t + bool isQueueT() const; // OpenCL queue_t + bool isNDRangeT() const; // OpenCL ndrange_t + bool isReserveIDT() const; // OpenCL reserve_id_t bool isOpenCLSpecificType() const; // Any OpenCL specific type @@ -5064,6 +5074,30 @@ return isSpecificBuiltinType(BuiltinType::OCLImage2dArray); } +inline bool Type::isImage2dDepthT() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dDepth); +} + +inline bool Type::isImage2dArrayDepthT() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayDepth); +} + +inline bool Type::isImage2dMSAAT() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dMSAA); +} + +inline bool Type::isImage2dArrayMSAAT() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayMSAA); +} + +inline bool Type::isImage2dMSAATDepth() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dMSAADepth); +} + +inline bool Type::isImage2dArrayMSAATDepth() const { + return isSpecificBuiltinType(BuiltinType::OCLImage2dArrayMSAADepth); +} + inline bool Type::isImage3dT() const { return isSpecificBuiltinType(BuiltinType::OCLImage3d); } @@ -5076,14 +5110,35 @@ return isSpecificBuiltinType(BuiltinType::OCLEvent); } +inline bool Type::isClkEventT() const { + return isSpecificBuiltinType(BuiltinType::OCLClkEvent); +} + +inline bool Type::isQueueT() const { + return isSpecificBuiltinType(BuiltinType::OCLQueue); +} + +inline bool Type::isNDRangeT() const { + return isSpecificBuiltinType(BuiltinType::OCLNDRange); +} + +inline bool Type::isReserveIDT() const { + return isSpecificBuiltinType(BuiltinType::OCLReserveID); +} + inline bool Type::isImageType() const { return isImage3dT() || - isImage2dT() || isImage2dArrayT() || + isImage2dT() || isImage2dArrayT() || isImage2dDepthT() || + isImage2dArrayDepthT() || isImage2dMSAAT() || + isImage2dArrayMSAAT() || isImage2dMSAATDepth() || + isImage2dArrayMSAATDepth() || isImage1dT() || isImage1dArrayT() || isImage1dBufferT(); } inline bool Type::isOpenCLSpecificType() const { - return isSamplerT() || isEventT() || isImageType(); + return isSamplerT() || isEventT() || isImageType() || + isClkEventT() || isQueueT() || isNDRangeT() || + isReserveIDT(); } inline bool Type::isTemplateTypeParmType() const { Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td (revision 239461) +++ include/clang/Basic/DiagnosticSemaKinds.td (working copy) @@ -534,6 +534,8 @@ "declaring function parameter of type %0 is not allowed; did you forget * ?">; def err_opencl_half_return : Error< "declaring function return value of type %0 is not allowed; did you forget * ?">; +def err_opencl_requires_msaa_ext : Error< + "use of the type %0 requires the cl_khr_gl_msaa_sharing extension">; def warn_enum_value_overflow : Warning<"overflow in enumeration value">; def warn_pragma_options_align_reset_failed : Warning< "#pragma options align=reset failed: %0">, Index: include/clang/Basic/OpenCLExtensions.def =================================================================== --- include/clang/Basic/OpenCLExtensions.def (revision 239461) +++ include/clang/Basic/OpenCLExtensions.def (working copy) @@ -26,6 +26,9 @@ OPENCLEXT(cl_khr_byte_addressable_store) OPENCLEXT(cl_khr_3d_image_writes) +// OpenCL 2.0 +OPENCLEXT(cl_khr_gl_msaa_sharing) + // Clang Extensions. OPENCLEXT(cl_clang_storage_class_specifiers) Index: include/clang/Serialization/ASTBitCodes.h =================================================================== --- include/clang/Serialization/ASTBitCodes.h (revision 239461) +++ include/clang/Serialization/ASTBitCodes.h (working copy) @@ -769,15 +769,35 @@ /// \brief OpenCL 1d image buffer type. PREDEF_TYPE_IMAGE1D_BUFF_ID = 40, /// \brief OpenCL 2d image type. - PREDEF_TYPE_IMAGE2D_ID = 41, + PREDEF_TYPE_IMAGE2D_ID = 41, /// \brief OpenCL 2d image array type. PREDEF_TYPE_IMAGE2D_ARR_ID = 42, + /// \brief OpenCL 2d image depth type. + PREDEF_TYPE_IMAGE2D_DEP_ID = 43, + /// \brief OpenCL 2d image array depth type. + PREDEF_TYPE_IMAGE2D_ARR_DEP_ID = 44, + /// \brief OpenCL 2d image MSAA type. + PREDEF_TYPE_IMAGE2D_MSAA_ID = 45, + /// \brief OpenCL 2d image array MSAA type. + PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID = 46, + /// \brief OpenCL 2d image MSAA depth type. + PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID = 47, + /// \brief OpenCL 2d image array MSAA depth type. + PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID = 48, /// \brief OpenCL 3d image type. - PREDEF_TYPE_IMAGE3D_ID = 43, + PREDEF_TYPE_IMAGE3D_ID = 49, /// \brief OpenCL event type. - PREDEF_TYPE_EVENT_ID = 44, + PREDEF_TYPE_EVENT_ID = 50, + /// \brief OpenCL clk event type. + PREDEF_TYPE_CLK_EVENT_ID = 51, /// \brief OpenCL sampler type. - PREDEF_TYPE_SAMPLER_ID = 45 + PREDEF_TYPE_SAMPLER_ID = 52, + /// \brief OpenCL queue type. + PREDEF_TYPE_QUEUE_ID = 53, + /// \brief OpenCL ndrange type. + PREDEF_TYPE_NDRANGE_ID = 54, + /// \brief OpenCL reserve_id type. + PREDEF_TYPE_RESERVE_ID_ID = 55 }; /// \brief The number of predefined type IDs that are reserved for Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp (revision 239461) +++ lib/AST/ASTContext.cpp (working copy) @@ -1059,10 +1059,20 @@ InitBuiltinType(OCLImage1dBufferTy, BuiltinType::OCLImage1dBuffer); InitBuiltinType(OCLImage2dTy, BuiltinType::OCLImage2d); InitBuiltinType(OCLImage2dArrayTy, BuiltinType::OCLImage2dArray); + InitBuiltinType(OCLImage2dDepthTy, BuiltinType::OCLImage2dDepth); + InitBuiltinType(OCLImage2dArrayDepthTy, BuiltinType::OCLImage2dArrayDepth); + InitBuiltinType(OCLImage2dMSAATy, BuiltinType::OCLImage2dMSAA); + InitBuiltinType(OCLImage2dArrayMSAATy, BuiltinType::OCLImage2dArrayMSAA); + InitBuiltinType(OCLImage2dMSAADepthTy, BuiltinType::OCLImage2dMSAADepth); + InitBuiltinType(OCLImage2dArrayMSAADepthTy, BuiltinType::OCLImage2dArrayMSAADepth); InitBuiltinType(OCLImage3dTy, BuiltinType::OCLImage3d); InitBuiltinType(OCLSamplerTy, BuiltinType::OCLSampler); InitBuiltinType(OCLEventTy, BuiltinType::OCLEvent); + InitBuiltinType(OCLClkEventTy, BuiltinType::OCLClkEvent); + InitBuiltinType(OCLQueueTy, BuiltinType::OCLQueue); + InitBuiltinType(OCLNDRangeTy, BuiltinType::OCLNDRange); + InitBuiltinType(OCLReserveIDTy, BuiltinType::OCLReserveID); } // Builtin type for __objc_yes and __objc_no @@ -1629,11 +1639,21 @@ Align = Target->getIntAlign(); break; case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: case BuiltinType::OCLImage1d: case BuiltinType::OCLImage1dArray: case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: // Currently these types are pointers to opaque types. Width = Target->getPointerWidth(0); @@ -5303,8 +5323,18 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: case BuiltinType::OCLSampler: case BuiltinType::Dependent: #define BUILTIN_TYPE(KIND, ID) Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp (revision 239461) +++ lib/AST/ItaniumMangle.cpp (working copy) @@ -2031,9 +2031,19 @@ case BuiltinType::OCLImage1dBuffer: Out << "17ocl_image1dbuffer"; break; case BuiltinType::OCLImage2d: Out << "11ocl_image2d"; break; case BuiltinType::OCLImage2dArray: Out << "16ocl_image2darray"; break; + case BuiltinType::OCLImage2dDepth: Out << "16ocl_image2ddepth"; break; + case BuiltinType::OCLImage2dArrayDepth: Out << "21ocl_image2darraydepth"; break; + case BuiltinType::OCLImage2dMSAA: Out << "15ocl_image2dmsaa"; break; + case BuiltinType::OCLImage2dArrayMSAA: Out << "20ocl_image2darraymsaa"; break; + case BuiltinType::OCLImage2dMSAADepth: Out << "20ocl_image2dmsaadepth"; break; + case BuiltinType::OCLImage2dArrayMSAADepth: Out << "35ocl_image2darraymsaadepth"; break; case BuiltinType::OCLImage3d: Out << "11ocl_image3d"; break; case BuiltinType::OCLSampler: Out << "11ocl_sampler"; break; case BuiltinType::OCLEvent: Out << "9ocl_event"; break; + case BuiltinType::OCLClkEvent: Out << "12ocl_clkevent"; break; + case BuiltinType::OCLQueue: Out << "9ocl_queue"; break; + case BuiltinType::OCLNDRange: Out << "11ocl_ndrange"; break; + case BuiltinType::OCLReserveID: Out << "13ocl_reserveid"; break; } } Index: lib/AST/MicrosoftMangle.cpp =================================================================== --- lib/AST/MicrosoftMangle.cpp (revision 239461) +++ lib/AST/MicrosoftMangle.cpp (working copy) @@ -1564,9 +1564,19 @@ case BuiltinType::OCLImage1dBuffer: Out << "PAUocl_image1dbuffer@@"; break; case BuiltinType::OCLImage2d: Out << "PAUocl_image2d@@"; break; case BuiltinType::OCLImage2dArray: Out << "PAUocl_image2darray@@"; break; + case BuiltinType::OCLImage2dDepth: Out << "PAUocl_image2ddepth@@"; break; + case BuiltinType::OCLImage2dArrayDepth: Out << "PAUocl_image2darraydepth@@"; break; + case BuiltinType::OCLImage2dMSAA: Out << "PAUocl_image2dmsaa@@"; break; + case BuiltinType::OCLImage2dArrayMSAA: Out << "PAUocl_image2darraymsaa@@"; break; + case BuiltinType::OCLImage2dMSAADepth: Out << "PAUocl_image2dmsaadepth@@"; break; + case BuiltinType::OCLImage2dArrayMSAADepth: Out << "PAUocl_image2darraymsaadepth@@"; break; case BuiltinType::OCLImage3d: Out << "PAUocl_image3d@@"; break; case BuiltinType::OCLSampler: Out << "PAUocl_sampler@@"; break; case BuiltinType::OCLEvent: Out << "PAUocl_event@@"; break; + case BuiltinType::OCLClkEvent: Out << "PAUocl_clkevent@@"; break; + case BuiltinType::OCLQueue: Out << "PAUocl_queue@@"; break; + case BuiltinType::OCLNDRange: Out << "PAUocl_ndrange@@"; break; + case BuiltinType::OCLReserveID: Out << "PAUocl_reserveid@@"; break; case BuiltinType::NullPtr: Out << "$$T"; break; Index: lib/AST/NSAPI.cpp =================================================================== --- lib/AST/NSAPI.cpp (revision 239461) +++ lib/AST/NSAPI.cpp (working copy) @@ -449,9 +449,19 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: case BuiltinType::BoundMember: case BuiltinType::Dependent: case BuiltinType::Overload: Index: lib/AST/Type.cpp =================================================================== --- lib/AST/Type.cpp (revision 239461) +++ lib/AST/Type.cpp (working copy) @@ -1543,9 +1543,19 @@ case OCLImage1dBuffer: return "image1d_buffer_t"; case OCLImage2d: return "image2d_t"; case OCLImage2dArray: return "image2d_array_t"; + case OCLImage2dDepth: return "image2d_depth_t"; + case OCLImage2dArrayDepth: return "image2d_array_depth_t"; + case OCLImage2dMSAA: return "image2d_msaa_t"; + case OCLImage2dArrayMSAA: return "image2d_array_msaa_t"; + case OCLImage2dMSAADepth: return "image2d_msaa_depth_t"; + case OCLImage2dArrayMSAADepth: return "image2d_array_msaa_depth_t"; case OCLImage3d: return "image3d_t"; case OCLSampler: return "sampler_t"; case OCLEvent: return "event_t"; + case OCLClkEvent: return "clk_event_t"; + case OCLQueue: return "queue_t"; + case OCLNDRange: return "event_t"; + case OCLReserveID: return "reserve_id_t"; } llvm_unreachable("Invalid builtin type."); Index: lib/AST/TypeLoc.cpp =================================================================== --- lib/AST/TypeLoc.cpp (revision 239461) +++ lib/AST/TypeLoc.cpp (working copy) @@ -296,9 +296,19 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: case BuiltinType::BuiltinFn: return TST_unspecified; } Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp (revision 239461) +++ lib/CodeGen/CGDebugInfo.cpp (working copy) @@ -453,6 +453,24 @@ case BuiltinType::OCLImage2dArray: return getOrCreateStructPtrType("opencl_image2d_array_t", OCLImage2dArrayDITy); + case BuiltinType::OCLImage2dDepth: + return getOrCreateStructPtrType("opencl_image2d_depth_t", + OCLImage2dDepthDITy); + case BuiltinType::OCLImage2dArrayDepth: + return getOrCreateStructPtrType("opencl_image2d_array_depth_t", + OCLImage2dArrayDepthDITy); + case BuiltinType::OCLImage2dMSAA: + return getOrCreateStructPtrType("opencl_image2d_msaa_t", + OCLImage2dMSAADITy); + case BuiltinType::OCLImage2dArrayMSAA: + return getOrCreateStructPtrType("opencl_image2d_array_msaa_t", + OCLImage2dArrayMSAADITy); + case BuiltinType::OCLImage2dMSAADepth: + return getOrCreateStructPtrType("opencl_image2d_msaa_depth_t", + OCLImage2dMSAADepthDITy); + case BuiltinType::OCLImage2dArrayMSAADepth: + return getOrCreateStructPtrType("opencl_image2d_array_msaa_depth_t", + OCLImage2dArrayMSAADepthDITy); case BuiltinType::OCLImage3d: return getOrCreateStructPtrType("opencl_image3d_t", OCLImage3dDITy); case BuiltinType::OCLSampler: @@ -461,6 +479,14 @@ CGM.getContext().getTypeAlign(BT), llvm::dwarf::DW_ATE_unsigned); case BuiltinType::OCLEvent: return getOrCreateStructPtrType("opencl_event_t", OCLEventDITy); + case BuiltinType::OCLClkEvent: + return getOrCreateStructPtrType("opencl_clk_event_t", OCLClkEventDITy); + case BuiltinType::OCLQueue: + return getOrCreateStructPtrType("opencl_queue_t", OCLQueueDITy); + case BuiltinType::OCLNDRange: + return getOrCreateStructPtrType("opencl_ndrange_t", OCLNDRangeDITy); + case BuiltinType::OCLReserveID: + return getOrCreateStructPtrType("opencl_reserve_id_t", OCLReserveIDDITy); case BuiltinType::UChar: case BuiltinType::Char_U: Index: lib/CodeGen/CGDebugInfo.h =================================================================== --- lib/CodeGen/CGDebugInfo.h (revision 239461) +++ lib/CodeGen/CGDebugInfo.h (working copy) @@ -63,8 +63,18 @@ llvm::DIType *OCLImage1dBufferDITy = nullptr; llvm::DIType *OCLImage2dDITy = nullptr; llvm::DIType *OCLImage2dArrayDITy = nullptr; + llvm::DIType *OCLImage2dDepthDITy = nullptr; + llvm::DIType *OCLImage2dArrayDepthDITy = nullptr; + llvm::DIType *OCLImage2dMSAADITy = nullptr; + llvm::DIType *OCLImage2dArrayMSAADITy = nullptr; + llvm::DIType *OCLImage2dMSAADepthDITy = nullptr; + llvm::DIType *OCLImage2dArrayMSAADepthDITy = nullptr; llvm::DIType *OCLImage3dDITy = nullptr; llvm::DIType *OCLEventDITy = nullptr; + llvm::DIType *OCLClkEventDITy = nullptr; + llvm::DIType *OCLQueueDITy = nullptr; + llvm::DIType *OCLNDRangeDITy = nullptr; + llvm::DIType *OCLReserveIDDITy = nullptr; llvm::DIType *BlockLiteralGeneric = nullptr; /// \brief Cache of previously constructed Types. Index: lib/CodeGen/CGOpenCLRuntime.cpp =================================================================== --- lib/CodeGen/CGOpenCLRuntime.cpp (revision 239461) +++ lib/CodeGen/CGOpenCLRuntime.cpp (working copy) @@ -55,6 +55,28 @@ case BuiltinType::OCLImage2dArray: return llvm::PointerType::get(llvm::StructType::create( Ctx, "opencl.image2d_array_t"), ImgAddrSpc); + case BuiltinType::OCLImage2dDepth: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_depth_t"), ImgAddrSpc); + case BuiltinType::OCLImage2dArrayDepth: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_array_depth_t"), + ImgAddrSpc); + case BuiltinType::OCLImage2dMSAA: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_msaa_t"), ImgAddrSpc); + case BuiltinType::OCLImage2dArrayMSAA: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_array_msaa_t"), + ImgAddrSpc); + case BuiltinType::OCLImage2dMSAADepth: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_msaa_depth_t"), + ImgAddrSpc); + case BuiltinType::OCLImage2dArrayMSAADepth: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.image2d_array_msaa_depth_t"), + ImgAddrSpc); case BuiltinType::OCLImage3d: return llvm::PointerType::get(llvm::StructType::create( Ctx, "opencl.image3d_t"), ImgAddrSpc); @@ -63,5 +85,17 @@ case BuiltinType::OCLEvent: return llvm::PointerType::get(llvm::StructType::create( Ctx, "opencl.event_t"), 0); + case BuiltinType::OCLClkEvent: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.clk_event_t"), 0); + case BuiltinType::OCLQueue: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.queue_t"), 0); + case BuiltinType::OCLNDRange: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.ndrange_t"), 0); + case BuiltinType::OCLReserveID: + return llvm::PointerType::get(llvm::StructType::create( + Ctx, "opencl.reserve_id_t"), 0); } } Index: lib/CodeGen/CodeGenTypes.cpp =================================================================== --- lib/CodeGen/CodeGenTypes.cpp (revision 239461) +++ lib/CodeGen/CodeGenTypes.cpp (working copy) @@ -387,9 +387,19 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: ResultType = CGM.getOpenCLRuntime().convertOpenCLSpecificType(Ty); break; Index: lib/CodeGen/ItaniumCXXABI.cpp =================================================================== --- lib/CodeGen/ItaniumCXXABI.cpp (revision 239461) +++ lib/CodeGen/ItaniumCXXABI.cpp (working copy) @@ -2341,9 +2341,19 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: return true; case BuiltinType::Dependent: Index: lib/Index/USRGeneration.cpp =================================================================== --- lib/Index/USRGeneration.cpp (revision 239461) +++ lib/Index/USRGeneration.cpp (working copy) @@ -613,8 +613,18 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: case BuiltinType::OCLSampler: IgnoreResults = true; return; Index: lib/Sema/Sema.cpp =================================================================== --- lib/Sema/Sema.cpp (revision 239461) +++ lib/Sema/Sema.cpp (working copy) @@ -214,6 +214,16 @@ addImplicitTypedef("sampler_t", Context.OCLSamplerTy); addImplicitTypedef("event_t", Context.OCLEventTy); if (getLangOpts().OpenCLVersion >= 200) { + addImplicitTypedef("image2d_depth_t", Context.OCLImage2dDepthTy); + addImplicitTypedef("image2d_array_depth_t", Context.OCLImage2dArrayDepthTy); + addImplicitTypedef("image2d_msaa_t", Context.OCLImage2dMSAATy); + addImplicitTypedef("image2d_array_msaa_t", Context.OCLImage2dArrayMSAATy); + addImplicitTypedef("image2d_msaa_depth_t", Context.OCLImage2dMSAADepthTy); + addImplicitTypedef("image2d_array_msaa_depth_t", Context.OCLImage2dArrayMSAADepthTy); + addImplicitTypedef("clk_event_t", Context.OCLClkEventTy); + addImplicitTypedef("queue_t", Context.OCLQueueTy); + addImplicitTypedef("ndrange_t", Context.OCLNDRangeTy); + addImplicitTypedef("reserve_id_t", Context.OCLReserveIDTy); addImplicitTypedef("atomic_int", Context.getAtomicType(Context.IntTy)); addImplicitTypedef("atomic_uint", Context.getAtomicType(Context.UnsignedIntTy)); Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp (revision 239461) +++ lib/Sema/SemaDecl.cpp (working copy) @@ -5513,6 +5513,18 @@ D.setInvalidType(); } } + + // declaring any *msaa* types requires the appropriate extension + if (!getOpenCLOptions().cl_khr_gl_msaa_sharing) { + const auto baseTy = Context.getBaseElementType(R); + const bool isMSAAType = + baseTy->isImage2dMSAAT() || baseTy->isImage2dArrayMSAAT() || + baseTy->isImage2dMSAATDepth() || baseTy->isImage2dArrayMSAATDepth(); + if (isMSAAType) { + Diag(D.getIdentifierLoc(), diag::err_opencl_requires_msaa_ext) << R; + D.setInvalidType(); + } + } } if (SCSpec == DeclSpec::SCS_mutable) { Index: lib/Serialization/ASTCommon.cpp =================================================================== --- lib/Serialization/ASTCommon.cpp (revision 239461) +++ lib/Serialization/ASTCommon.cpp (working copy) @@ -67,9 +67,19 @@ case BuiltinType::OCLImage1dBuffer: ID = PREDEF_TYPE_IMAGE1D_BUFF_ID; break; case BuiltinType::OCLImage2d: ID = PREDEF_TYPE_IMAGE2D_ID; break; case BuiltinType::OCLImage2dArray: ID = PREDEF_TYPE_IMAGE2D_ARR_ID; break; + case BuiltinType::OCLImage2dDepth: ID = PREDEF_TYPE_IMAGE2D_DEP_ID; break; + case BuiltinType::OCLImage2dArrayDepth: ID = PREDEF_TYPE_IMAGE2D_ARR_DEP_ID; break; + case BuiltinType::OCLImage2dMSAA: ID = PREDEF_TYPE_IMAGE2D_MSAA_ID; break; + case BuiltinType::OCLImage2dArrayMSAA: ID = PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID; break; + case BuiltinType::OCLImage2dMSAADepth: ID = PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID; break; + case BuiltinType::OCLImage2dArrayMSAADepth: ID = PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID; break; case BuiltinType::OCLImage3d: ID = PREDEF_TYPE_IMAGE3D_ID; break; case BuiltinType::OCLSampler: ID = PREDEF_TYPE_SAMPLER_ID; break; case BuiltinType::OCLEvent: ID = PREDEF_TYPE_EVENT_ID; break; + case BuiltinType::OCLClkEvent: ID = PREDEF_TYPE_CLK_EVENT_ID; break; + case BuiltinType::OCLQueue: ID = PREDEF_TYPE_QUEUE_ID; break; + case BuiltinType::OCLNDRange: ID = PREDEF_TYPE_NDRANGE_ID; break; + case BuiltinType::OCLReserveID: ID = PREDEF_TYPE_RESERVE_ID_ID; break; case BuiltinType::BuiltinFn: ID = PREDEF_TYPE_BUILTIN_FN; break; Index: lib/Serialization/ASTReader.cpp =================================================================== --- lib/Serialization/ASTReader.cpp (revision 239461) +++ lib/Serialization/ASTReader.cpp (working copy) @@ -5716,9 +5716,19 @@ case PREDEF_TYPE_IMAGE1D_BUFF_ID: T = Context.OCLImage1dBufferTy; break; case PREDEF_TYPE_IMAGE2D_ID: T = Context.OCLImage2dTy; break; case PREDEF_TYPE_IMAGE2D_ARR_ID: T = Context.OCLImage2dArrayTy; break; + case PREDEF_TYPE_IMAGE2D_DEP_ID: T = Context.OCLImage2dDepthTy; break; + case PREDEF_TYPE_IMAGE2D_ARR_DEP_ID: T = Context.OCLImage2dArrayDepthTy; break; + case PREDEF_TYPE_IMAGE2D_MSAA_ID: T = Context.OCLImage2dMSAATy; break; + case PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID: T = Context.OCLImage2dArrayMSAATy; break; + case PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID: T = Context.OCLImage2dMSAADepthTy; break; + case PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID: T = Context.OCLImage2dArrayMSAADepthTy; break; case PREDEF_TYPE_IMAGE3D_ID: T = Context.OCLImage3dTy; break; case PREDEF_TYPE_SAMPLER_ID: T = Context.OCLSamplerTy; break; case PREDEF_TYPE_EVENT_ID: T = Context.OCLEventTy; break; + case PREDEF_TYPE_CLK_EVENT_ID: T = Context.OCLClkEventTy; break; + case PREDEF_TYPE_QUEUE_ID: T = Context.OCLQueueTy; break; + case PREDEF_TYPE_NDRANGE_ID: T = Context.OCLNDRangeTy; break; + case PREDEF_TYPE_RESERVE_ID_ID: T = Context.OCLReserveIDTy; break; case PREDEF_TYPE_AUTO_DEDUCT: T = Context.getAutoDeductType(); break; case PREDEF_TYPE_AUTO_RREF_DEDUCT: Index: test/PCH/ocl_types.h =================================================================== --- test/PCH/ocl_types.h (revision 239461) +++ test/PCH/ocl_types.h (working copy) @@ -23,3 +23,37 @@ // event_t typedef event_t evt_t; + +#if __OPENCL_VERSION__ >= 200 + +// clk_event_t +typedef clk_event_t clkevt_t; + +// queue_t +typedef queue_t q_t; + +// ndrange_t +typedef ndrange_t range_t; + +// reserve_id_t +typedef reserve_id_t reserveid_t; + +// image2d_depth_t +typedef image2d_depth_t img2ddep_t; + +// image2d_array_depth_t +typedef image2d_array_depth_t img2darr_dep_t; + +// image2d_msaa_t +typedef image2d_msaa_t img2dmsaa_t; + +// image2d_array_msaa_t +typedef image2d_array_msaa_t img2darrmsaa_t; + +// image2d_msaa_depth_t +typedef image2d_msaa_depth_t img2dmsaadep_t; + +// image2d_array_msaa_depth_t +typedef image2d_array_msaa_depth_t img2darrmsaadep_t; + +#endif Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp (revision 239461) +++ tools/libclang/CIndex.cpp (working copy) @@ -1423,9 +1423,19 @@ case BuiltinType::OCLImage1dBuffer: case BuiltinType::OCLImage2d: case BuiltinType::OCLImage2dArray: + case BuiltinType::OCLImage2dDepth: + case BuiltinType::OCLImage2dArrayDepth: + case BuiltinType::OCLImage2dMSAA: + case BuiltinType::OCLImage2dArrayMSAA: + case BuiltinType::OCLImage2dMSAADepth: + case BuiltinType::OCLImage2dArrayMSAADepth: case BuiltinType::OCLImage3d: case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: + case BuiltinType::OCLClkEvent: + case BuiltinType::OCLQueue: + case BuiltinType::OCLNDRange: + case BuiltinType::OCLReserveID: #define BUILTIN_TYPE(Id, SingletonId) #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id: #define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits