search for: getopcodename

Displaying 20 results from an estimated 27 matches for "getopcodename".

2006 May 09
1
[LLVMdev] Instruction::getOpcodeName()
When compiling a release version on Linux with GCC 3.4.4, I get the following warnings repeated multiple times when linking LLVMCore.o: /usr/bin/ld: `.gnu.linkonce.t._ZNK4llvm11Instruction13getOpcodeNameEv' referenced in section `.gnu.linkonce.r._ZNK4llvm11Instruction13getOpcodeNameEv' of /proj/llvm/build/lib/VMCore/Release/Instruction.o: defined in discarded section `.gnu.linkonce.t._ZNK4llvm11Instruction13getOpcodeNameEv' of /proj/llvm/build/lib/VMCore/Release/Instruction.o This is...
2017 Jun 09
2
Get segfault with ModulePass
...ass : public ModulePass { public: static char ID; DebugPass() : ModulePass(ID) {} virtual bool runOnModule(Module &M) override { DILocation* loc; for (auto &F : M) { for (auto &B : F) { for (auto &I : B) { errs() << "op_code: " << I.getOpcodeName() << '\n'; loc = I.getDebugLoc(); if (loc != nullptr) { errs() << "file: " << loc->getFilename() << '\n'; } for (const auto& use : I.uses()) { if (const CallInst* c = dyn_cast<CallInst>(use.getUser(...
2017 Jun 11
2
Get segfault with ModulePass
...:GremlinPass::runOnModule(llvm::Module&) /home/gerion/sourcecode/debug-pass/debugpass/DebugPass.cpp:41:0 ... -------------------- > FWIW, StringRefs aren't guaranteed to be nul-terminated. They support > a similar comparison API as std::strings, though, so things like > `user->getOpcodeName() == "<Invalid operator>"` should just work™. getOpcodeName returns a const char* (only reason I use strcmp, not a big fan of this function either). Gerion > On Fri, Jun 9, 2017 at 4:54 PM, Gerion Entrup via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > Hi,...
2013 Oct 28
2
[LLVMdev] Are Opcode and register mappings exposed anywhere?
I'm iterating over MCInsts and I'd like to examine particular instructions. For example, I'd like to look at all x86 CALL64m instructions. I may be missing something, but it seems like my only option is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I could iterate through the opcodes and build up a table of the ones I'm interested in to avoid string comparisons.) Register mappings to names seem to be even worse. It appears you have to go through MCInstPrinter::printRegName(raw_ostream&, unsigned). Is...
2016 Apr 24
2
Retrieving numeric value of instruction operand
...value of an instruction operand from LLVM IR. this is what the IR looks like for a simple add function that adds two i32 integers define i32 @summ(i32 %a, i32 %b) #0 { entry: %add = add nsw i32 %b, %a ret i32 %add } i would like to know the integer value of %a and %b. I've tried -i->getOpcodeName() which gives me the string add -i->getOperand(0) which gives me the string i32 %b -i->getOperand(0)->getName() which gives me the string a what method exists to get the actual integer value of the operands? for example we called summ(1,2), how to retrieve the values 1 and 2 held in the...
2010 Oct 28
0
[LLVMdev] Landing my new development on the trunk ...
...in > > lib/Transforms/Scalar/OperatorStrengthReduce.cpp > > The algorithm finds reduction opportunities in both array accesses and > explicit multiplications within loops. > > Next, I plan on writing the regression tests. Comments: 1. Please don't top-post. 2. Instruction::getOpcodeName instead of your OpcodeToString function. 3. LLVM already has a significant amount of infrastructure for loop passes; why does this pass have its own code for finding loops? 4. What's the use case for this pass? Can this pass improve performance of generated code beyond the existing -loop-reduc...
2010 Oct 27
2
[LLVMdev] Landing my new development on the trunk ...
Here is the patch for the new Operator Strength Reduction optimization pass that I have written. The bulk of the code is in lib/Transforms/Scalar/OperatorStrengthReduce.cpp The optimization is based on the algorithm described within the paper that can be found here: http://portal.acm.org/citation.cfm?id=504709.504710 Keith D. Cooper , L. Taylor Simpson , Christopher A. Vick, Operator strength
2013 Oct 28
0
[LLVMdev] Are Opcode and register mappings exposed anywhere?
...oway" <s at pahtak.org> wrote: > I'm iterating over MCInsts and I'd like to examine particular > instructions. For example, I'd like to look at all x86 CALL64m > instructions. I may be missing something, but it seems like my only option > is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I > could iterate through the opcodes and build up a table of the ones I'm > interested in to avoid string comparisons.) > > Register mappings to names seem to be even worse. It appears you have to > go through MCInstPrinter::printRegName(raw_ostr...
2016 Apr 24
2
Retrieving numeric value of instruction operand
...he IR looks like for a simple add function that adds two i32 > integers > > define i32 @summ(i32 %a, i32 %b) #0 { > entry: > %add = add nsw i32 %b, %a > ret i32 %add > } > > i would like to know the integer value of %a and %b. > > I've tried > > -i->getOpcodeName() which gives me the string add > > -i->getOperand(0) which gives me the string i32 %b > > -i->getOperand(0)->getName() which gives me the string a > > what method exists to get the actual integer value of the operands? > for example we called summ(1,2), how to retriev...
2013 Oct 28
2
[LLVMdev] Are Opcode and register mappings exposed anywhere?
...ot;Stephen Checkoway" <s at pahtak.org> wrote: > I'm iterating over MCInsts and I'd like to examine particular instructions. For example, I'd like to look at all x86 CALL64m instructions. I may be missing something, but it seems like my only option is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I could iterate through the opcodes and build up a table of the ones I'm interested in to avoid string comparisons.) > > Register mappings to names seem to be even worse. It appears you have to go through MCInstPrinter::printRegName(raw_ostream&, unsi...
2018 Dec 09
2
Parse LLVM IR
...ock: " << bb.getName().str() << std::endl; for (auto iter3 = bb.begin(); iter3 != bb.end(); iter3++) { Instruction &inst = *iter3; std::cout << " Instruction " << &inst << " : " << inst.getOpcodeName(); unsigned int i = 0; unsigned int opnt_cnt = inst.getNumOperands(); for(; i < opnt_cnt; ++i) { Value *opnd = inst.getOperand(i); std::string o; if (opnd->hasName()) {...
2016 Apr 24
2
Retrieving numeric value of instruction operand
...two >> i32 integers >> >> define i32 @summ(i32 %a, i32 %b) #0 { >> entry: >> %add = add nsw i32 %b, %a >> ret i32 %add >> } >> >> i would like to know the integer value of %a and %b. >> >> I've tried >> >> -i->getOpcodeName() which gives me the string add >> >> -i->getOperand(0) which gives me the string i32 %b >> >> -i->getOperand(0)->getName() which gives me the string a >> >> what method exists to get the actual integer value of the operands? >> for example we call...
2011 Oct 24
0
[LLVMdev] Question about local variables
...ying to extract, the operation name, the source > operands, the dest operands along with dst and src widths/signs, etc. Looking at "%x = add i32 %y, 1" the pieces here are: "%x" the name of the instruction (I->getName()) "add" the instruction opcode (I->getOpcodeName()) "i32" the first operand type (I->getOperand(0)->getType()) "%y" the first operand (I->getOperand(0)->getName()) "1" the second operand (type is implicit here because a binop needs the same type on both sides). (I->getOperand(1)) LLVM integer ty...
2011 Oct 22
9
[LLVMdev] Question about local variables
Nick, Unfortunately this doesn't answer my question I don't think. It seems that -instnamer, as you mention, names the instructions but still does not name the local variables. So there really is no way to do this shy of creating (or basically copying) the API from AsmWriter (seems very dedundant to me)? This seems like a large failing? On Fri, Oct 21, 2011 at 7:03 PM, Nick
2010 Oct 28
3
[LLVMdev] Landing my new development on the trunk ...
...atorStrengthReduce.cpp >> >> The algorithm finds reduction opportunities in both array accesses and >> explicit multiplications within loops. >> >> Next, I plan on writing the regression tests. > > Comments: > 1. Please don't top-post. > 2. Instruction::getOpcodeName instead of your OpcodeToString function. Can do. I did not see getOpcodeName() in lib/Target/CBackend/CBackend.cpp, so I wrote my own. FWIW I am only using OpcodeToString() for debug output. > 3. LLVM already has a significant amount of infrastructure for loop > passes; why does this pas...
2010 Jul 05
0
[LLVMdev] how to have a Operator reference from an Instruction?
Hi All, I'm new to LLVM and trying to do some analysis on the IR. For a instruction, e.g., a BinaryOperator, can I have the reference of an Operator from it? Now I can use getOpcode() or getOpcodeName() to have unsigned int or string. But can I have a Operator or specifically AddOperator as the return value? Thanks. Regards, --Wenbin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100705/b3915b4e/at...
2012 Aug 21
1
[LLVMdev] generate a weird 'and' instruction
...for (llvm::Function::iterator itb = f->begin(); itb != f->end(); ++itb) { llvm::BasicBlock *bb = itb; for (llvm::BasicBlock::iterator iti = bb->begin(); iti != bb->end(); ++iti) { llvm::Instruction *i = iti; *msg << i->getOpcodeName() << "\n"; } } } -------------------------------------------- Qiuping Yi Institute Of Software Chinese Academy of Sciences -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachment...
2012 Nov 05
1
[LLVMdev] Getting unique instruction identifier ( Insturction.h)
Hi All, The following IR has "mul4". I am wondering if  "4 " is generated by SSA ? Also is there any method that gives me "mul4". I tried getOpcode and getOpcodeName but they are for different purposes.  %mul4 = mul i32 %e0, %ai3 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121104/5a8dbb5f/attachment.html>
2013 Dec 20
0
[LLVMdev] A problem about convert a string to a *i8 pointer
...bc file,which prints the opcode of every instruction before the instruction executed. While passing the opcode to the printf fucntion ,I used such way to convert the string to i8* (the same as http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-September/053206.html does): StringRef s = ins_temp->getOpcodeName(); //ins_temp is an Instruction* type Constant *to_be_print = ConstantDataArray::getString(ctx, s); GlobalVariable *g_print = new GlobalVariable(M, to_be_print->getType(), true, GlobalValue::InternalLinkage, to_be_print, "print_str"); Constant *zero = Constant::getNullValue(llvm::Int...
2013 Oct 29
0
[LLVMdev] Are Opcode and register mappings exposed anywhere?
..." <s at pahtak.org> wrote: > > I'm iterating over MCInsts and I'd like to examine particular > instructions. For example, I'd like to look at all x86 CALL64m > instructions. I may be missing something, but it seems like my only option > is to use MCInstPrinter::getOpcodeName and compare strings. (Of course, I > could iterate through the opcodes and build up a table of the ones I'm > interested in to avoid string comparisons.) > > > > Register mappings to names seem to be even worse. It appears you have to > go through MCInstPrinter::printRegNam...