|
From: Mohit T. <moh...@gm...> - 2006-11-14 09:56:47
|
Hi,
I wonder if there is a way to insert the equivalent of "if (tmp>100) {
store(data,addr); }" into the client binary, without doing a CCALL. A way of
maybe inserting the equivalent of following IRStmts:
1. Compute_condition;
2. JZERO address_offset; store(data,addr) --->
3. Store(data, addr) |
4. Proceed as usual <--- |
I checked the older UInstrns, and they had a Jzero and Inceip instructions
that would have been useful...but the IR doesn't seem to have it.
Thanks,
Mohit
|
|
From: Julian S. <js...@ac...> - 2006-11-14 11:46:07
|
On Tuesday 14 November 2006 09:56, Mohit Tiwari wrote:
> Hi,
>
> I wonder if there is a way to insert the equivalent of "if (tmp>100) {
> store(data,addr); }" into the client binary, without doing a CCALL. A way
> of
>
> maybe inserting the equivalent of following IRStmts:
> 1. Compute_condition;
> 2. JZERO address_offset; store(data,addr) --->
> 3. Store(data, addr) |
> 4. Proceed as usual <--- |
>
> I checked the older UInstrns, and they had a Jzero and Inceip instructions
> that would have been useful...but the IR doesn't seem to have it.
There is no direct way to do that in IR, since it isn't necessary for
the supported architectures (x86/amd64/ppc32/ppc64) and it seriously
complicates IR optimisation and backend code generation.
However you can probably achieve what you want like this
nc = compute negated condition;
IRStmt_Exit( nc, next_insn_address )
IRStmt_Store
end of this IR block
so the instruction after the conditional store is starts a new IR block.
J
|
|
From: Mohit T. <moh...@gm...> - 2006-11-14 13:49:10
|
> > > There is no direct way to do that in IR, since it isn't necessary for > the supported architectures (x86/amd64/ppc32/ppc64) and it seriously > complicates IR optimisation and backend code generation. > > However you can probably achieve what you want like this > > nc = compute negated condition; > IRStmt_Exit( nc, next_insn_address ) > IRStmt_Store > end of this IR block > > so the instruction after the conditional store is starts a new IR block. > > J How do I know the address of the next instruction that would have executed had the store not been inserted? Will the insertion of the store affect its value? ps:The IRStmt_Exit has an IRExpr guard as its input. I assume the jump will happen if it is >0. Is that right? Mohit ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Julian S. <js...@ac...> - 2006-11-14 15:48:34
|
> How do I know the address of the next instruction that would have executed > had the store not been inserted? Look at the IRStmt.IMark for the current instruction. That gives you the address and size of the current instruction, so add them. > Will the insertion of the store affect its value? Affect the value of what? > ps:The IRStmt_Exit has an IRExpr guard as its input. I assume the jump will > happen if it is >0. Is that right? Yes. In fact the guard is forced to have type Ity_I1 (a 1-bit integer) so the only possible values are 0 and 1. J |