Hello, I'm trying to print the instruction count of a bytecode file using the 2.4 release of LLVM. I found llvm-2.4/lib/Analysis/Instcount.cpp but I'm not sure what to do with it. I also looked at llvm-bcanalyzer. The documentation says this command is supposed to print the instruction count in the summary, but it doesn't seem to be doing so. Does anyone know what I should be doing? --Patrick
Patrick Simmons wrote:> Hello, > > I'm trying to print the instruction count of a bytecode file using the > 2.4 release of LLVM. I found llvm-2.4/lib/Analysis/Instcount.cpp but > I'm not sure what to do with it. I also looked at llvm-bcanalyzer. The > documentation says this command is supposed to print the instruction > count in the summary, but it doesn't seem to be doing so. > > Does anyone know what I should be doing? >Looking at the LLVM 2.5 version, it prints out the count of the number of instructions as part of its statistics. To run it on a bitcode file, you should be able to do the following: opt -stats -analyze -instcount <bitcodefile> The -stats option tells opt to print statistics collected by each pass. The -analyze option tells opt that it is only doing analysis and not any transformation. The -instcount is the command line option to run the code in InstCount.cpp (notice the RegisterPass line in the source code; this assigns a command line option to the pass for use in opt). -- John T.> --Patrick > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
John Criswell wrote:> Patrick Simmons wrote: > >> Hello, >> >> I'm trying to print the instruction count of a bytecode file using the >> 2.4 release of LLVM. I found llvm-2.4/lib/Analysis/Instcount.cpp but >> I'm not sure what to do with it. I also looked at llvm-bcanalyzer. The >> documentation says this command is supposed to print the instruction >> count in the summary, but it doesn't seem to be doing so. >> >> Does anyone know what I should be doing? >> >> > Looking at the LLVM 2.5 version, it prints out the count of the number > of instructions as part of its statistics. > > To run it on a bitcode file, you should be able to do the following: > > opt -stats -analyze -instcount <bitcodefile> > > The -stats option tells opt to print statistics collected by each pass. > The -analyze option tells opt that it is only doing analysis and not any > transformation. The -instcount is the command line option to run the > code in InstCount.cpp (notice the RegisterPass line in the source code; > this assigns a command line option to the pass for use in opt). > > -- John T. > >It works; thanks! --Patrick