Displaying 20 results from an estimated 21 matches for "createglobalstringptr".
2012 Jan 22
2
[LLVMdev] CreateGlobalStringPtr giving linker errors
Hi,
I am trying to use some LLVM API in my C++ code, and I end up getting
linker errors. I am working on Apple MacOSX Lion. Using g++ for the
compile. It is the CreateGlobalStringPtr which is throwing the error. This
is LLVM 3.0.
Here's the codeI am trying to use some LLVM API in my C++ code, and I end
up getting linker errors. I am working on Apple MacOSX Lion. Using g++ for
the compile. It is the CreateGlobalStringPtr which is throwing the error.
This is LLVM 3.0.
Here&...
2012 Jan 22
0
[LLVMdev] CreateGlobalStringPtr giving linker errors
.../libexec/gcc/i686-apple-darwin10/4.2.1/libllvmgcc.dylib
- D.
2012/1/22 Arpan Sen <arpansen at gmail.com>:
> Hi,
>
> I am trying to use some LLVM API in my C++ code, and I end up getting linker
> errors. I am working on Apple MacOSX Lion. Using g++ for the compile. It is
> the CreateGlobalStringPtr which is throwing the error. This is LLVM 3.0.
>
> Here's the codeI am trying to use some LLVM API in my C++ code, and I end up
> getting linker errors. I am working on Apple MacOSX Lion. Using g++ for the
> compile. It is the CreateGlobalStringPtr which is throwing the error. This...
2012 Jan 23
1
[LLVMdev] Code crashing in CreateGlobalStringPtr, passes when I add code for main routine + entry
Hi All,
The following crashes in CreateGlobalStringPtr:
#include "llvm/Support/DataTypes.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#in...
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 *temp = M.getOrInsertFunction("printf",fType);
if(!temp){
errs()...
2011 Apr 05
2
[LLVMdev] inserting a print statement into IR
...11 at 11:33 PM, John Criswell <criswell at illinois.edu>wrote:
> 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 which pointer
> value is bad.
>
> As a guess, did you give the builder object all the information it needs to
> i...
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 which
pointer value is bad.
As a guess, did you give the builder object all the information it needs
to insert IR (e.g., which LLVM Module *...
2011 Apr 05
0
[LLVMdev] inserting a print statement into IR
Hi George,
> This is the seg fault I am getting.
>
> dyld: lazy symbol binding failed: Symbol not found:
> __ZN4llvm13IRBuilderBase18CreateGlobalStringEPKcRKNS_5TwineE
> Referenced from:
> /Users/georgebaah/llvm_dir/llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib
> Expected in: flat namespace
>
> dyld: Symbol not found:
2011 Apr 01
3
[LLVMdev] insert printf into IR
...arams, true);
Constant *temp = M.getOrInsertFunction("printf",fType);
if(!temp){
errs() << "printf function not in symbol table\n";
exit(1);
}
Function *f = cast<Function>(temp);
f->setCallingConv(CallingConv::C);
Value *intparam = ...
Value *strPtr = builder.CreateGlobalStringPtr(str,"");
builder.CreateCall2(PrintF, strPtr, intparam,"tmp6");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110401/cecae798/attachment.html>
2015 Nov 24
2
How to create a sprintf call in IR
...;
FunctionType* sprintfFT = FunctionType::get(Type::getInt32Ty(ctxt),
args, true);
Constant* sprintf = mod->getOrInsertFunction("sprintf", sprintfFT);
Now, I got stuck to create teh function call for sprintf.
I didn't it like the following:
Value* str = builder.CreateGlobalStringPtr("str", "");
Value* data = builder.CreateLoad(a); //load a, b, or c
Value* buf = builder.CreateLoad(buffer);
builder.CreateCall3((value*)sprintf, buf, str, data);
I want to test the sprintf function before adding the offset, but it didn't
work. The error informati...
2017 May 29
2
Print 128 bit value at runtime using printf
...->getType()->getIntegerBitWidth() <= 64)
{
tempString = tempString + "%+d,";
}
// Is this correct ?
else
{
if(ConstantInt* CI = dyn_cast<ConstantInt>(val))
{
// base 10 and signed
std::string res = CI->getValue().toString(10,true);
val=Builder.CreateGlobalStringPtr(res,"str");
tempString = tempString + "%+s,";
}
}
tempString = tempString + "%+d,";
}
// if any of the 6 floating point types
else if(val->getType()->isFloatingPointTy())
{
tempString = tempString + "%+f,";
//Apparently this is needed by printf,otehrw...
2015 Mar 10
4
[LLVMdev] noob IR builder question
...Function *mainFunc =
13 llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, "main", module);
14 llvm::BasicBlock *entry = llvm::BasicBlock::Create(context, "entrypoint", mainFunc);
15 builder.SetInsertPoint(entry);
16
17 llvm::Value *helloWorld = builder.CreateGlobalStringPtr("hello world!\n");
18
19 std::vector<llvm::Type *> putsArgs;
20 putsArgs.push_back(builder.getInt8Ty()->getPointerTo());
21 llvm::ArrayRef<llvm::Type*> argsRef(putsArgs);
22
23 llvm::FunctionType *putsType =
24 llvm::FunctionType::get(builder.getInt32Ty(), ar...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...truction* I, const char* text,
Value* arg1, Value* arg2, Value* arg3, Value* arg4) {
Function* printfFn = I->getModule()->getFunction("printf");
if (printfFn) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
Value* convertedText = Builder.CreateGlobalStringPtr(text);
std::vector <Value *> params;
params.push_back(convertedText);
if (arg1)
params.push_back(arg1);
if (arg2)
params.push_back(arg2);
if (arg3)
params.push_back(arg3);
if (arg4)
params.push_back(arg4);
return Builder.CreateCall(printfFn, params);
}
return I;
}
void InstructionVisitor::...
2011 Apr 01
0
[LLVMdev] insert printf into IR
Hi George,
> 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.
if you are doing development with LLVM then you should build LLVM with
assertions enabled. That way you get understandable failures rather
than obscure segmentation faults.
> Function *f = cast<Function>(temp);
2017 Apr 29
0
How to pass a StringRef to a function call inserted as instrumentation?
Hi, Dipanjan,
On 28 April 2017 at 16:32, Dipanjan Das via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I am wriitng an LLVM pass to insert instrumentation at certain points of the
> program. I want to pass the `StringRef` obtained from `getName()` as a
> parameter to a function `func(char* s)`. I can allocate some space on stack
> using `AllocaInst` to generate an `alloca`
2017 May 26
2
Printing out a 128 bit decimal
Hi,
I was wondering how I can print out the result of some arithmetic on 128 bit integers.
After having a look at the API , it seems it is possible to get the integer value from the
"ConstantInt::getSextValue() " but the return value is only a int64_t.
I wish to print it on the console output and printing as a string or decimal ( using C standard library printf )
My Question :
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 =
2015 Aug 05
2
[BUG] Incorrect ASCII escape characters on Mac
On Wed, 2015-08-05 at 10:02 -0400, Ramkumar Ramachandra wrote:
>
> - at 5 = internal global [10 x i8] c"\22\D0\12\F4!\00\15\F9\EC\E1"
> - at 6 = internal global [10 x i8] c"\D0\19\FB+\FD\F8#\03\E2\11"
> + at 5 = internal global [10 x i8] c"\22Ð\12ô!\00\15ùìá"
> + at 6 = internal global [10 x i8] c"Ð\19û+ýø#\03â\11"
>
> The diff
2017 Apr 28
4
How to pass a StringRef to a function call inserted as instrumentation?
I am wriitng an LLVM pass to insert instrumentation at certain points of
the program. I want to pass the `StringRef` obtained from `getName()` as a
parameter to a function `func(char* s)`. I can allocate some space on stack
using `AllocaInst` to generate an `alloca` instruction. But, how can I copy
the `StringRef` to the stack space?
--
Thanks & Regards,
Dipanjan
-------------- next part
2013 Dec 03
0
[LLVMdev] Fwd: code-generating constant strings
For some reason the mail didn't got through the first time, so sending
it again.
-------- Original Message --------
Subject: code-generating constant strings
Date: Tue, 03 Dec 2013 01:56:11 +0100
From: Alexander Popolitov <popolit at gmail.com>
To: llvmdev at cs.uiuc.edu.
Hi, everyone!
I have maybe very naive question, but nontheless.
I'm experimenting with Kaleidoscope
2013 Dec 03
2
[LLVMdev] code-generating constant strings
Hi, everyone!
I have maybe very naive question, but nontheless.
I'm experimenting with Kaleidoscope tutorial and I want to morph it into
something similar to McCarthy's initial Lisp.
For that, I need to implement symbols, which I thought I should
implement as pointers to structures, and those
structures would contain at least one field, which would be symbol's name.
So, here's a