Dan Gohman-2 wrote:> > You don't need a ModulePass to modify a CFG. A MachineFunctionPass > is fine for this. >Well, okay. But I need to insert some BasicBlock that contains the error handling (that the runtime check jumpts to on failure). Just putting another MachineBasicBlock at the beginning of some arbitrary MachineFunction doesn't seem to be the right way to go, does it? -- View this message in context: http://www.nabble.com/code-altering-Passes-for-llc-tp24778261p24788337.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Does the error function *have* to be auto-generated in your pass? Perhaps the original code should use invokes, and your pass insert the error check with a jne to the "unwind" block. On Mon, Aug 3, 2009 at 5:18 AM, Artjom Kochtchi<artjom.kochtchi at googlemail.com> wrote:> > > Dan Gohman-2 wrote: >> >> You don't need a ModulePass to modify a CFG. A MachineFunctionPass >> is fine for this. >> > Well, okay. But I need to insert some BasicBlock that contains the error > handling (that the runtime check jumpts to on failure). Just putting another > MachineBasicBlock at the beginning of some arbitrary MachineFunction doesn't > seem to be the right way to go, does it? > -- > View this message in context: http://www.nabble.com/code-altering-Passes-for-llc-tp24778261p24788337.html > Sent from the LLVM - Dev mailing list archive at Nabble.com. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Kenneth Uildriks wrote:> > Does the error function *have* to be auto-generated in your pass? > Perhaps the original code should use invokes, and your pass insert the > error check with a jne to the "unwind" block. >If I understand correctly, unwind is some kind of exception handling in LLVM IR? I'm not sure if this is the right thing. First, I include runtime checks inst programs that are already written during their compilation (with my modified version of LLVM). Second, the error handling is a (context independent) program termination, so it is of no use to replicate it at every call. So I was searching for a possibility to include an additional (Machine)BasicBlock (or rather a MachineFunction?) somewhere in the program that contains the program termination and that I can jump to on check failure. Can't I do that during a Pass in llc? -Artjom -- View this message in context: http://www.nabble.com/code-altering-Passes-for-llc-tp24778261p24845838.html Sent from the LLVM - Dev mailing list archive at Nabble.com.