similar to: [LLVMdev] string to value

Displaying 20 results from an estimated 10000 matches similar to: "[LLVMdev] string to value"

2012 Jul 23
2
[LLVMdev] static constant structs
I hope this is the correct forum in which to ask this question. Currently I am writing code meant to compile with LLVM 3.0. I am trying to figure out, using the C++ API, how to create a constant static struct, or the equivalent. Since I am copying data from existing C structs, I am currently I am using a ConstantArray global variable, and then pointer casting it to the appropriate type when I
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
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 =
2012 Jul 23
0
[LLVMdev] static constant structs
Hi Michael, > I hope this is the correct forum in which to ask this question. > > Currently I am writing code meant to compile with LLVM 3.0. I am trying > to figure out, using the C++ API, how to create a constant static > struct, or the equivalent. Since I am copying data from existing C > structs, I am currently I am using a ConstantArray global variable, and > then
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
I am trying to create such module with API (it's equivalent to c++: const char* ss[] = {"s1","s2"};): @ss = global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0)] ; <[2 x i8*]*> [#uses=0] @.str1 = private constant [3 x i8] c"s1\00", align 1 ; <[3 x i8]*> [#uses=1]
2015 Jun 02
2
[LLVMdev] Linking modules across contexts crashes
> On 2015-Jun-02, at 12:37, Yuri <yuri at rawbw.com> wrote: > > On 06/01/2015 11:43, Duncan P. N. Exon Smith wrote: >> You can round-trip to bitcode, reading the module into the >> destination context. The following pseudo-code gives the idea: >> >> bool linkModuleFromDifferentContext(Module &D, const Module &S) { >>
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
Hi, I'm trying to replace function call with call to wrapper(function_name, num_args, ...), where varargs hold args of original call. Function* launch = Function::Create( TypeBuilder<int(const char*, int, ...), false>::get(context), GlobalValue::ExternalLinkage, "kernelgen_launch_", m2); { CallInst* call = dyn_cast<CallInst>(cast<Value>(I)); if
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 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Evening, I was writing some code that tried to insert calls to the llvm.annotation intrinsic function, which has a signature of (i32, i8*, i8*, i32). The code is below. void addAnnotation( BasicBlock *block, Function *F) { string foo = "foo"; string bar = "barr"; Type *charTy = Type::getInt8Ty(block->getContext()); ArrayType *s1Ty =
2012 Jan 28
0
[LLVMdev] How to get the string value?
Hi Welson, > Yes, it is a ConstantExpr! Thank you! > > Now trying to find a clue in ConstantExpr's functions to get that string :-) you can get the pointer operand by doing: getOperand(0) The i'th index is getOperand(i+1). Ciao, Duncan. > > Regards, > Welson > > On Thu, Jan 26, 2012 at 9:04 PM, Duncan Sands <baldrick at free.fr > <mailto:baldrick at
2011 Oct 20
2
[LLVMdev] common type at compile time?
I'm a bit confused. For the Type did you mean something like: ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); This does not work, it gives me ""Wrong type in array element initializer" at runtime. Also it doesn't look like ConstantExpr inherits ConstantArray, so I'm not sure how I could use this instead. Thanks On Thu, Oct 20, 2011 at
2011 Oct 20
3
[LLVMdev] common type at compile time?
I'm trying to create a ConstantArray(whose contents will be of types Function*, GlobalVariable *) so I can immediately create a new GlobalVariable(that will be in its own section). I'm doing this so I have these address stored. In order to create this ConstantArray I need a valid ArrayType, but I'm not sure what to use for the element type. I want this to be done at compile time, so I
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
Hi Dimitry, This makes sense if you think about it from the perspective that the string you want passing must be passed at runtime, and so can't use a const char * from compile time. You need to make the string visible in the compiled image, and use that as the argument. A string is an array of 8-bit integers, so you need to create a ConstantArray. Value *v = ConstantArray::get(Context,
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
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Andrew Ruef wrote: > Evening, > > I was writing some code that tried to insert calls to the > llvm.annotation intrinsic function, which has a signature of (i32, > i8*, i8*, i32). The code is below. > > void addAnnotation( BasicBlock *block, Function *F) > { > string foo = "foo"; > string bar = "barr"; > > Type
2012 Sep 05
2
[LLVMdev] llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool) deprecated?
Hi all; I have been trying to use the llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool) function but seems it has been deprecated. ProfileDependence.cpp:68:73: error: no matching function for call to ‘llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool)’ ProfileDependence.cpp:68:73: note: candidate is:
2011 May 20
3
[LLVMdev] convert a char * to a value
Hi all, Please i need help, I have a method that takes 2 arguments with type char *: void branchPredict(char *b1, char *b2){ --- -- } i'm supposed to add this method, in an IR basic bloc: to add it into a basic bloc i do: //i: is the basic bloc std::vector<Value*> void_43_params; Constant* tbname = ConstantArray::get(M.getContext(),i->getNameStr() , true); Constant* pbname =
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 11:34 AM, ret val wrote: > I'm a bit confused. For the Type did you mean something like: > ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); I assume that creates an ArrayType of 4 elements whose elements are pointers to 8-bit values. If so, then this is what I meant. > This does not work, it gives me ""Wrong type in array
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 10:43 AM, ret val wrote: > I'm trying to create a ConstantArray(whose contents will be of types > Function*, GlobalVariable *) so I can immediately create a new > GlobalVariable(that will be in its own section). I'm doing this so I > have these address stored. In order to create this ConstantArray I > need a valid ArrayType, but I'm not sure what to use for