Displaying 20 results from an estimated 700 matches similar to: "Convert Function Pointer Call to Function Call at the IR Level"
2018 Sep 03
2
Replacing a function from one module into another one
Thank you Ahmad,
I figured out that, although the type of both p(oInst) and p(nInst) were
the same, I had to:
for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++) {
callOInst->getArgOperand(i)->mutateType(callNInst->getArgOperand(i)->getType());
}
that solves the issue at the calling instruction in the main function, but
now I see that *linkModules* does not work
2018 Nov 12
2
Convert Register Names to String
Hi Tim,
Thanks for the nice answer. The code that you mentioned, seems to generate
the IR. You mean I should reuse the code to extract and output the register
names in a file. Next, I should postprocess the file in my own pass?
Regards.
On Mon, 12 Nov 2018 at 13:09, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi Ahmad,
>
> On Sun, 11 Nov 2018 at 13:39, Ahmad Nouralizadeh
2018 Nov 11
2
Convert Register Names to String
Hi.
I want to do a cutomized points-to analysis on IR. Suppose that we have:
*%91 = bitcast i8* %90 to %struct.demux_packet*, !dbg !2688*
I want to store sth similar to %91 -> target of %90, which records the
target of pointer named %91. How can I access the names (Here, %90 and %91)?
I know that I can put the whole line for an instruction into a string,
using the following code:
*string str;*
2018 Sep 02
2
Replacing a function from one module into another one
Hi Ahmad,
What does that tool does besides what LLVM linker already does? I don't
think my problem is in linking both modules, I think LLVM linker does the
job for me, the issue is when changing the called function to call another
function (in the example previously provided, to change it from foo2 to
foo3, and adjusting the function parameter's references).
Regards,
Daniel Moya
El
2018 Sep 04
2
Replacing a function from one module into another one
Hi Philip,
Thank you very much for your answer, the vector declaration example worked.
I'm pretty sure the ValueToValueMapTy is the last thing I need because I
even saw there is another function that could help me llvm*:*:RemapFunction
<http://llvm.org/doxygen/namespacellvm.html#addf0183e92893bdbcde00fc9091dda93>;
but my problem is that I don't know how to populate the
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip,
Thanks for the reference, I was able to follow it and copy the code that I
saw necessary, but I still have some issues (references are still not
updated). I created the function:
void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld,
llvm::Function *fNew) {
llvm::Function::arg_iterator DestI = fOld->arg_begin();
for (llvm::Function::const_arg_iterator J =
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip,
The error happens when the program finishes and it automatically calls the
destructors, so it is not an error specifically inside my program. Here's
the full code:
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/TargetSelect.h"
#include
2018 Sep 02
2
Replacing a function from one module into another one
Hello and thanks for the answer,
I'm still facing issues, I'll do my best to explain my situation, as I
explained, I have two modules, each one with its own main and functions, I
would like to replace in the *oldModule* a function call that is calling
*foo2* (defined in *oldModule*) to instead call *foo3*, which is defined in
the *refModule. *So in summary, I have:
1. The original
2018 Aug 08
3
Error Calling eraseFromParent()
LLVM is built in Release mode. The version is 6.0.0. I think that a similar
code worked on verison 3.9.0. It is probably a null pointer dereference
occurring in eraseFromParent(). I checked and reconfirmed that the
instruction had no uses. Perhaps I should rebuild LLVM. Thanks.
On Wed, Aug 8, 2018 at 9:03 PM, mayuyu.io <admin at mayuyu.io> wrote:
> Hmmmm that’s strange. Do you get an
2013 Aug 30
1
[LLVMdev] Are instr_iterators invalidated when function inlining is performed?
Hi,
I'm trying to write a small piece of code that inlines all calls to a
particular function. The codes is as follows
Function* klee_check_divF = module->getFunction("klee_div_zero_check");
assert(klee_check_divF != 0 && "Failed to find klee_div_zero_check function");
// Hack inline checks
for (Module::iterator f = module->begin(), fe =
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code
which is again very simple:
...
bool runOnFunction(Function &F) override {
vector<Instruction *> dels;
dels.clear();
for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) {
Instruction *I = &*(It++);
if (auto* op = dyn_cast<BinaryOperator>(I)) {
IRBuilder<NoFolder>
2011 May 23
2
[Cortado] How to support seeking in on-the-fly generated Theora stream?
Hello all!
i want to use Theora in a little video portal, because its free and open
source and i want to contribute some code to get the Java Theora player
(Cortado) more feature-rich.
But now I'm stuck and hope that someone can point me into the right
direction.
I have videos stored in several formats (mostly H.264 or MPEG4) and use
ffmpeg2theora to recode them on the fly. The recoded
2018 Apr 01
2
Custom Binary Format Challenges
Hello,
I hope you are all doing well and thanks in advance. I need to program a
transformation of a set of llvm bitcode to have some various techniques
woven in. In particular, I need to resolve a given computed target address
to one of several in the same way that the function of a dynamic library is
resolved, but I need this resolution to happen in the binary target of my
choice where I tell
2018 Apr 01
2
Custom Binary Format Challenges
Thank you so much!
What about discovering the instruction pointer value?
Also, does anybody know how to embed an artifact as a resource in a binary?
I'd like to have two text sections, and have one copied in from another
binary.
On Sun, Apr 1, 2018 at 2:15 PM, Brenda So <sogun3 at gmail.com> wrote:
> Hi,
>
> You can write it as if you are writing an optimization pass:
>
2018 Aug 07
2
Error Calling eraseFromParent()
Thanks Bjorn! But The problem is still there.
On Wed, Aug 8, 2018 at 2:04 AM, Björn Pettersson A <
bjorn.a.pettersson at ericsson.com> wrote:
> It looks quite dangerous to erase the instruction I inside the loop when
> iterating over all instructions in the function.
> I guess it depends on how the range based iterator is implemented if that
> works or not.
>
> I think
2017 Aug 24
2
How do set 'nest' addribute in an indirect call?
On 08/24/2017 09:40 AM, Tim Northover wrote:
> On 17 August 2017 at 15:15, Rodney M. Bates via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> For an indirect call, i.e., on a function whose address is runtime variable,
>> I can't find any place/way to attach this attribute. LLVMAddAttribute
>> won't take a type.
>
> In the C++ API you'd add the
2018 Apr 01
2
Custom Binary Format Challenges
Program counter - EIP, RIP for x86/64. I need to obtain it and pass it as
an argument to the function that calculates an ordinal from it.
I think that there must be some way to use the bitcode language to place
byte values at a designated offset. Or use the command line to specify the
section and offset for the data.
On Sun, Apr 1, 2018 at 6:00 PM, Brenda So <sogun3 at gmail.com> wrote:
2018 Apr 01
0
Custom Binary Format Challenges
Hi,
You can write it as if you are writing an optimization pass:
http://llvm.org/docs/ProgrammersManual.html
It sounds like your highest level is a module, hence you should write a
module pass. There is example code on LLVM Programmer's Manual on how to do
a function pass:
Function* targetFunc = ...;
class OurFunctionPass : public FunctionPass {
public:
OurFunctionPass():
2004 Mar 21
3
New Directshow filters preview...
I have been developing some directshow filters for ogg, and vorbis and speex... currently i have an ogg demux filter and a speex/vorbis decoding filter. In this pre-release only vorbis is operational... but the speex decoder is pretty much done... i jsut need to tweak the demux filter so that it can negotiate a speex connection with the other filter. Just though some people might find them useful
2018 Apr 01
0
Custom Binary Format Challenges
Hi Kenneth,
Can you elaborate what you mean by instruction pointer value? Like the
actual instruction with opcode and operands? With the sample code that I
showed you, the instrucrtion pointer in the innermost for loop will have
access to the following functions:
http://llvm.org/doxygen/classllvm_1_1Instruction.html
Alternatively, you can use the dump() operation to dump the instructions
out.