Displaying 20 results from an estimated 6000 matches similar to: "[LLVMdev] How to halt a program"
2011 Aug 19
0
[LLVMdev] How to halt a program
Victor Campos wrote:
> Guys,
>
> I would like to instrument the bytecode that LLVM produces with
> assertions. I have written the instrumentation code manually, but I do
> not know how to halt the program in case the assertion is false. I took
> a look into the bytecode that LLVM produces for a program like:
>
> #include <stdlib.h>
> int main() {
>
2011 Sep 01
1
[LLVMdev] How to halt a program
Hi, all,
I managed to insert the assertion in my bytecode, but the result is not
really what I expected :(
Let me do a quick recap: I am trying to instrument the bytecode with
some assertions, and to do this, I want to insert the abort() function into
the bytecode. The problem is that LLVM is creating a new abort() function,
instead of using the one that already exists in libc. Let me
2011 Mar 31
3
[LLVMdev] inserting exit function into IR
Hi Joshua,
I have a function foo and I want to insert exit(0) at the end of foo.
The problem is M.getFunction returns null, which is understandable. I am not
sure what to do. Below is the code snippet.
void foo(int argc, char* argv[]) {
printf("hello world\n");
exit(0); //***I want to insert this exit
}
My llvm code snippet is
vector<const Type *> params =
2010 Nov 23
2
[LLVMdev] how to get a void type value in llvm
Hi, I want to insert a function with a void type parameter,
for example: int foo(void);
OI declared
fcall2 = M.getOrInsertFunction("foo",
IntegerType::get(M.getContext(), 32),
Type::getVoidTy(M.getContext()));
then the question is how to get the void type value to make the
CallInst inserted sucessfully? (what should be ********)
CallInst::Create(fcall2, ******,
2010 Nov 23
1
[LLVMdev] how to get a void type value in llvm
Hi, sivart
Thanks for pointing it out. I used it, and it works. Thank you again.
BTW, for any later reference, the function prototype declaration with
no arguments is not what I wrote:
fcall2 = M.getOrInsertFunction("foo",
IntegerType::get(M.getContext(), 32),
Type::getVoidTy(M.getContext()));
INSTEAD, I changed to :
fcall2 = M.getOrInsertFunction("foo",
2010 Nov 23
0
[LLVMdev] how to get a void type value in llvm
Hi Shuying,
You will find in the documentation that amongst the overloaded CallInst::Create()'s there is one that takes no function arguments:
static CallInst* llvm::CallInst::Create ( Value * F, const Twine & NameStr, BasicBlock * InsertAtEnd);
Regards
On 23/11/2010, at 11:20 AM, Shuying Liang wrote:
> Hi, I want to insert a function with a void type parameter,
> for example:
2011 Mar 31
0
[LLVMdev] inserting exit function into IR
On Thu, Mar 31, 2011 at 9:31 PM, George Baah <georgebaah at gmail.com> wrote:
> Hi Joshua,
> I have a function foo and I want to insert exit(0) at the end of foo.
> The problem is M.getFunction returns null, which is understandable. I am not
> sure what to do. Below is the code snippet.
> void foo(int argc, char* argv[]) {
> printf("hello world\n");
>
2013 Apr 21
3
[LLVMdev] trying to generate a simple inline asm
I'm trying to just emit simple inline assembler (no constraints, inputs,
etc.)
Can anyone point me to an example of this..?
This is corresponding to:
__asm__ ("mfc1 $4,$f12");
This is what I tried but it's not correct.
std::vector<llvm::Type *> AsmArgTypes;
llvm::FunctionType *AsmFTy =
llvm::FunctionType::get(Type::getVoidTy(FStub->getContext()),
2015 Aug 19
5
creating a callinst to an external function
Dear All
I'm making an instrumentation pass. The pass is supposed to modify the given IR in a specefic way. One of the required modifications is to insert a call to a function at a specific location.
This is the signature of the called function:
void myclass::foo(Function *f, BasicBlock* b)
This function's prototype is in an foofile.h file in include/llvm
And the function
2013 Jun 27
2
[LLVMdev] Problem with linking modules which use a shared type
Hi,
I stumbled upon a strange thing regarding types and module linking, which I don't quite get, so maybe someone around here can enlighten me.
Consider the following code, which will create 2 modules m1 and m2, and a named structured type %T = { i32 }; m1 contains only a function definition f(%T), m2 contains a function declaration f(%T) and a function definition h(%T), where h will call f
2011 Mar 31
0
[LLVMdev] inserting exit function into IR
Hi George,
Could you be a more specific about what you are trying to do, how you are
trying to do it, and what is failing. A couple of relevant snippets of code
would do wonders in helping you.
Thanks,
Joshua
On Wed, Mar 30, 2011 at 3:59 PM, George Baah <georgebaah at gmail.com> wrote:
> Hi Everyone,
> I am trying to insert an exit function into my IR.
> However, I thought
2011 Mar 30
2
[LLVMdev] inserting exit function into IR
Hi Everyone,
I am trying to insert an exit function into my IR.
However, I thought I can get access to exit by using
Module.getOrInsertFunction or Module.getFunction. However, I am
getting a null value returned. I have searched through the llvmdev archives
but not found any thing that addresses this question.
Any help will be greatly appreciated. Thanks.
George
-------------- next part
2011 Nov 19
2
[LLVMdev] Insert a function call in the code
Hello, everyone
I am new to LLVM, now I got a problem
I want to add a function call before sleep(int a, int b)
code below
#include <stdio.h>
int sleep(int a, int b)
{
return a+b;
}
int main(int argc, char **argv)
{
sleep(1,2);
}
after use opt -load ../llvm-2.8/Release+Asserts/lib/bishe_insert.so
-bishe_insert <1.bc> 2.bc
I want get the code
#include <stdio.h>
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
2012 Oct 07
2
[LLVMdev] Inserting a function call using LLVM
Hi,
I am new to LLVM and interested in using LLVM to work on a research project
for my Master's degree.
My idea is following -
1. I have a simple C program basic.c -
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}
2. I will generate IR byte code for this basic.c using -
llvm-gcc -emit-llvm -S basic.c
This will give me basic.s which has IR byte code
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi,
I'm trying to get my head around c++ - IR - c++ API and getting used
tramform manual information to code.
The manual states alloca is defined for <type>. FunstionType is a type, so
alloca for functionType should be possible? Not?
If we have a valid Module *m
we can get an allocate instruction allocating space for a non-argumented
function as follows:
AllocaInst* pa2 = new
2017 Nov 23
1
JIT and atexit crash
Hi,
Not sure whether this matches your use case, but the Orc-based JIT used
in LLI appears to be using `llvm::orc::LocalCXXRuntimeOverrides`
(http://llvm.org/doxygen/classllvm_1_1orc_1_1LocalCXXRuntimeOverrides.html)
to override `__cxa_atexit`:
https://github.com/llvm-mirror/llvm/blob/release_50/tools/lli/OrcLazyJIT.h#L74
2013 Apr 16
0
[LLVMdev] creating and inserting a function with variable arguments
Akshay Jain <jivan.molu at gmail.com> writes:
> I have tried it, but I always end up with some kind of error. Can you
> explain how can I get a function type for function which returns void
> (nothing) and it's arguments are (int, int, int, void *, void *, ...) ??
Instead of getting something to cut&paste, you would be much more
enriched if the problematic code and the
2013 Apr 16
2
[LLVMdev] creating and inserting a function with variable arguments
I have tried it, but I always end up with some kind of error. Can you
explain how can I get a function type for function which returns void
(nothing) and it's arguments are (int, int, int, void *, void *, ...) ??
Thanks in advance.
On Tue, Apr 16, 2013 at 7:22 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:
> Akshay Jain <jivan.molu at gmail.com> writes:
>
> > I am
2015 Mar 10
4
[LLVMdev] noob IR builder question
I am trying to get a handle on IR builder, at least some basics. I ran through a tutorial here: Create a working compiler with the LLVM framework, Part 1 <http://www.ibm.com/developerworks/library/os-createcompilerllvm1/>, and it worked well enough. I have some simple code that creates a hello world IR. I am trying to now bring in some concepts from the Kaleidoscope tutorial, namely