search for: getasstr

Displaying 20 results from an estimated 43 matches for "getasstr".

Did you mean: getashr
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 anything. Regards -- Giovanni [dacav] Simoni <giovanni...
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... URL: <http://lists.llvm.org/...
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
...owing 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 = pArray->getAsString(); unsigned TextLengthAfter = Text.length(); After running this example here are the values in each variable: TextLengthBefore = 10 NumElements = 11 TextLengthAfter = 11 In the conversion from constant array to a string the null terminating character is added as part of the string and...
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 actually , not ConstantArray so I have to get string object like this : GlobalVariable* gv = cast<GlobalVariable>(c->getOperand(0)); C...
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.
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
...owing 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 = pArray->getAsString(); unsigned TextLengthAfter = Text.length(); After running this example here are the values in each variable: TextLengthBefore = 10 NumElements = 11 TextLengthAfter = 11 In the conversion from constant array to a string the null terminating character is added as part of the string and...
2010 Jul 28
1
[LLVMdev] Strange behavior when converting arrays to strings
...AddNull==false then the string is copied without /// null termination. static Constant *get(LLVMContext &Context, StringRef Initializer, bool AddNull = true); Ciao, Duncan. > > unsigned NumElements = pArray->getNumOperands(); > > Text = pArray->getAsString(); > > unsigned TextLengthAfter = Text.length(); > > After running this example here are the values in each variable: > > TextLengthBefore = 10 > > NumElements = 11 > > TextLengthAfter = 11 > > In the conversion from constant array to a string the null termina...
2004 Dec 09
1
[LLVMdev] Question about insert call func with pionter parameter
...ar *); >ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer()); ...... >Function *exFunc = M->getOrInsertFunction("stat_func", Type::VoidTy, PointerType::get(Type::SByteTy),0); >std::vector<Value*> Args(1); >Args[0] = constantArray::get(Cstr->getAsString()); >CallInst *call = new CallInst(exFunc, Args,"",InsertPos); If the code look like the above, it could compile successfully. But once I run this pass, finally, I got errors as the following. " Call parameter type does not match function signature!" [21 x sbyte] c&quot...
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 Apr 20
2
[LLVMdev] How to cast Value* to ConstantDataArray*
...ef r(Val); return ConstantDataArray::getString(getGlobalContext(), r, false); } I am trying to concatenate Strings and have a ConcatExprAST with its Codegen method. Upon trying to access the data in the ConstantDataArray, I need to cast the Value* back to a ConstantDataArray* in order to use the getAsString() method. I tried: ConstantDataArray * cda = cast<ConstantDataArray>(v); where v is a Value*. It does not work. How can I do this? Thanks for any help. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachm...
2013 Jun 25
2
[LLVMdev] get value
...t I cannot get fields from a Value type. If my Value is i32 1, how can I store 1 in a different structure (an integer) ? For the type, I have getType(). For the value, I see no method in Value.h. I tried to cast to ConstantExpr and then to get operands, or cast to ConstantDataArray and then use getAsString(), but is not working. How should I get the value? Thank you ! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130625/a8f88bfb/attachment.html>
2013 Jun 25
4
[LLVMdev] get value
...alue type. > > >If my Value is i32 1, how can I store 1 in a different structure (an integer) ? For the type, I have getType(). For the value, I see no method in Value.h. > > > >I tried to cast to ConstantExpr and then to get operands, or cast to ConstantDataArray and then use getAsString(), but is not working. How should I get the value? > > >Thank you ! > > > >_______________________________________________ >LLVM Developers mailing list >LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu >http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > &...
2013 Apr 21
2
[LLVMdev] How to cast Value* to ConstantDataArray*
...lobalContext(), r, false); >> } >> >> I am trying to concatenate Strings and have a ConcatExprAST with its >> Codegen method. Upon trying to access the data in the ConstantDataArray, I >> need to cast the Value* back to a ConstantDataArray* in order to use the >> getAsString() method. >> >> I tried: >> >> ConstantDataArray * cda = cast<ConstantDataArray>(v); >> >> where v is a Value*. It does not work. >> > *How* does it not work? You need to give us more information. Also make > sure that you have read < &gt...
2013 Feb 27
3
[LLVMdev] llvm get annotations
...ue::ConstantArrayVal) { ConstantArray *ca = (ConstantArray *)v; std::cout << " argument " << a->getType()->getDescription() << " "<<a->getName().str() << " has annotation \"" << ca->getAsString() << "\"\n"; } Is there an easier way to get the simple DS annotation of @f ? Thank you for any suggestion! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130227/39dbfc2f/attac...
2011 Jul 16
0
[LLVMdev] TableGen and DenseMap Strangeness
...* >, std::string > Key; #endif typedef DenseMap<Key, TernOpInit *> Pool; static Pool ThePool; #ifdef WORKS Key TheKey(std::make_pair(std::make_pair(std::make_pair(std::make_pair(opc, Type->getAsString()), lhs), mhs), rhs)); #else Key TheKey(std::make_pair(std::make_pair(std::make_pair(std::make_pair(opc,...
2012 Nov 16
0
[LLVMdev] porting to 3.1: ConstantDataArray
...a <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 ConstantDataArray has a getAsCString() which is exactly what you want. See here line 623: http://llvm.org/viewvc/llvm-project/llvm/tags/RELEASE_31/final/include/llvm/Constants.h?view=annotate Jay.
2013 Apr 20
0
[LLVMdev] How to cast Value* to ConstantDataArray*
...ataArray::getString(getGlobalContext(), r, false); > } > > I am trying to concatenate Strings and have a ConcatExprAST with its > Codegen method. Upon trying to access the data in the ConstantDataArray, I > need to cast the Value* back to a ConstantDataArray* in order to use the > getAsString() method. > > I tried: > > ConstantDataArray * cda = cast<ConstantDataArray>(v); > > where v is a Value*. It does not work. > *How* does it not work? You need to give us more information. Also make sure that you have read < http://llvm.org/docs/ProgrammersManual.ht...
2006 Mar 25
1
[LLVMdev] could you give me some advice ?
...his declaration in another program Module* m = loadModule("XXX.bc"); Constant* c = findValue(m,"E1$entry"); GlobalVariable* gv = cast<GlobalVariable>(c->getOperand(0)); ConstantArray* ca = cast<ConstantArray>(gv->getOperand(0)); std::string str = ca->getAsString(); now str = "E1" these code looks a little ugly , could you tell me better solution ? In another word , I want to know the reverse operation of ConstantExpr::getPtrPtrFromArrayPtr . thanks
2013 Jun 25
0
[LLVMdev] get value
...lue type. > > If my Value is i32 1, how can I store 1 in a different structure (an > integer) ? For the type, I have getType(). For the value, I see no method > in Value.h. > > I tried to cast to ConstantExpr and then to get operands, or cast to > ConstantDataArray and then use getAsString(), but is not working. How > should I get the value? > > Thank you ! > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > &...
2013 Jun 25
0
[LLVMdev] get value
...lue type. > > If my Value is i32 1, how can I store 1 in a different structure (an > integer) ? For the type, I have getType(). For the value, I see no method > in Value.h. > > I tried to cast to ConstantExpr and then to get operands, or cast to > ConstantDataArray and then use getAsString(), but is not working. How > should I get the value? > > Thank you ! > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > &...