I wanted to avoid adding too many opcodes for bitint, complex, vector, etc. types so I implemented this by just emitting more ops.
Details
Diff Detail
Event Timeline
| clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
|---|---|---|
| 1165 | Since complex types are arrays with two elements, we can't dereference them like normal. This change just ignore the dereference. I was wondering if it would be better to add an opcode to dereference it so we have [real, imag] on the stack and then callers that operate on such complex rvalues can pop(); pop(); to get the values. | |
LGTM aside from a minor cleanup.
| clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
|---|---|---|
| 1165 |
That might be worthwhile as an optimization, but I suppose we can wait to see how often complex is used in constant expressions before deciding what to do there? | |
| clang/lib/AST/Interp/ByteCodeExprGen.h | ||
| 272–275 | This form does the assertion for you. | |
This form does the assertion for you.