** Patch destination register for a TESTSET instruction. ** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). ** Otherwise, if 'reg' is not 'NO_REG', set it as the destination ** register. Otherwise, change instruction to a simple 'TEST' (produces ** no register value) */
| 256 | ** no register value) |
| 257 | */ |
| 258 | static int patchtestreg (FuncState *fs, int node, int reg) { |
| 259 | Instruction *i = getjumpcontrol(fs, node); |
| 260 | if (GET_OPCODE(*i) != OP_TESTSET) |
| 261 | return 0; /* cannot patch other instructions */ |
| 262 | if (reg != NO_REG && reg != GETARG_B(*i)) |
| 263 | SETARG_A(*i, reg); |
| 264 | else { |
| 265 | /* no register to put value or register already has the value; |
| 266 | change instruction to simple test */ |
| 267 | *i = CREATE_ABCk(OP_TEST, GETARG_B(*i), 0, 0, GETARG_k(*i)); |
| 268 | } |
| 269 | return 1; |
| 270 | } |
| 271 | |
| 272 | |
| 273 | /* |
no test coverage detected