Displaying 20 results from an estimated 300 matches similar to: "[LLVMdev] A problem about convert a string to a *i8 pointer"
2008 May 17
1
Scope Confusion - Controller iVars in Modules
I''ve created a module to include in a Controller. Basically it works,
but I am expecting methods in the module to have access to instance
variables from the controller, and that appears to not be the case.
Yet, a simple Ruby example says it should be. I''m not sure what''s
different.
Simple Example:
module ShapeStuff
def set_type
@type =
2013 Dec 16
3
[LLVMdev] Add call printf instructions problems
Hello, everyone!
I want to write a pass which can insert a call "printf" instructions
before every instruction in the LLVM IR. here is what I wrote:
namespace {
class call_print : public FunctionPass{
private:
DenseMap<const Value*, int> inst_map;
public:
static char ID;
call_print() : FunctionPass(ID){}
//define a extern function "printf"
static llvm::Function*
2013 Dec 16
0
[LLVMdev] Add call printf instructions problems
Hi Jin,
It's difficult to say just from looking at a pass, but one thing looked odd:
> CallInst *call_print = CallInst::Create(call_print,paramArrayRef,"",ins_temp);
This looks very dodgy. The "call_print" being used as an argument is
the (uninitialised) one that's just been declared. This could be the
source of the assertion failure (though a segfault is just as
2017 Apr 08
2
Getting a pointer to a i8 from a global variable that holds a constant string
Hello,
I'm trying to get the pointer to the first element of a string (so that I
can pass it to a function).
The string itself is a constant kept in a global variable.
My end goal is to generate the IR for something like "puts("Hello World")";
I'm stuck on the parameter part of the call instruction.
So far I have something like this:
const std::string& str =
2013 Dec 17
2
[LLVMdev] Add call printf instructions problems
Thanks,Cheers!
I found the problem is that the "Function *call_print" using the same name
as the “class call_print”, which made the compiler wrongly resolved the
call_print type!
But I got another problems. I successfully compile the pass and I can
insert the call printf (C Lib function) instructions in the LLVM IR(eg:
call.bc). If the call.bc didn't contain call printf
2011 Jan 18
2
[LLVMdev] compiling a call to function in compiler
Hi,
I'm trying to follow the advice from this message:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-October/017574.html,
to create a call instruction from a function pointer. But I'm
getting...
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"),
function cast, file /usr/local/include/llvm/Support/Casting.h, line 202.
2011 Jan 18
0
[LLVMdev] compiling a call to function in compiler
On Jan 17, 2011, at 5:01 PM, Rob Nikander wrote:
> Hi,
>
> I'm trying to follow the advice from this message:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-October/017574.html,
> to create a call instruction from a function pointer. But I'm
> getting...
>
> Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
> incompatible
2011 Jan 18
1
[LLVMdev] compiling a call to function in compiler
On Mon, Jan 17, 2011 at 8:36 PM, Eric Christopher <echristo at apple.com> wrote:
>
> id testfunc(id a, id b) { ... }
> ...
> FunctionType *fn_type = FunctionType::get(id_type, argtypes, false);
> Value *fn = ConstantExpr::getIntToPtr(ConstantInt::get(int64_type,
> reinterpret_cast<int64_t>(testfunc)), fn_type);
> return builder.CreateCall2(fn,
2015 Jan 05
2
[LLVMdev] LLVM linkage error - Program used external function 'foo' which could not be resolved!
Hi, All
I got a linkage error as indicated in the subject line. Any suggestion?
I created a call builder.CreateCall2(foo, p1, p2) in a module. foo is
a Function* generated by module->getOrInsertFunction("foo",
prototype). foo is defined outside of this module, and in the dump of
the module, I see "declare i64 @foo(xxx, xxx)". The error happens
during link time, it seems
2011 Apr 05
3
[LLVMdev] inserting a print statement into IR
Hi Everyone,
I am trying to construct the print statement : printf("value:%d\n",
value);
This is my llvm code. It is seg faulting at
builder.CreateGlobalStringPtr(str,"").
Thanks.
George
vector<const Type *> params;
params.push_back(Type::getInt8PtrTy(M.getContext()));
FunctionType *fType =
FunctionType::get(Type::getInt32Ty(M.getContext()), params, true);
Constant
2011 Apr 05
0
[LLVMdev] inserting a print statement into IR
On 4/4/2011 6:26 PM, George Baah wrote:
> Hi Everyone,
> I am trying to construct the print statement : printf("value:%d\n",
> value);
> This is my llvm code. It is seg faulting at
> builder.CreateGlobalStringPtr(str,"").
This might be easier to debug with a stack trace. Use a debugger to see
the call stack when the segfault occurs. Also try to isolate
2011 Apr 01
3
[LLVMdev] insert printf into IR
Hi All,
I am trying to insert printf ("%d", v), where v is an integer param, into
the IR.
I am doing something wrong because I keep getting segfaults.
Below is my code. Thanks.
vector<const Type *> params;
params.push_back(Type::getInt8PtrTy(M.getContext()));
params.push_back(Type::getInt32Ty(M.getContext()));
FunctionType *fType =
2013 Nov 04
0
[LLVMdev] Implementing an llvm.setreturnaddress intrinsic
Hi,
I've been having some trouble implementing a new intrinsic for LLVM and I
was wondering if someone might know the answer.
LLVM has an llvm.returnaddress intrinsic, but for a specific project, I
need to be able to modify the return address of a function as well, so I'm
implementing a new intrinsic:
def int_setreturnaddress : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty],
[]>;
2008 Jun 19
1
[LLVMdev] Constant function pointers and inlining
Hello,
I've been working on turning PHP scripts into LLVM IR and I've gotten
to the stage where I'm able to construct LLVM code that calls the PHP
opcode handlers that I've pre-compiled to LLVM IR in the correct
order. However, the PHP API is designed so that the handlers are not
globally accessible (qualified by "static" in the C source). Instead
they're supposed to
2015 May 24
19
[RFC PATCH 00/11] Implement ARB_cull_distance
This patch series adds the needed support for this extension to the various
parts of mesa to finally enable it for nvc0.
Dave Airlie (1):
glsl: lower cull_distance into cull_distance_mesa
Tobias Klausmann (10):
glapi: add GL_ARB_cull_distance
mesa/main: add support for GL_ARB_cull_distance
mesa/prog: Add varyings for arb_cull_distance
mesa/st: add support for GL_ARB_cull_distance
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Dmitry,
> This is probably a question for Fortran/DragonEGG experts:
>
> Why Fortran's "call flush()" is converted to "call void bitcast (void (...)*
> @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ? Why it needs
> bitcast?
Just a wild guess (basing from my llvm-gcc knwoledge though): there is
a bug with in gcc fortran frontend where it fails to
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Hi Anton,
>> How do you think what would be the best way to workaround this problem, if
>> it seems to be not in focus for anybody for now?
> Keep in mind, this not LLVM problem, it's gfortran problem. Also, it's
> of pretty low priority for gcc devs since they do almost no type
> checking on TREEs, so the varargs decl seems to be only viable
> llvm-side fix.
2012 Jul 17
2
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
> Oh, right, now I remember: it's a very old problem I knew 1.5 years ago.
> There were even some bugs on it, here is a common case:
Yes, this is right, fortran frontend produces bogus trees for every
external call.
The problem seems to have roots from the fact that there is no
external function decl here, so frontend has no way even to infer the
type from.
> How do you think what
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Hi Anton,
On 17/07/12 15:35, Anton Korobeynikov wrote:
>> actually there is a different fix, which is to not pay any attention to GCC
>> function types when generating calls (and function prototypes), and instead
>> do everything by querying GCC's CUMULATIVE_ARGS.
> I tried to do this during llvm-gcc times and it turned out that there
> might be different calls with
2012 Jul 17
1
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Thanks, Duncan, makes sense! I suppose you meant something like this:
Function* callee = dyn_cast<Function>(
call->getCalledValue()->stripPointerCasts());
if (!callee) continue;
- D.
2012/7/17 Duncan Sands <baldrick at free.fr>
> Hi Dmitry, it would be neater to use stripPointerCasts.
>
> Ciao, Duncan.