On Sat, Apr 19, 2008 at 2:16 PM, Chris Lattner <sabre at nondot.org> wrote:> No. The reason we don't allow this is because it violates the CFG.So if I *don't* violate the CFG, would I still need to do something close to "big and nasty"? ; save the address of %otherPath to use later call @llvm.checkpoint(label %otherPath) ; trick the rest of the compiler to think data flows to both paths *from here* br i1 @opaqueButAlwaysTrue, label %normalPath, label %otherPath normalPath: ; do some work.. call void @work() ; rollback and erase any data changes since the checkpoint and ; continue at the label given to @checkpoint call @llvm.rollback() unreachable otherPath: ; we arrive here because @rollback reverted data to @checkpoint ; and it said to go to label %otherPath Right now I'm looking into making a new Inst that inherits BranchInst because I can give it BasicBlock*/labels and potentially change the CodeGen to emit a series of x86 instructions that does the functionality while not being optimized away by the rest of the compiler. Ed
On Apr 19, 2008, at 1:30 PM, Edward Lee wrote:> On Sat, Apr 19, 2008 at 2:16 PM, Chris Lattner <sabre at nondot.org> > wrote: >> No. The reason we don't allow this is because it violates the CFG. > So if I *don't* violate the CFG, would I still need to do something > close to "big and nasty"?It sounds like you're doing something STM like, have you contacted Torvald to see if he has ideas or insight? http://llvm.org/pubs/2008-02-23-TRANSACT-TangerObjBased.html -Chris> ; save the address of %otherPath to use later > call @llvm.checkpoint(label %otherPath) > ; trick the rest of the compiler to think data flows to both paths > *from here* > br i1 @opaqueButAlwaysTrue, label %normalPath, label %otherPath > > normalPath: > ; do some work.. > call void @work() > ; rollback and erase any data changes since the checkpoint and > ; continue at the label given to @checkpoint > call @llvm.rollback() > unreachable > > otherPath: > ; we arrive here because @rollback reverted data to @checkpoint > ; and it said to go to label %otherPath > > Right now I'm looking into making a new Inst that inherits BranchInst > because I can give it BasicBlock*/labels and potentially change the > CodeGen to emit a series of x86 instructions that does the > functionality while not being optimized away by the rest of the > compiler. > > Ed > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Sat, Apr 19, 2008 at 3:44 PM, Chris Lattner <sabre at nondot.org> wrote:> It sounds like you're doing something STM like, have you contacted > Torvald to see if he has ideas or insight? > http://llvm.org/pubs/2008-02-23-TRANSACT-TangerObjBased.htmlYeah, this is TM-like with the begin/end/abort+rollback. Thanks for the pointer, but it seems like Tanger's implementation doesn't support explicit aborts probably "Because our txns never abort." So there wasn't a need to give a label to tanger_begin() to lead to an abort block. Ed