Displaying 20 results from an estimated 91 matches for "getvoidti".
Did you mean:
getvoidty
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>
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, ******,
2011 Nov 20
0
[LLVMdev] Insert a function call in the code
Thank you for your help
I found the problem,
as hook() is a no paramter function,so
for(Function::arg_iterator i =
hook->arg_begin(), e = hook->arg_end(); i != e; ++i)
{
Args.push_back(i); /////////////Wong
}
we can add a call by
Instruction *newInst = CallInst::Create(hook,
2013 Apr 16
1
[LLVMdev] creating and inserting a function with variable arguments
The code that I have written to get the function type is:
const std::vector<Type *> ParamTys;
ParamTys.push_back(IntegerType::getInt32Ty(Context));
ParamTys.push_back(IntegerType::getInt32Ty(Context));
ParamTys.push_back(IntegerType::getInt32Ty(Context));
ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0));
ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0));
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",
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
2015 Mar 24
2
[LLVMdev] IR blocks for calling function pointers
Hello,
I am trying to create IR block for making a call to function pointer.
For creating the IR for a function call to "foo", with "foo" being defined
as "void foo(int)", I can use the "getOrInsertFunction" call from Module
class as follows:
std::vector<Type*> FooArgs;
FooArgs.push_back(IRB.getInt64Ty());
Value *FooFunction =
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:
2012 Apr 23
2
[LLVMdev] Eliminating the 'void' type
Hello Chris
The general concept is to replace void with {}. Void is a weird type in
>> that it is only allowed as the return value of functions and as the type of
>> instructions like store. It seems better (though also not particularly
>> high priority) to eliminate it to make the type system more consistent.
>>
>
MVT::isVoid and Type::VoidTyID (getVoidTy) have
2012 May 08
0
[LLVMdev] Discussion of eliminating the void type
Hello Duncan,
There is a discussion with Chris Lattner:
http://old.nabble.com/Eliminating-the-'void'-type-td33726468.html
In the discussion, Chris Lattner suggest Type::getVoidTy() should
still exist and
return {} for API continuity. If VoidTy and isVoidTy() go away, how do deal with
the isVoidTy() function call in LLVM source tree? Another issue is: What should
ReturnInst constructor
2017 Oct 11
2
How to create an alloca variable of type i64 in LLVM IR?
To create a stack based (local) 64 bit integer in LLVM IR, I used:
Value *var = builder.CreateAlloca(Type::getInt64Ty(Ctx));
I wish to pass this variable to a function "void foo(unsigned long)". I
created the signature of function foo() as follows:
Constant *func = M->getOrInsertFunction("foo",
Type::getVoidTy(Ctx),Type::getInt64Ty(Ctx), NULL);
To pass the newly created
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 =
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() {
>
2013 Jan 03
2
[LLVMdev] Opt error
Hi Team,
I am migrating one of the Pass that was written for llvm2.2 or older to llvm3.1. The code snippet looks like the following:
Constant *func;
void add( Module *M) {
func = M->getOrInsertFunction("func", Type::getVoidTy(M->getContext()), NULL);
}
virtual bool runOnModule(Module &M) {
add (&M);
for(Module::iterator F = M.begin(), E = M.end(); F !=
2011 Aug 19
2
[LLVMdev] How to halt a program
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() {
exit(1);
}
And it is like this:
define i32 @main() nounwind {
entry:
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
2012 May 08
4
[LLVMdev] Discussion of eliminating the void type
Hi Dan,
>> I am willing to do "eliminating the void type" project.
>
> Is this really a good idea? I'm not going to argue at length
> about it, but it is worth thinking about.
>
> The only practical downsides of void are when newcomers take C's
> syntax for functions with no arguments a little too literally, or
> when they try to create pointers to
2010 Mar 17
1
[LLVMdev] is structtyp a firstclass typ?
Hi LLVM,
In lib/VMCare/Verifier.cpp::visitInstruction, we have such code
1287 // Check that the return value of the instruction is either
void or a legal
1288 // value type.
1289 Assert1(I.getType() == Type::getVoidTy(I.getContext()) ||
1290 I.getType()->isFirstClassType()
1291 || ((isa<CallInst>(I) || isa<InvokeInst>(I))
1292 &&
2010 Apr 30
1
[LLVMdev] how to add and call a function with void return value in functionpass.
Hi:
In a function pass, I tried to create a function which takes a int32 and
return void.
When I call this function with CallInst::Create and using opt, it always has
the error report:
opt: Value.cpp:189: void llvm::Value::setName(const llvm::Twine&): Assertion
`getType() != Type::getVoidTy(getContext()) && "Cannot assign a name to void
values!"' failed.
if I change
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");
>