diff options
author | Matt Turner <[email protected]> | 2014-05-30 19:26:30 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-06-03 17:58:34 -0700 |
commit | ac25cf55aff6ec81bc36dc9f3257b0c7a6dd17d3 (patch) | |
tree | 88335feeaa1edfaeff95611b08b3069976cb4085 /src/glsl/s_expression.cpp | |
parent | 773544f0e95e6732e27ce8f6c4567f221f0d2dac (diff) |
glsl: Make most ir_instruction::as_subclass() functions non-virtual.
There are several common ways to check whether an object is a particular
subclass: dynamic_cast<>, the as_subclass() pattern, or explicit enum
tags. We originally used the virtual as_subclass methods, but later
added enum tags as they are much nicer for debugging.
Since we have the enum tags, we don't necessarily need to use virtual
functions to implement the as_subclass() methods. We can just check the
tag and return the pointer or NULL.
This saves 18 entries in the vtable, and instead of two pointer
dereferences per as_subclass() call most are only three inline
instructions.
Compile time of sam3/112.frag (the longest compile in a recent shader-db
run) is reduced by 5% from 348 to 329 ms (n=500).
perf stat of this workload shows:
24.14% reduction in iTLB-loads: 285,543 -> 216,606
42.55% reduction in iTLB-load-misses: 18,785 -> 10,792
Reviewed-by: Juha-Pekka Heikkila <[email protected]>
Diffstat (limited to 'src/glsl/s_expression.cpp')
0 files changed, 0 insertions, 0 deletions