Lines Matching refs:instr
146 bool WantToInstrument(instr_t *instr) {
148 switch (instr_get_opcode(instr)) {
156 if (instr_is_label(instr))
159 CHECK(instr_ok_to_mangle(instr) == true);
161 if (instr_writes_memory(instr)) {
162 for (int d = 0; d < instr_num_dsts(instr); d++) {
163 opnd_t op = instr_get_dst(instr, d);
175 void InstrumentMops(void *drcontext, instrlist_t *bb, instr_t *instr, opnd_t op,
178 uint flags = instr_get_arith_flags(instr);
190 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
191 dr_save_arith_flags_to_xax(drcontext, bb, instr);
192 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_3);
193 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
220 // Pick R2 that's not R1 or used by the operand. It's OK if the instr uses
221 // R2 elsewhere, since we'll restore it before instr.
237 dr_save_reg(drcontext, bb, instr, R1, SPILL_SLOT_1);
239 dr_save_reg(drcontext, bb, instr, R2, SPILL_SLOT_2);
242 CHECK(drutil_insert_get_mem_addr(drcontext, bb, instr, op, R1, R2));
243 PRE(instr, mov_imm(drcontext, opnd_create_reg(R2),
245 PRE(instr, and(drcontext, opnd_create_reg(R1), opnd_create_reg(R2)));
251 PRE(instr,
257 PRE(instr,
263 dr_restore_reg(drcontext, bb, instr, R1, SPILL_SLOT_1);
264 dr_restore_reg(drcontext, bb, instr, R2, SPILL_SLOT_2);
270 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
271 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_3);
272 dr_restore_arith_flags_from_xax(drcontext, bb, instr);
273 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
280 void InstrumentReturn(void *drcontext, instrlist_t *bb, instr_t *instr) {
281 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
285 dr_insert_get_seg_base(drcontext, bb, instr, DR_SEG_FS, DR_REG_XAX);
289 PRE(instr,
293 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
300 instr_t *instr) {
301 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
305 dr_insert_get_seg_base(drcontext, bb, instr, DR_SEG_FS, DR_REG_XAX);
310 PRE(instr,
316 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
416 instr_t *instr;
417 for (instr = instrlist_first(bb); instr; instr = instr_get_next(instr)) {
418 dr_printf("opcode: %d\n", instr_get_opcode(instr));