Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] how to get a void type value in llvm"
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:
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",
2014 Jan 09
2
[LLVMdev] reference to non-static member function must be called
I'm using LLVM 3.3 Release. From the Class Reference Page. CallInst has a
member function :
static CallInst * Create (Value *Func, ArrayRef< Value * > Args, const
Twine &NameStr="", Instruction *InsertBefore=0)
This is what I want to use! the default name is "" and I also use that .
Thanks!
-----
Kind Regards!
-JinHuang
--
View this message in context:
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
Hi,everyone.
I'm writing a pass in which a CallInst to an external function will be
inserted. The function is declared like this:
void func(int a, unsigned chat *p);
and in the Pass(a Function Pass ,and using the InstVistor template ), I
wrote like this:
void visitStoreInst(StoreInst &SI)
{
//Get the refference of the types
Module *M =
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
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 May 13
3
[LLVMdev] Handling of thread_local globals by llc -march=cpp
target triple = "i386-pc-linux-gnu"
On 13/05/2010, at 9:25 PM, Anton Korobeynikov wrote:
>> int (*FP)() = (int (*)())FPtr;
>> int res = FP();
>>
>> when the function executes correctly in the case of instead having created a standard global variable.
> What is the platform you're running the code on?
>
> --
> With best regards, Anton
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
2010 May 13
0
[LLVMdev] Handling of thread_local globals by llc -march=cpp
I note also that this is not a currently unsupported target case where an error should/could/would be produced on attempting to emit code with thread local references. I say this because clang is able to compile both c source with __thread on a global and bc containing a @variable = thread_local global ... and a function that references the thread local global variable to both assembly and machine
2005 Feb 02
1
[LLVMdev] RE: Question about Global Variable
Thanks for your reply.
After I change Cstr to gI, it compiled successfully. Thanks again.
Another question is for constructing getelementpt.
// C code
char gStrA[10] = "test str"; // here is Global variable,gStrA and initializer "test str"
char gStrB[10]= "test str2";
main(){
int = i;
char *pGVars[20]; // here, the pGVar is for storing the address of each
2009 Nov 18
2
[LLVMdev] Strange error using CallInst constructor
Hi,
This is probably more of a standard C++ question instead of an actual
LLVM question, but here it goes anyway. I'm trying to invoke the
following constructor:
CallInst::CallInst(Value *Func, InputIterator ArgBegin, InputIterator
ArgEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd);
My code is:
using namespace llvm;
void replaceByClone(Function *f, CallInst *I){
Function *clone =
2011 Apr 26
0
[LLVMdev] inserting a fucntion call at the end of basic bloc
Hi Nabila,
> where did the "noalias" attribute and "tail call" (rather than "call") come
> from? Are you setting these yourself or running some optimization pass after
> your pass?
>
>
> i have written a module pass and i have compiled it and then
you didn't answer my questions, you just repeated what you said before.
Ciao,
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
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
2010 Nov 18
0
[LLVMdev] How to construct parameters for a insert function? one from a return value from previous call, the other one is a string....
Hi,
I want to insert a write operation to a fd opened, but I have some
questions to construct parameters to pass to function that I want to
insert, because one from a return value from previous call, the other
one is a string, The detailed description of the problem is as
follows;
I have: int fd = open(g_settings_path, O_RDONLY);
and I want to insert this function after the instruction above:
2011 Apr 26
2
[LLVMdev] inserting a fucntion call at the end of basic bloc
2011/4/26 Duncan Sands <baldrick at free.fr>
> Hi Nabila,
>
> Now when i tried this pass an error says:
>> Wrong type for attribute noalias
>> tail call void @consume(i32 noalias 3, i32* @y) nounwind
>>
>>
>> noalias is only for arguments of pointer type. You probably meant it
>> to
>> be on the second argument
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 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