Commit Graph

5 Commits

Author SHA1 Message Date
Chris Bieneman 3efad612d2 [HLSL] Pointers are unsupported in HLSL
HLSL does not support pointers or references. This change generates
errors in sema for generating pointer, and reference types as well as
common operators (address-of, dereference, arrow), which are used with
pointers and are unsupported in HLSL.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D123167
2022-04-14 13:32:51 -05:00
Chris Bieneman 1fdf952dee [HLSL] Add Semantic syntax, and SV_GroupIndex
HLSL has a language feature called Semantics which get attached to
declarations like attributes and are used in a variety of ways.

One example of semantic use is here with the `SV_GroupIndex` semantic
which, when applied to an input for a compute shader is pre-populated
by the driver with a flattened thread index.

Differential Revision: https://reviews.llvm.org/D122699

# Conflicts:
#	clang/include/clang/Basic/Attr.td
#	clang/include/clang/Basic/AttrDocs.td
2022-04-14 10:21:58 -05:00
Chris Bieneman 19054163e1 [HLSL] Further improve to numthreads diagnostics
This adds diagnostics for conflicting attributes on the same
declarataion, conflicting attributes on a forward and final
declaration, and defines a more narrowly scoped HLSLEntry attribute
target.

Big shout out to @aaron.ballman for the great feedback and review on
this!
2022-03-31 11:34:01 -05:00
Chris Bieneman ff6696c842 Expanding HLSL attribute diagnostics
Updating the diagnostics as per the feedback on
https://reviews.llvm.org/D122627.

This change correctly handles missing argument lists, and changes the
subject for the `numthreads` attribute to be global functions.

I did not handle applying the attribute to template functions because
that currently fails parsing in a way that is consisetent with the
current DXC codebase (Microsoft attributes are not supported on
templates).

A future improvement to the diagnostic maybe warranted.
2022-03-30 14:15:01 -05:00
Chris Bieneman 94189b42cc [HLSL] Fix MSFT Attribute parsing, add numthreads
HLSL uses Microsoft-style attributes `[attr]`, which clang mostly
ignores. For HLSL we need to handle known Microsoft attributes, and to
maintain C/C++ as-is we ignore unknown attributes.

To utilize this new code path, this change adds the HLSL `numthreads`
attribute.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D122627
2022-03-29 17:17:19 -05:00