Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] could you give me some advice ?"
2006 Mar 27
1
[LLVMdev] could you give me some advice ?
excuse me for bother you again .
a little supplement
Constant* c = findValue(m,"E1$entry");
Constant* c2 = findValue(m,"E1$str");
I can get string object from c2
string s = cast<ConstantArray>(c2)->getAsString();
but it is not applicable for c
string s= cast<ConstantArray>(c)->getAsString(); // Assert Fail
because c is ConstantExpr::GetElementPtr
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
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
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*>
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
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 =
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
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
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
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 Jun 30
1
[LLVMdev] instruction sequence
I'm trying to insert a call to fprintf(stderr, ...). I've looked at
the emitted assembly from llvm-gcc, and it consists of a LoadInst (of
stderr) and CallInst. It looks like this:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%tmp.1 = load %struct._IO_FILE** %stderr ; ty=%struct._IO_FILE*
%tmp.0 = call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf(%struct._IO_FILE* %tmp.1, sbyte*
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 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
2012 Feb 17
0
[LLVMdev] llvm-gcc compilation and ConstantArray::getAsString
Hi Giovanni,
> 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.
llvm-gcc is dead. Please use dragonegg (which is analogous to llvm-gcc, but for
gcc-4.5/gcc-4.6) or clang instead.
Ciao, Duncan.
2005 Jan 31
1
[LLVMdev] Question about Global Variable
Hi,
Sorry for bothering you guys again.
I got problem when I am trying to recover the Global Variable Initial value. What I did is like the following
ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer());
// the above instruction enable me to get the content of initial string of global variable, like char a[10] ="test global";
And then I make some change for
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?
2004 Oct 10
1
[LLVMdev] Re: Hide visible string in variable
Hi,
> On Mon, 27 Sep 2004, Zhang Qiuyu wrote:
>
> > Is there a way to modify the string such as char a or char b? Could I
> > use the way like "Replace an instruction with another Value" in Programm
> > Manual? In fact, what I am interested in is string with visible
> > expression, not all string, and I am trying to hide the orignal string
> > by
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