Respected Dr. Criswell, My problem is that the output of following code looks nothing like any opcode: *for(MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ) { MachineInstr *mi = I; int op = mi->getOpcode(); std::cout << op << '\t'; }* I need to identify specific instructions in my MachineFunctionPass and I was hoping that I can do that by using *getOpcode(). *I am kinda stuck at this point. Kindly guide me ! Thank you ! On Thu, Oct 2, 2014 at 4:37 PM, John Criswell <jtcriswel at gmail.com> wrote:> Dear Sachin, > > Your description of the problem contains too few details; no one will be > able to diagnose the problem you're having. You need to provide more > information on what, exactly, is not working as you expected. > > Regards, > > John Criswell > > > On 10/2/14, 5:11 PM, sachin arora wrote: > > Hello, > > I am writing a MachineFunctionPass that inspects the generated machine > code, and examines each opcode and its corresponding operands. If the > 'instruction + operands' match a particular sequence, then the pass should > replace them with a fixed instruction + operands sequence. I tried using > MachineInstr's getOpcode and getOperand functions but the pass didn't work > as expected. > > Kindly tell me how to proceed or point to appropriate references. Thank > you ! > > -- > Regards, > Sachin > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > -- > John Criswell > Assistant Professor > Department of Computer Science, University of Rochesterhttp://www.cs.rochester.edu/u/criswell > >-- Regards, Sachin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141002/18d0aea2/attachment.html>
Hi Sachin,> int op = mi->getOpcode();This is a target-specific opcode, and corresponds to one of the values defined in (from a CMake build directory) lib/Target/XYZ/XYZGenInstrInfo.inc. The easiest way to find out which is actually to use MachineInstr::dump (and/or "llc -debug" from the command-line to print it out automatically); if it prints something like (to pick a completely random example from AArch64): %X1<def> = LDRXui <fi#3>, 0; mem:LD8[%result] dbg:blockstret.c:20: Then you'd want to compare "op" against "AArch64::LDRXui" Cheers. Tim.
Thank you Mr. Tim. Is "AArch64" a namespace? Because when I tried "X86::MOV", it gave me an error saying that first define X86 namespace. Sorry if I sound stupid but I am new to LLVM. Thank you again. On Thu, Oct 2, 2014 at 8:16 PM, Tim Northover <t.p.northover at gmail.com> wrote:> Hi Sachin, > > > int op = mi->getOpcode(); > > This is a target-specific opcode, and corresponds to one of the values > defined in (from a CMake build directory) > lib/Target/XYZ/XYZGenInstrInfo.inc. > > The easiest way to find out which is actually to use > MachineInstr::dump (and/or "llc -debug" from the command-line to print > it out automatically); if it prints something like (to pick a > completely random example from AArch64): > > %X1<def> = LDRXui <fi#3>, 0; mem:LD8[%result] dbg:blockstret.c:20: > > Then you'd want to compare "op" against "AArch64::LDRXui" > > Cheers. > > Tim. >-- Regards, Sachin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141003/8322f0aa/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass
- [LLVMdev] Need guidance regarding MachineFunctionPass implementation
- Building SPEC CPU2006 Fortran benchmarks with llvm