aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/DecoderEmitter.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-08 06:06:14 +0100
committerGitHub <noreply@github.com>2025-03-08 06:06:14 +0100
commitd08cf7900d2aaff9e7483ea74a58871edbdc45f2 (patch)
tree33dbefd26615d049dc2b8dd82578bebe2d1139c6 /llvm/utils/TableGen/DecoderEmitter.cpp
parent7602d781b03427052c44537fa4b9c2a6da15697c (diff)
downloadllvm-d08cf7900d2aaff9e7483ea74a58871edbdc45f2.zip
llvm-d08cf7900d2aaff9e7483ea74a58871edbdc45f2.tar.gz
llvm-d08cf7900d2aaff9e7483ea74a58871edbdc45f2.tar.bz2
[clang][bytecode] Implement __builtin_constant_p (#130143)
Use the regular code paths for interpreting. Add new instructions: `StartSpeculation` will reset the diagnostics pointers to `nullptr`, which will keep us from reporting any diagnostics during speculation. `EndSpeculation` will undo this. The rest depends on what `Emitter` we use. For `EvalEmitter`, we have no bytecode, so we implement `speculate()` by simply visiting the first argument of `__builtin_constant_p`. If the evaluation fails, we push a `0` on the stack, otherwise a `1`. For `ByteCodeEmitter`, add another instrucion called `BCP`, that interprets all the instructions following it until the next `EndSpeculation` instruction. If any of those instructions fails, we jump to the `EndLabel`, which brings us right before the `EndSpeculation`. We then push the result on the stack.
Diffstat (limited to 'llvm/utils/TableGen/DecoderEmitter.cpp')
0 files changed, 0 insertions, 0 deletions