Revision bedcb920045dd68f522e29d90fc3804f84bc08d0 authored by Tim Foley on 25 March 2019, 21:39:13 UTC, committed by GitHub on 25 March 2019, 21:39:13 UTC
An `enum` case currently lowers to the IR as the value of its tag expression, so if we have: ```hlsl enum E { X = 99, } ``` then `X` will lower as IR for the expression `99` which is just a literal. If instead we have: ```hlsl enum E { X = 99u, } ``` then after type checking the expression is `int(99u)`, which will get emitted to the global (module) scope as a cast/conversion instruction, that then gets referenced at the use sites of `E.X`. The emit logic wasn't set up to handle the case of referencing something directly from the global scope, so this change makes it so that side-effect-free global instructions are treated just like literal constants. This simple handling is fine for now since it will only apply to `enum` tag values (true global constants declared with `static const` have different handling).
1 parent 3ae31a6
File | Mode | Size |
---|---|---|
docs | ||
examples | ||
external | ||
source | ||
tests | ||
tools | ||
.editorconfig | -rw-r--r-- | 937 bytes |
.gitattributes | -rw-r--r-- | 95 bytes |
.gitignore | -rw-r--r-- | 407 bytes |
.gitmodules | -rw-r--r-- | 406 bytes |
.travis.yml | -rw-r--r-- | 1.7 KB |
CODE_OF_CONDUCT.md | -rw-r--r-- | 3.1 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
Makefile | -rw-r--r-- | 6.0 KB |
README.md | -rw-r--r-- | 6.7 KB |
appveyor.yml | -rw-r--r-- | 3.7 KB |
premake5.lua | -rw-r--r-- | 25.3 KB |
slang-com-helper.h | -rw-r--r-- | 4.8 KB |
slang-com-ptr.h | -rw-r--r-- | 4.8 KB |
slang.h | -rw-r--r-- | 88.4 KB |
slang.sln | -rw-r--r-- | 9.8 KB |
test.bat | -rw-r--r-- | 1.4 KB |
travis_build.sh | -rw-r--r-- | 304 bytes |
travis_test.sh | -rw-r--r-- | 435 bytes |
Computing file changes ...