# HLSL compiler specification (optimizations)

For example, in some codes I have different variables that get a constant value (just to let myself adjust the shader with other values) and I use them later in some mathematical expressions, but actually it can be precalculated earlier. Does the compiler do such thing?

It's just an example, I would like to know most of these things.

I don't think any such spec exists publicly, but you can disassemble your compiled shaders using the D3DDisassemble API function, or using fxc /Fc at the command line. If you write some example shaders and look at the disassembly, this will give you some idea of the optimizations it does.