similar to: [LLVMdev] setSection not working?

Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] setSection not working?"

2011 Nov 24
1
[LLVMdev] differences in IR and ELF?
I'm trying to create a GlobalVariable that is a ConstantArray. Id like each element to be a pointer to other things in the program(global variables, functions). So that they all have the same type Id like to make the elements void pointers. I think I am going about this wrong, heres how I am doing it: void writeArray(Module &M, GlobalVariable *shadow, Function *val,
2011 Nov 24
0
[LLVMdev] differences in IR and ELF?
Contents of section my_section: 400890 c3666666 6666662e 0f1f8400 00000000 .ffffff......... 4008a0 38106000 00000000 b0064000 00000000 8.`....... at ..... 4008b0 d0064000 00000000 0f1f8400 00000000 .. at ............. 4008c0 38106000 00000000 d0064000 00000000 8.`....... at ..... 4008d0 30074000 00000000 0. at ..... This seems too big and doesn't make sense
2011 Nov 15
0
[LLVMdev] constructing global array of pointers?
I'm trying to create a GlobalVariable(that is a ConstantArray) in its own section. I want each element to be a pointer to a global thats already in the program(a variable or function). The follow code makes sense to me and compiles fine, but gives me the wrong output. When I look at the section in the ELF file it is larger than I expected and appears to be wrong. The contents of the array do
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
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 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 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
2013 Mar 04
2
[LLVMdev] llvm cannot iterate a [3 x i8]
Hello everyone, I am trying to "parse" a part of LLVM IR. More exactly, from @.str = private unnamed_addr constant [3 x i8] c"DS\00", section "llvm.metadata" I want to get "DS". It is the single place in the whole bytecode from where I can get it. I have : ... Value *VV = cast<Value>(LD100->getOperand(1)->getOperand(0));
2010 May 11
0
[LLVMdev] How to create Global Variables using LLVM API?
subramanyam wrote: > > I am new to LLVM API. and I am experimenting with it. > I want to create Global Variables in a module. > I am able to create local variables using IRBuilder class. I tried using > GlobalVariable class to create global variables. > but it doesn't work. my code looks like this: > > Module* mod = new Module("test", getGlobalContext()); >
2012 Jul 23
1
[LLVMdev] static constant structs
Duncan Sands <baldrick at free.fr> writes: >> 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
2010 May 11
2
[LLVMdev] How to create Global Variables using LLVM API?
I am new to LLVM API. and I am experimenting with it. I want to create Global Variables in a module. I am able to create local variables using IRBuilder class. I tried using GlobalVariable class to create global variables. but it doesn't work. my code looks like this: Module* mod = new Module("test", getGlobalContext()); Constant* c = mod->getOrInsertFunction("main",
2012 Jun 17
3
[LLVMdev] BlockAddress instruction is copied instead of cloned during module link?
I have a module having the blockaddress instruction. When I link it into another module and delete the original, blockaddress disappears and is replaced by inttoptr (i32 1 to i8*). Please compile and run the attached program to see the demo of this problem. Right after linking modules, blockaddress still exists: @switch.bbs = internal global [3 x i8*] [i8* blockaddress(@my_func,
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 Oct 17
0
[LLVMdev] R_ARM_ABS32 disassembly with integrated-as
Hi Jim, The diff below is not intended to be a patch, but a starting point. It is the shortest path (I hope) to getting LLVM to emit ARM mapping symbols to the ELF without changing any shared interfaces. Could you have a look at the FIXME comments and offer some pointers on how to get this code out of MCELFStreamer? Thanks, Greg diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
2019 Feb 22
1
Create the GlobalVariable which have extern in one header file
I have changed it to ExternalLinkage. Now, in LLVM IR, it looks like that: @DATA_TABLE = external global [0 x i8*], section "data_section", align 16 #0 @DATA_TABLE.1 = global [10 x i8*] [i8* inttoptr (i64 53415718 to i8*), i8* bitcast (void (%class.Hello*)* @_ZN5Hello5ptofnEv to i8*),...], section "data_section", align 16 #0 In my uses: %arrayidx = getelementptr inbounds [0 x
2010 May 12
2
[LLVMdev] How to create Global Variables using LLVM API?
Thanks. It works. Actually, the signature of the constructor given in the online documentation is different from the actual source code. Nick Lewycky wrote: > > subramanyam wrote: >> >> I am new to LLVM API. and I am experimenting with it. >> I want to create Global Variables in a module. >> I am able to create local variables using IRBuilder class. I tried using
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
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
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