From: Pallavi J. <pal...@gm...> - 2006-11-28 01:32:21
|
Thanks, Matt! I tried replacing a statement of stmtkind Instr[instr_list] with a block that had a statement for each of the instructions in the instr_list plus some other statements depending on the kind of instructions in instr_list. When I do a ChangeTo, it works fine. But when I try to visit the children by doing a ChangeDoChildrenPost, my program hangs. I was thus curious to know if visiting the children also means visiting the statements in the statement block that I used to replace the current statement? Because if this is the case, then I might be facing infinite recursion in my code. Thanks, Pallavi On 11/25/06, Matt Harren <ma...@cs...> wrote: > Hi Pallavi, > > The visitor has no analog to queueInstr for statements. Inserting a > statement is more work than inserting an instruction: you have to be > careful with labels, and if you want to insert a statement into the middle > of an instruction list you'll have to first break that list into separate > Instr statements. > > Often, the easiest workaround is to put your If code in an inline > function, and use queueInstr to insert a call to the function. > > Cheers, > Matt > > > -----Original Message----- > > From: cil...@li... > > [mailto:cil...@li...] On Behalf Of > > Pallavi Joshi > > Sent: Saturday, November 25, 2006 5:37 PM > > To: Nathan Cooprider; cil...@li... > > Subject: Re: [CIL users] Problem with Call and lvalue > > > > Thanks, that did work :) > > > > Here is another question I have: > > > > Using the visitor is it possible to specify that some > > statements should be queued to be inserted before the current > > instruction or statement being visited? From the > > documentation I know that we can insert instructions before > > an instruction or statement being visited but I want to > > insert an If statement before a particular kind of Set > > instruction and so wanted to know how that can be done? > > > > Thanks, > > > > Pallavi > > > > On 11/25/06, Nathan Cooprider <co...@cs...> wrote: > > > Call wants an "lval option" type as its first argument. This is > > > because you can call a function like this "x=foo()" or like > > this "foo()" > > > depending on what you want. > > > > > > So, CIL wants something like this > > > Call(Some(Var(makeFormalVar fdec "^" uintType), > > NoOffset),.....) (... > > > represents other arguments) > > > > > > Nathan > > > > > > Pallavi Joshi wrote: > > > > Hi, > > > > > > > > I am quite new to CIL and would be grateful if someone > > helps me out > > > > with this problem: > > > > > > > > Call expects a lvalue as its first argument and when I write > > > > Call((Var(makeFormalVar fdec "^" uintType), NoOffset),.....) (... > > > > represents other arguments), > > > > I get this error for the first argument: > > > > This expression has type Cil.lhost*Cil.offset but is here > > used with > > > > type Cil.lval option. > > > > I am not sure how else can I pass a lvalue as the first argument? > > > > > > > > Thanks, > > > > > > > > Pallavi > > > > > > > > > > -------------------------------------------------------------------- > > > > ----- Take Surveys. Earn Cash. Influence the Future of IT Join > > > > SourceForge.net's Techsay panel and you'll get the chance > > to share > > > > your opinions on IT & business topics through brief surveys - and > > > > earn cash > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=D > > > > EVDEV _______________________________________________ > > > > CIL-users mailing list > > > > CIL...@li... > > > > https://lists.sourceforge.net/lists/listinfo/cil-users > > > > > > > > > > -------------------------------------------------------------- > > ----------- > > Take Surveys. Earn Cash. Influence the Future of IT Join > > SourceForge.net's Techsay panel and you'll get the chance to > > share your opinions on IT & business topics through brief > > surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge > &CID=DEVDEV > > _______________________________________________ > > CIL-users mailing list > > CIL...@li... > > https://lists.sourceforge.net/lists/listinfo/cil-users > > > > |