search for: getinstruct

Displaying 20 results from an estimated 36 matches for "getinstruct".

Did you mean: get_struct
2018 Apr 03
0
Problems using LLVM as a disassembler.
...to use LLVM as a disassembler, thus providing a small part of my decompiler that I am working on. It currently decompiles from X86_64 binary.o -> LLVM IR. It works with a small set of test programs so far, so cannot currently handle large binary programs yet. The problem is with the LLVM "getInstruction()" method. It used to have a PC (program counter) parameter that worked. You could use the PC as an offset within the buffer to start disassembling from. In LLVM 4.0 and above the only value of the PC parameter that works is zero. Please can someone look into fixing this? Kind Regards Jam...
2011 Oct 13
0
[LLVMdev] llvm-objdump related patch
...quot;:\n"; #ifndef NDEBUG raw_ostream &DebugOut = DebugFlag ? dbgs() : nulls(); #else @@ -244,22 +247,22 @@ static void DisassembleObject(const ObjectFile *Obj) { #endif for (Index = Start; Index < End; Index += Size) { MCInst Inst; - if (DisAsm->getInstruction(Inst, Size, memoryObject, Index, + outs() << format("%8x:\t", Index); + if (DisAsm->getInstruction(Inst, Size, memoryObject, Index - SectionVMA, DebugOut, nulls())) { - uint64_t addr; - if (error(i->getAddr...
2007 Jan 13
1
[LLVMdev] Value* as used by the non-JITted interpreter
Hi all, I've now got my LLVM-based model checker more or less working, but I'm seeing something a bit strange happening. As you may remember, I started with the lli code and extended it considerably. I have retained something that looks vaguely like the original ExecutionContext stack, though I now have one stack per thread, and the whole data structure is implemented with custom
2011 Oct 12
2
[LLVMdev] llvm-objdump related patch
Michael, I have rework the patch according to your suggestion. And I have read binutil/objdump source code and found that it has a logic that if there's no symtab, it will use dynsym, which is missing in llvm-objdump. Songmao -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Fix-the-address-calculation-for-llvm-objdump.patch Type: text/x-patch
2014 Nov 03
2
[LLVMdev] Mips's MicroMips ??
Hello Daniel, At the moment we are preparing the patch for disassembling microMIPS 16 bit instructions and it will be on Phabricator tomorrow or on Wednesday. Functionality is implemented in MipsDisassembler::getInstruction where first two bytes are read and decodeInstruction is called with DecoderTableMicroMips16 and only if it fails we read 4 bytes and call decodeInstruction with DecoderTableMicroMips32. Regards, Zoran ________________________________ From: Daniel Sanders Sent: Sunday, November 02, 2014 5:49...
2012 Jan 05
1
[LLVMdev] Non-Chain Chains
...owing up on my call schedule posting from yesterday, I am now trying to add edges from the call to the instruction before it. This seemed easiest to do in SelectionDAGBuilder but it is troublesome. A couple of questions: - How do I get the previous instruction that was translated? prior(CS.getInstruction()) in visitCall returns something invalid. When I try to call getValue on the returned Instruction it blows up. I really need the SDValue produced as a result of translating that last instruction. Is there some other way to get it? - Can a TokenFactor node take a non-chain input?...
2012 Apr 01
1
[LLVMdev] Create Instruction
...(%class.A* %call3, i32 2) // this is my instruction br label %15 ; <label>:15 ; preds = %12, %14 .... The problem is that results of instructions have different names (%call6, %call64). I create new CallInst by CallInst::Create(F1,args,CS.getInstruction()->getName(), rightCall); , where CS - original call site, but new Instruction still haven't same name, but similar as I see.... It is possible to give exactly same name for result if CallInst in my case? Thanks! Yours sincerely, Kadysev Mikhail -------------- next part --------------...
2012 May 04
0
[LLVMdev] Getting Metadata
Hi. I have strange case: This is a code for getting metadata from callsite: .... CallSite CS(cast<Value>(I->first)); SmallVector<std::pair<unsigned int, MDNode*> , 4> MD; CS.getInstruction()->getAllMetadata(MD); CS.getInstruction()->dump(); for (SmallVector<std::pair<unsigned int, MDNode*> , 4>::iterator md = MD.begin(); md!=MD.end(); md++) { for (unsigned i=0; i<md->second->getNumOperands(); i++) { md->second->dump(); .... Metadata...
2011 Dec 19
2
[LLVMdev] Disassembly arbitrary machine-code byte arrays
...); llvm::OwningPtr<const llvm::MCDisassembler> disassembler(Target.createMCDisassembler(*STI)); llvm::OwningPtr<llvm::MemoryBuffer> Buffer; llvm::MemoryBuffer::getFile(llvm::StringRef("/path/to/file.bin"), Buffer); llvm::MCInst Inst; uint64_t Size = 0; disassembler->getInstruction(Inst, Size, *Buffer.take(), 0, llvm::nulls(), llvm::nulls()); // llvm::StringRef TheArchString("arm-apple-darwin"); // std::string normalized = llvm::Triple::normalize(TheArchString); // // llvm::Triple TheTriple; // TheTriple.setArch(llvm::Triple::arm); // TheTriple.setOS(llvm::...
2012 Jan 03
1
[LLVMdev] AliasAnalysis and memory dependency
...UserTy, InstrTy, CallTy, InvokeTy, IterTy>::getCalledValue() const [with FunTy = const llvm::Function, ValTy = const llvm::Value, UserTy = const llvm::User, InstrTy = const llvm::Instruction, CallTy = const llvm::CallInst, InvokeTy = const llvm::InvokeInst, IterTy = const llvm::Use*]: Assertion `getInstruction() && "Not a call or invoke instruction!"' failed. 0 opt 0x08537540 1 opt 0x08539a7c 2 libpthread.so.0 0x0080b878 3 libc.so.6 0x0069464a abort + 378 4 libc.so.6 0x0068bde8 __assert_fail + 248 5 opt 0x082b3063 6 opt...
2011 Aug 12
1
[LLVMdev] New ARM disassembler - unpredictable instructions
...said, I do think it would be useful to a) have more UNPREDICTABLE checking, mostly in the form of greater operand validation, and b) to have a means of conveying that to the user. I'm not sure that adding a bit to MCInst is necessary, however. Perhaps we could just promote the return value of getInstruction() from bool to a trinary value that can indicate success, failure, or soft failure. Then it can be up to the client to handle that in some useful fashion. I'm not going to have the bandwidth to work on a structural change like that in the immediate future, but if you're interested it w...
2012 Dec 18
2
[LLVMdev] Issue with instruction decoding / disassembly
..._3r instruction but instead it stops looking at this point and returns Fail. How should I deal with this situation? One idea I had (which I haven't tried yet) is to move the troublesome instructions into a different decoding table by setting the DecoderNamespace. This way in XCoreDisassembler::getInstruction() I can call decodeInstruction() on the first decoder table (containing INITSP_2r) and if this fails I can then call decodeInstruction() on the second decoder table (containing ADD_3r). Is this an abuse of DecoderNamespaces? Is there a better way of solving my problem? Thanks, Richard
2013 Dec 16
3
[LLVMdev] [RFC] Iterrative compilation framework for Clang/LLVM
...ive paths. Let us consider Inliner example: Original code: if (!IC) { DEBUG(dbgs() << " NOT Inlining: cost=" << IC.getCost() << ", thres=" << (IC.getCostDelta() + IC.getCost()) << ", Call: " << *CS.getInstruction() << "\n"); return false; } Code after instrumentalization: bool doInlinging = (bool)IC; DecisionTreeProxy *decisionTreeProxy; decisionTreeProxy = moduleDecisionTreeProxies->getCurrFnDecisionTreeProxy(); int t = MaxDtPriority - abs(IC.getCostDelta());...
2013 Dec 18
4
[LLVMdev] [RFC] Iterrative compilation framework for Clang/LLVM
...example: > > > > Original code: > > > > if (!IC) { > > DEBUG(dbgs() << " NOT Inlining: cost=" << IC.getCost() > > << ", thres=" << (IC.getCostDelta() + IC.getCost()) > > << ", Call: " << *CS.getInstruction() << "\n"); > > return false; > > } > > > > Code after instrumentalization: > > > > bool doInlinging = (bool)IC; > > DecisionTreeProxy *decisionTreeProxy; > > decisionTreeProxy = > > moduleDecisionTreeProxies->getCurrFnDeci...
2011 Dec 19
0
[LLVMdev] Disassembly arbitrary machine-code byte arrays
...); llvm::OwningPtr<const llvm::MCDisassembler> disassembler(Target.createMCDisassembler(*STI)); llvm::OwningPtr<llvm::MemoryBuffer> Buffer; llvm::MemoryBuffer::getFile(llvm::StringRef("/path/to/file.bin"), Buffer); llvm::MCInst Inst; uint64_t Size = 0; disassembler->getInstruction(Inst, Size, *Buffer.take(), 0, llvm::nulls(), llvm::nulls()); // llvm::StringRef TheArchString("arm-apple-darwin"); // std::string normalized = llvm::Triple::normalize(TheArchString); // // llvm::Triple TheTriple; // TheTriple.setArch(llvm::Triple::arm); // TheTriple.setOS(llvm::...
2012 Dec 18
0
[LLVMdev] Issue with instruction decoding / disassembly
...ction but instead it stops looking at this point and returns Fail. > > How should I deal with this situation? One idea I had (which I haven't tried yet) is to move the troublesome instructions into a different decoding table by setting the DecoderNamespace. This way in XCoreDisassembler::getInstruction() I can call decodeInstruction() on the first decoder table (containing INITSP_2r) and if this fails I can then call decodeInstruction() on the second decoder table (containing ADD_3r). Is this an abuse of DecoderNamespaces? Is there a better way of solving my problem? > > Thanks, > &...
2013 Dec 17
0
[LLVMdev] [RFC] Iterrative compilation framework for Clang/LLVM
...gt; > Let us consider Inliner example: > > Original code: > > if (!IC) { > DEBUG(dbgs() << " NOT Inlining: cost=" << IC.getCost() > << ", thres=" << (IC.getCostDelta() + IC.getCost()) > << ", Call: " << *CS.getInstruction() << "\n"); > return false; > } > > Code after instrumentalization: > > bool doInlinging = (bool)IC; > DecisionTreeProxy *decisionTreeProxy; > decisionTreeProxy = > moduleDecisionTreeProxies->getCurrFnDecisionTreeProxy(); > int t = MaxDtPriority...
2013 Dec 19
0
[LLVMdev] [RFC] Iterrative compilation framework for Clang/LLVM
...> Original code: > > > > > > if (!IC) { > > > DEBUG(dbgs() << " NOT Inlining: cost=" << IC.getCost() > > > << ", thres=" << (IC.getCostDelta() + IC.getCost()) > > > << ", Call: " << *CS.getInstruction() << "\n"); > > > return false; > > > } > > > > > > Code after instrumentalization: > > > > > > bool doInlinging = (bool)IC; > > > DecisionTreeProxy *decisionTreeProxy; > > > decisionTreeProxy = > > &gt...
2011 Dec 19
3
[LLVMdev] Disassembly arbitrary machine-code byte arrays
...MCDisassembler> > disassembler(Target.createMCDisassembler(*STI)); > > llvm::OwningPtr<llvm::MemoryBuffer> Buffer; > llvm::MemoryBuffer::getFile(llvm::StringRef("/path/to/file.bin"), Buffer); > llvm::MCInst Inst; > uint64_t Size = 0; > > disassembler->getInstruction(Inst, Size, *Buffer.take(), 0, > llvm::nulls(), llvm::nulls()); > > // llvm::StringRef TheArchString("arm-apple-darwin"); > // std::string normalized = llvm::Triple::normalize(TheArchString); > // > // llvm::Triple TheTriple; > // TheTriple.setArch(llvm::Tripl...
2012 Jan 03
0
[LLVMdev] AliasAnalysis and memory dependency
Hi neda 8664, > I want to find memory dependency between CallInst instruction and other. So i > used the following code: > > > > / AliasAnalysis &AA=getAnalysis<AliasAnalysis>();/ > > /*if* (isa< StoreInst >(inst1)){ / > > // // /*if* (isa<CallInst>(inst2)) / /{/ > > / CallInst *call_inst2= dyn_cast<CallInst>(inst2); /