Author: Nico Weber Date: 2022-05-30T14:11:07-04:00 New Revision: c4eb8035ed6647e58d4c5161f393e9220f7402cf
URL: https://github.com/llvm/llvm-project/commit/c4eb8035ed6647e58d4c5161f393e9220f7402cf DIFF: https://github.com/llvm/llvm-project/commit/c4eb8035ed6647e58d4c5161f393e9220f7402cf.diff LOG: Revert "[HLSL] Enable vector types for hlsl." This reverts commit e576280380d3f5221cfcc14e9fabeacc8506a43c. Breaks tests on mac/arm, see comment on https://reviews.llvm.org/D125052 Also revert follow-up "[gn build] Port e576280380d3" This reverts commit 1e01b1ec72031fcaceb4e77e1c5c8e34f1e862e8. Added: Modified: clang/include/clang/Driver/Options.td clang/lib/Basic/LangOptions.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Headers/CMakeLists.txt llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn Removed: clang/lib/Headers/hlsl.h clang/lib/Headers/hlsl/hlsl_basic_types.h clang/test/CodeGenHLSL/basic_types.hlsl clang/test/Driver/hlsl_no_stdinc.hlsl ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 44fd4d50ca051..0343e48c1a9d1 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6051,7 +6051,7 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">, // These options cannot be marshalled, because they are used to set up the LangOptions defaults. def finclude_default_header : Flag<["-"], "finclude-default-header">, - HelpText<"Include default header file for OpenCL and HLSL">; + HelpText<"Include default header file for OpenCL">; def fdeclare_opencl_builtins : Flag<["-"], "fdeclare-opencl-builtins">, HelpText<"Add OpenCL builtin function declarations (experimental)">; @@ -6780,8 +6780,6 @@ class DXCJoinedOrSeparate<string name> : Option<["/", "-"], name, def dxc_help : Option<["/", "-", "--"], "help", KIND_JOINED>, Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>, Alias<help>, HelpText<"Display available options">; -def dxc_no_stdinc : DXCFlag<"hlsl-no-stdinc">, - HelpText<"HLSL only. Disables all standard includes containing non-native compiler types and functions.">; def Fo : DXCJoinedOrSeparate<"Fo">, Alias<o>, HelpText<"Output object file">; def dxil_validator_version : Option<["/", "-"], "validator-version", KIND_SEPARATE>, diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index 7549f3f2e23b4..7791bff388be7 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -117,8 +117,6 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang, Opts.Digraphs = Std.hasDigraphs(); Opts.HLSL = Lang == Language::HLSL; - if (Opts.HLSL && Opts.IncludeDefaultHeader) - Includes.push_back("hlsl.h"); // Set OpenCL Version. Opts.OpenCL = Std.isOpenCL(); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index a8706215bf605..5106c0e327b87 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3484,9 +3484,6 @@ static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs, for (const auto &Arg : ForwardedArguments) if (const auto *A = Args.getLastArg(Arg)) A->renderAsInput(Args, CmdArgs); - // Add the default headers if dxc_no_stdinc is not set. - if (!Args.hasArg(options::OPT_dxc_no_stdinc)) - CmdArgs.push_back("-finclude-default-header"); } static void RenderARCMigrateToolOptions(const Driver &D, const ArgList &Args, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index a51d4621ba682..32b084dfedecc 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -4202,10 +4202,6 @@ static void GeneratePreprocessorArgs(PreprocessorOptions &Opts, ((LangOpts.DeclareOpenCLBuiltins && I == "opencl-c-base.h") || I == "opencl-c.h")) continue; - // Don't generate HLSL includes. They are implied by other flags that are - // generated elsewhere. - if (LangOpts.HLSL && I == "hlsl.h") - continue; GenerateArg(Args, OPT_include, I, SA); } diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 4c5e7325d7960..3921f7949a0a9 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -377,10 +377,6 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__HLSL_VERSION", Twine((unsigned)LangOpts.getHLSLVersion())); - if (LangOpts.NativeHalfType) - Builder.defineMacro("__HLSL_ENABLE_16_BIT", - Twine((unsigned)LangOpts.getHLSLVersion())); - // Shader target information // "enums" for shader stages Builder.defineMacro("__SHADER_STAGE_VERTEX", diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index fc321684f0c69..8bf7dd570384f 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -62,11 +62,6 @@ set(hip_files __clang_hip_runtime_wrapper.h ) -set(hlsl_files - hlsl.h - hlsl/hlsl_basic_types.h - ) - set(mips_msa_files msa.h ) @@ -217,7 +212,6 @@ set(files ${cuda_files} ${hexagon_files} ${hip_files} - ${hlsl_files} ${mips_msa_files} ${opencl_files} ${ppc_files} @@ -411,7 +405,6 @@ add_header_target("webassembly-resource-headers" "${webassembly_files}") add_header_target("x86-resource-headers" "${x86_files}") # Other header groupings -add_header_target("hlsl-resource-headers" ${hlsl_files}) add_header_target("opencl-resource-headers" ${opencl_files}) add_header_target("openmp-resource-headers" ${openmp_wrapper_files}) add_header_target("windows-resource-headers" ${windows_only_files}) @@ -545,12 +538,6 @@ install( EXCLUDE_FROM_ALL COMPONENT x86-resource-headers) -install( - FILES ${hlsl_files} - DESTINATION ${header_install_dir} - EXCLUDE_FROM_ALL - COMPONENT hlsl-resource-headers) - install( FILES ${opencl_files} DESTINATION ${header_install_dir} @@ -627,9 +614,6 @@ if (NOT LLVM_ENABLE_IDE) DEPENDS webassembly-resource-headers COMPONENT webassembly-resource-headers) - add_llvm_install_targets(install-hlsl-resource-headers - DEPENDS hlsl-resource-headers - COMPONENT hlsl-resource-headers) add_llvm_install_targets(install-opencl-resource-headers DEPENDS opencl-resource-headers COMPONENT opencl-resource-headers) diff --git a/clang/lib/Headers/hlsl.h b/clang/lib/Headers/hlsl.h deleted file mode 100644 index 0db8a4ed1fe40..0000000000000 --- a/clang/lib/Headers/hlsl.h +++ /dev/null @@ -1,14 +0,0 @@ -//===----- hlsl.h - HLSL definitions --------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _HLSL_H_ -#define _HLSL_H_ - -#include "hlsl/hlsl_basic_types.h" - -#endif //_HLSL_H_ diff --git a/clang/lib/Headers/hlsl/hlsl_basic_types.h b/clang/lib/Headers/hlsl/hlsl_basic_types.h deleted file mode 100644 index 2069990f5c06c..0000000000000 --- a/clang/lib/Headers/hlsl/hlsl_basic_types.h +++ /dev/null @@ -1,64 +0,0 @@ -//===----- hlsl_basic_types.h - HLSL definitions for basic types ----------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _HLSL_HLSL_BASIC_TYPES_H_ -#define _HLSL_HLSL_BASIC_TYPES_H_ - -// built-in scalar data types: - -#ifdef __HLSL_ENABLE_16_BIT -// 16-bit integer. -typedef unsigned short uint16_t; -typedef short int16_t; -#endif - -// unsigned 32-bit integer. -typedef unsigned int uint; - -// 64-bit integer. -typedef unsigned long uint64_t; -typedef long int64_t; - -// built-in vector data types: - -#ifdef __HLSL_ENABLE_16_BIT -typedef int16_t int16_t2 __attribute__((ext_vector_type(2))); -typedef int16_t int16_t3 __attribute__((ext_vector_type(3))); -typedef int16_t int16_t4 __attribute__((ext_vector_type(4))); -typedef uint16_t uint16_t2 __attribute__((ext_vector_type(2))); -typedef uint16_t uint16_t3 __attribute__((ext_vector_type(3))); -typedef uint16_t uint16_t4 __attribute__((ext_vector_type(4))); -#endif - -typedef int int2 __attribute__((ext_vector_type(2))); -typedef int int3 __attribute__((ext_vector_type(3))); -typedef int int4 __attribute__((ext_vector_type(4))); -typedef uint uint2 __attribute__((ext_vector_type(2))); -typedef uint uint3 __attribute__((ext_vector_type(3))); -typedef uint uint4 __attribute__((ext_vector_type(4))); -typedef int64_t int64_t2 __attribute__((ext_vector_type(2))); -typedef int64_t int64_t3 __attribute__((ext_vector_type(3))); -typedef int64_t int64_t4 __attribute__((ext_vector_type(4))); -typedef uint64_t uint64_t2 __attribute__((ext_vector_type(2))); -typedef uint64_t uint64_t3 __attribute__((ext_vector_type(3))); -typedef uint64_t uint64_t4 __attribute__((ext_vector_type(4))); - -#ifdef __HLSL_ENABLE_16_BIT -typedef half half2 __attribute__((ext_vector_type(2))); -typedef half half3 __attribute__((ext_vector_type(3))); -typedef half half4 __attribute__((ext_vector_type(4))); -#endif - -typedef float float2 __attribute__((ext_vector_type(2))); -typedef float float3 __attribute__((ext_vector_type(3))); -typedef float float4 __attribute__((ext_vector_type(4))); -typedef double double2 __attribute__((ext_vector_type(2))); -typedef double double3 __attribute__((ext_vector_type(3))); -typedef double double4 __attribute__((ext_vector_type(4))); - -#endif //_HLSL_HLSL_BASIC_TYPES_H_ diff --git a/clang/test/CodeGenHLSL/basic_types.hlsl b/clang/test/CodeGenHLSL/basic_types.hlsl deleted file mode 100644 index fcb0815c3af57..0000000000000 --- a/clang/test/CodeGenHLSL/basic_types.hlsl +++ /dev/null @@ -1,76 +0,0 @@ -// RUN: %clang_dxc -Tlib_6_7 -fcgl -Fo - %s | FileCheck %s - -// FIXME: check 16bit types once enable-16bit-types is ready. - -// CHECK:@uint_Val = global i32 0, align 4 -// CHECK:@uint64_t_Val = global i64 0, align 8 -// CHECK:@int64_t_Val = global i64 0, align 8 -// CHECK:@int2_Val = global <2 x i32> zeroinitializer, align 8 -// CHECK:@int3_Val = global <3 x i32> zeroinitializer, align 16 -// CHECK:@int4_Val = global <4 x i32> zeroinitializer, align 16 -// CHECK:@uint2_Val = global <2 x i32> zeroinitializer, align 8 -// CHECK:@uint3_Val = global <3 x i32> zeroinitializer, align 16 -// CHECK:@uint4_Val = global <4 x i32> zeroinitializer, align 16 -// CHECK:@int64_t2_Val = global <2 x i64> zeroinitializer, align 16 -// CHECK:@int64_t3_Val = global <3 x i64> zeroinitializer, align 32 -// CHECK:@int64_t4_Val = global <4 x i64> zeroinitializer, align 32 -// CHECK:@uint64_t2_Val = global <2 x i64> zeroinitializer, align 16 -// CHECK:@uint64_t3_Val = global <3 x i64> zeroinitializer, align 32 -// CHECK:@uint64_t4_Val = global <4 x i64> zeroinitializer, align 32 -// CHECK:@float2_Val = global <2 x float> zeroinitializer, align 8 -// CHECK:@float3_Val = global <3 x float> zeroinitializer, align 16 -// CHECK:@float4_Val = global <4 x float> zeroinitializer, align 16 -// CHECK:@double2_Val = global <2 x double> zeroinitializer, align 16 -// CHECK:@double3_Val = global <3 x double> zeroinitializer, align 32 -// CHECK:@double4_Val = global <4 x double> zeroinitializer, align 32 - -#define TYPE_DECL(T) T T##_Val - -#ifdef __HLSL_ENABLE_16_BIT -TYPE_DECL(uint16_t); -TYPE_DECL(int16_t); -#endif - -// unsigned 32-bit integer. -TYPE_DECL(uint); - -// 64-bit integer. -TYPE_DECL(uint64_t); -TYPE_DECL(int64_t); - -// built-in vector data types: - -#ifdef __HLSL_ENABLE_16_BIT -TYPE_DECL(int16_t2 ); -TYPE_DECL(int16_t3 ); -TYPE_DECL(int16_t4 ); -TYPE_DECL( uint16_t2 ); -TYPE_DECL( uint16_t3 ); -TYPE_DECL( uint16_t4 ); -#endif - -TYPE_DECL( int2 ); -TYPE_DECL( int3 ); -TYPE_DECL( int4 ); -TYPE_DECL( uint2 ); -TYPE_DECL( uint3 ); -TYPE_DECL( uint4 ); -TYPE_DECL( int64_t2 ); -TYPE_DECL( int64_t3 ); -TYPE_DECL( int64_t4 ); -TYPE_DECL( uint64_t2 ); -TYPE_DECL( uint64_t3 ); -TYPE_DECL( uint64_t4 ); - -#ifdef __HLSL_ENABLE_16_BIT -TYPE_DECL(half2 ); -TYPE_DECL(half3 ); -TYPE_DECL(half4 ); -#endif - -TYPE_DECL( float2 ); -TYPE_DECL( float3 ); -TYPE_DECL( float4 ); -TYPE_DECL( double2 ); -TYPE_DECL( double3 ); -TYPE_DECL( double4 ); diff --git a/clang/test/Driver/hlsl_no_stdinc.hlsl b/clang/test/Driver/hlsl_no_stdinc.hlsl deleted file mode 100644 index ec6d0612a9ed7..0000000000000 --- a/clang/test/Driver/hlsl_no_stdinc.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %clang_dxc -Tlib_6_7 -fcgl -Fo - %s -### 2>&1 | FileCheck %s --check-prefix=STDINC -// RUN: %clang_dxc -Tlib_6_7 -hlsl-no-stdinc -fcgl -Fo - %s -### 2>&1 | FileCheck %s --check-prefix=NOSTDINC - -// RUN: %clang -cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump -o - %s -verify - -// Make sure hlsl-no-stdinc is translated into finclude-default-header. -// STDINC:"-finclude-default-header" -// NOSTDINC-NOT:"-finclude-default-header" - -// Make sure uint not work when finclude-default-header is off. -// expected-error@+1 {{unknown type name 'uint'}} -uint a; diff --git a/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn index 690536cdfcbe6..03e0cfec3a2ad 100644 --- a/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn @@ -154,8 +154,6 @@ copy("Headers") { "hexagon_circ_brev_intrinsics.h", "hexagon_protos.h", "hexagon_types.h", - "hlsl.h", - "hlsl/hlsl_basic_types.h", "hresetintrin.h", "htmintrin.h", "htmxlintrin.h", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits