[HLSL][Matrix] Add APValue and ConstExpr evaluator support for matrices (#178762)
Fixes #168935
This PR adds basic support for matrix APValues and a ConstExpr evaluator
for matrices.
- ConstExpr evaluation changes:
- Matrix initializer list
- Matrix HLSL elementwise cast
- Matrix HLSL aggregate splat
- Vector HLSL matrix truncation
- Int HLSL matrix truncation
- Float HLSL matrix truncation
- Matrix APValue:
- AST dumper and serialization
- Value flattening
Note that APValue matrices hold its elements in row-major order
irrespective of the `-fmatrix-memory-layout` flag.
The `-fmatrix-memory-layout` is for codegen, not semantics, so the
decision of which memory layout to use for the matrix APValue can be
independent of the memory layout for codegen.
There are also a number of places expecting switch case coverage over
all APValues but which do not currently support matrix APValues. I have
added placeholder llvm_unreachables to these places for the matrix
APValue, as these places can not currently be exercised in clang tests
(AFAIK).
Assisted-by: claude-opus-4.5