[PATCH] D51320: [WebAssembly] Made disassembler only use stack instructions.
Jacob Gravelle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 27 14:48:43 PDT 2018
jgravelle-google added inline comments.
================
Comment at: utils/TableGen/WebAssemblyDisassemblerEmitter.cpp:94
+ for (size_t J = 0; J < OperandTable.size(); ++J) {
+ if (J + CurOperandList.size() <= OperandTable.size()) {
+ for (size_t K = 0; K < CurOperandList.size(); ++K) {
----------------
Could flip these:
```
if (CurOperandList.size() < OperandTable.size()) {
for (size_t J = 0; J < OperandTable.size() - CurOperandList.size(); ++J) {
```
which is iotally more efficient. Probably more readable the way you have it though. Was thinking we could omit the `if` entirely, but size isn't signed.
================
Comment at: utils/TableGen/WebAssemblyDisassemblerEmitter.cpp:96
+ for (size_t K = 0; K < CurOperandList.size(); ++K) {
+ if (OperandTable[J + K] != CurOperandList[K]) goto nomatch;
+ }
----------------
Oh no, goto
This one's not too dreadful, but I think this is even easier:
```
size_t K;
for (K = 0; K < CurOperandList.size(); ++K) {
if (OperandTable[J + K] != CurOperandList[K])
break;
}
if (K == CurOperandList.size()) {
OperandStart = J;
break;
}
```
Repository:
rL LLVM
https://reviews.llvm.org/D51320
More information about the llvm-commits
mailing list