Displaying 20 results from an estimated 2000 matches similar to: "[LLVMdev] could you give me some advice ?"
2006 Mar 25
1
[LLVMdev] could you give me some advice ?
hi
I have one llvm program like this :
...
; define ConstantArray
"E1$str" = internal constant [3 x sbyte] c"E1\00"
; use getPtrPtrFromArrayPtr to define SByte* from ConstantArray
"E1$entry" = internal constant sbyte* getelementptr ([3 x sbyte]* "E1$str", uint 0, uint 0)
...
when i want to get std::string object from this declaration in
2006 Mar 27
0
[LLVMdev] could you give me some advice ?
for example , I have a LLVM bc file generated from c program like this
...
char E1$str[3] = "E1";
char* E1$entry = (char*)E1$str;
struct { char* name_list[16]; } table = { E1$entry, E2$entry, ... };
...
now I need load the bc file , get all names ("E1","E2"...) , then print and save it.
of course, i only know the global variable table name . I can get
2006 Mar 26
0
[LLVMdev] could you give me some advice ?
lizhuo,您好!
不是很明白你的意思,好像你想从一个ConstantExpr::getPtrPtrFromArrayPtr 指针得到这个ConstantExpr 的内容,
但你的困难在哪里?
======= 2006-03-25 22:04:14 您在来信中写道:=======
>hi
>I have one llvm program like this :
>..
>; define ConstantArray
>"E1$str" = internal constant [3 x sbyte] c"E1\00"
>
>; use getPtrPtrFromArrayPtr to define SByte* from ConstantArray
2004 Dec 09
1
[LLVMdev] Question about insert call func with pionter parameter
Hi,
I got a problem when I am trying to insert a call function with pointer arguments.
The function C proto-type is the following,
void stat_func(char *);
>ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer());
......
>Function *exFunc = M->getOrInsertFunction("stat_func", Type::VoidTy, PointerType::get(Type::SByteTy),0);
>std::vector<Value*>
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
Hello,
I found saw some strange behavior (to me) when converting constant arrays to strings. Consider the following example:
std::string Text = "HelloWorld";
unsigned TextLengthBefore = Text.length();
ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true));
unsigned NumElements = pArray->getNumOperands();
Text =
2010 Jul 28
1
[LLVMdev] Strange behavior when converting arrays to strings
Hi Javier,
> I found saw some strange behavior (to me) when converting constant
> arrays to strings. Consider the following example:
>
> std::string Text = "HelloWorld";
>
> unsigned TextLengthBefore = Text.length();
>
> ConstantArray *pArray =
> dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(),
> Text, true));
from
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
Hi,
I haven't seen a response and I'm curious if I should submit a patch for this.
Thanks,
Javier
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Martinez, Javier E
Sent: Friday, July 16, 2010 3:20 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Strange behavior when converting arrays to strings
Hello,
I found saw some strange behavior (to
2012 Feb 17
4
[LLVMdev] llvm-gcc compilation and ConstantArray::getAsString
Hello there
I'm trying to compile llvm-gcc, but the compilation fails. This is due to
the fact that the ConstantArray class does no longer have the getAsString
method.
It has been actually removed on Jan 31 (commit
6a89228faca4b30c4abc29b5dec98bdac011ea4c).
Is there a patch for llvm-gcc which overcomes this problem? I've just
svn-updated my working copy but it didn't change
2006 Oct 17
1
[LLVMdev] initializer does not match global variable type.
>Right. This looks like it's just a simple bug in llvm2cpp.
>CppWriter.cpp:698 contains:
>
> if (CA->isString() && CA->getType()->getElementType() ==
>Type::SByteTy) {
> Out << "Constant* " << constName << " = ConstantArray::get(\"";
> printEscapedString(CA->getAsString());
> //
2006 May 01
2
[LLVMdev] printf decleration
I am writing a pass where I need to make a function deceleration for
printf. Below is the code I'm trying to use.
-----
bool MyPass::runOnModule(Module &m) {
vector<const Type*> args;
args.push_back(PointerType::get(Type::SByteTy));
Function* f = m.getOrInsertFunction("printf",
FunctionType::get(Type::IntTy, args, true));
-----
When I insert a call
2006 May 01
0
[LLVMdev] printf decleration
Ok, I think I figured it out. I talked to someone, and we figured out
that when I make a call to printf with a constant string, I need to make
a global variable and use getElementPtr to reference it. The modified
call for accessing the printf is:
/* m is Module*, f is Function*, i is Instruction* */
Constant* constStr = ConstantArray::get("test\n");
GlobalVariable* gv =
2012 Nov 29
1
[LLVMdev] ConstantArray::getAsString in LLVM 3.1
Hello,
I'm working on porting a project to LLVM 3.1. Unfortunately, my project makes very heavy use of ContantArray::getAsString() -- which was removed in LLVM 3.1. Is there an equivalent in 3.1? In other words, what is the best way to get the value of a string that was stored in a ConstantArray?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
2012 Nov 16
2
[LLVMdev] porting to 3.1: ConstantDataArray
Hi,
In llvm 3.0 llvm::ConstantArray had a ::getAsCString() method that
returned the buffer as a std::string. Now it seems that 3.1 this
method dissapeared.
I found that llvm::ConstantDataArray has a method called
getAsString(), but it returns a Constant*.
What is the safe way to retrieve the pointer of the Constant array as
a C string?
2013 Feb 27
3
[LLVMdev] llvm get annotations
Hello everyone !
I followed
http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanagerin
order to get annotations from my target bytecode. All the examples
that
I give in the following is related to the code from that link. I have
`__attribute__((annotate("DS"))) int f=0;` into the target C++ program and
the related IR code:
@.str = private unnamed_addr
2012 Jan 28
1
[LLVMdev] How to get the string value?
Hey Duncan,
Thanks! I figured out this piece of code finally:
Value *gep = call->getArgOperand(0);
if ( ConstantExpr *pCE = dyn_cast<ConstantExpr>(gep) ) {
Value *firstop = pCE->getOperand(0);
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(firstop)){
Constant *v = GV->getInitializer();
if
2012 Nov 16
0
[LLVMdev] porting to 3.1: ConstantDataArray
On 16 November 2012 13:55, charles quarra
<charllsnotieneningunputocorreo at gmail.com> wrote:
> In llvm 3.0 llvm::ConstantArray had a ::getAsCString() method that
> returned the buffer as a std::string. Now it seems that 3.1 this
> method dissapeared.
>
> I found that llvm::ConstantDataArray has a method called
> getAsString(), but it returns a Constant*.
In 3.1
2006 Oct 16
2
[LLVMdev] initializer does not match global variable type.
>-----Original Message-----
>From: llvmdev-bounces at cs.uiuc.edu
>[mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner
>Sent: Monday, October 16, 2006 2:09 PM
>To: LLVM Developers Mailing List
>Subject: Re: [LLVMdev] initializer does not match global variable type.
>
>On Mon, 16 Oct 2006, Anderson, Todd A wrote:
>> I have an objective-c file, bar.m,
2013 Mar 01
0
[LLVMdev] llvm get annotations
Hi Sebastian,
Thanks for the response.
I already did this :
I cast the entire annotated expression to Value*. Then, in order to avoid
ugly things like getAsString(), I check if V->getValueID() ==
Value::ConstantArrayVal in order to cast it to ConstantArray. Because it
contains only array[0], I cast array0>getOperand(0) to ConstantStruct.
Therefore, from ConstantStruct you can get all the
2013 Mar 01
1
[LLVMdev] llvm get annotations
Hi, I solved it. From the ConstantStruct you can call getOperand() multiple
times, so "mine" as deep as you can.
On Fri, Mar 1, 2013 at 1:41 PM, Alexandru Ionut Diaconescu <
alexandruionutdiaconescu at gmail.com> wrote:
>
> Hi Sebastian,
>
> Thanks for the response.
>
> I already did this :
>
> I cast the entire annotated expression to Value*. Then, in
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