Displaying 20 results from an estimated 9000 matches similar to: "[LLVMdev] Replacing an initializer"
2015 May 18
2
[LLVMdev] copy value of a global's data field to another global
getInitializer returns the complete initializer of the global.
My globals are complex nested structs, from which I want to extract e.g. one
double datafield.
Example:
>From a struct Stuct having double,array(3xint),float fields, I could extract
the second int value using the index sequence 0,1,1 with getGetElementPtr.
This gives me a constantPointer, but I would need to get a constInt...
2015 May 17
2
[LLVMdev] copy value of a global's data field to another global
Hi all,
I can get access to the data stored in globals as follows:
GlobalVariable* pGvarAct=_set_a_valid_global_;
const_ptr_indicesVec=_the_indexes_
llvm::Constant* pConst;
pConst=ConstantExpr::getGetElementPtr(pGvarAct, const_ptr_indicesVec);
and e.g. use this to repalece an argumrnt of an instruction like:
I->setOperand(someArgumentIndex,pConst);
However, getGetElementPtr returns a
2016 Aug 24
2
Change GlobalValue Type/Initializer
Hi,
I am trying to update the initializer of a global value and I have encounter two issues:
The first one is that I can not change the type of the global value. Let say that I have the following variable: @.str = private unnamed_addr constant [6 x i8] c”Test0A\00", align 1
How can I change the ”Test0A\00” to ”OtherTest0A\00”. Is this possible? I know that you can change the initializer
2016 Aug 24
2
Change GlobalValue Type/Initializer
Hi Mehdi,
Thank you for you answer.
> Yes it is normal you *have* to use the same context to manipulate IR inside a Module. The context owns the module and destroying the context destroys everything that is created in the context. It is not clear to me what other context you could even manage to use here conceptually.
Actually I was using llvm::getGlobalContext() in order to get the context.
2009 Jun 18
0
[LLVMdev] Initialising global Array
Andreas Neustifter wrote:
> Hi,
>
> I try to create a array that has a nonzero initialiser:
>
> What i do is, first create the array type.
>
> > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges);
>
> Then create some constant values for the initializer.
>
> > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges);
>
>
2009 Jun 18
3
[LLVMdev] Initialising global Array
Hi,
I try to create a array that has a nonzero initialiser:
What i do is, first create the array type.
> const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges);
Then create some constant values for the initializer.
> std::vector<Constant*> Initializer; Initializer.reserve(NumEdges);
> APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero);
> APInt
2015 Jan 22
3
[LLVMdev] numeric limits of llvm Types?
Hi all,
can I access the numeric limits of the llvm types,
e.g. HalfTy, FloatTy, DoubleTy, etc.
in a fashion like the std numeric_limits tool?
std::numeric_limits<half>::min()
std::numeric_limits<half>::max()
In c++API, I want to initialize values and need to know the correct range
for the llvm types....
Thx
Alex
2012 Nov 10
2
[LLVMdev] Forward references of globals in .ll files
I'm experiencing a weird issue during .ll file parsing, and I'm not sure if
it's a bug in the .ll parser, or if I'm just not understanding the IR.
Take the following IR:
@a = addrspace(1) global i8 0
@a2 = global i8 addrspace(1)* @a
This parses fine. But if I rearrange the statements to:
@a2 = global i8 addrspace(1)* @a
@a = addrspace(1) global i8 0
then I get an ugly
2015 Mar 18
5
[LLVMdev] casting Constant * to value *?
John, you are right.
I 'browsed' the doxygen's inheritance diagram.
Shouldn't I then be able to cast Constant * to Value*?
Plugging the retrieved Constant* (from ConstantExpr::getGetElementPtr)
into Instruction->setOperand compiles, but gives me an assertion failure at
runtime.
I have no access to the code at the moment. I will gather more information
possibly tomorrow.
2015 Mar 05
4
[LLVMdev] global variable
Hi all,
I am newbie for llvm. I just create a global variable, there are some statements in my pass like:
LoadInst* int64_64 = new LoadInst(pthreadPID, "", false, OptAplusOne);
int64_64->setAlignment(8);
int64_64->dump();
LoadInst* int32_65 = new LoadInst(gvar_int32_myFlag, "", false, OptAplusOne);
int32_65->setAlignment(4);
2012 Nov 10
0
[LLVMdev] Forward references of globals in .ll files
On Fri, Nov 9, 2012 at 5:01 PM, Justin Holewinski
<justin.holewinski at gmail.com> wrote:
> I'm experiencing a weird issue during .ll file parsing, and I'm not sure if
> it's a bug in the .ll parser, or if I'm just not understanding the IR.
>
> Take the following IR:
>
> @a = addrspace(1) global i8 0
> @a2 = global i8 addrspace(1)* @a
>
> This
2019 Jan 28
2
Create a BlockAddress array from LLVM Pass
Hi
Good day. For the following function local static constant array:
static const __attribute__((used))
__attribute__((section("data"))) void *codetable[] = {
&&RETURN, &&INCREMENT, &&DECREMENT, &&DOUBLE, &&SWAPWORD};
I have the following in the LLVM IR.
@sampleCode.codetable = internal global [5 x i8*] [i8* blockaddress(@sampleCode, %19), i8*
2015 Mar 17
2
[LLVMdev] casting Constant * to value *?
Hi all,
extracting datafields of globals, the API code ends up in a Constant *
Constant* const_ptr_103 = ConstantExpr::getGetElementPtr(gvar_struct_foo,
const_ptr_103_indices);
it can be used to initialize e.g. a new instruction like:
StoreInst* void_119 = new StoreInst(const_float_102, const_ptr_103, false,
label_entry_113);
But how about replacing the operand of an already existing
2013 Sep 28
1
[LLVMdev] use function address as global variable initializer
Hi
I would like to initialize a global variable to the address of a function.
Looking at how clang compiles the C code below, i see @main_ptr = global
i8* bitcast (i32 ()* @main to i8*), align 8
but how do i generate i8* bitcast (i32 ()* @main to i8*), align 8 in LLVM
IR and use it as initializer to a GlobalVariable.
I know i will need to use the bitcast instruction. but as far i as i
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
2008 Aug 15
5
Add more disk
Hello
¿How could I add more disk space and another partition to my Windows 2k3
domu? I dont want to resize the C: partition a need a newone.
kind regards
-----Mensaje original-----
De: John Leach [mailto:john@johnleach.co.uk]
Enviado el: Viernes, 15 de Agosto de 2008 12:25
Para: Xen-users@lists.xensource.com
Asunto: Re: [Xen-users] Live migration - Networking take 2 minutes or so
to return
2019 Jan 29
2
[cfe-dev] Create a BlockAddress array from LLVM Pass
Sorry for emailing both group.
As I will have a constant array of BlockAddress, what type I should use in Constant Array for its ArrayType declaration?
I am creating the list in following way:
unsigned int nBr = fit->second.size();
llvm::Constant *listBA[nBr];
unsigned int Idx = 0;
for (std::set<llvm::BasicBlock *>::iterator it = fit->second.begin();
it != fit->second.end(); ++it)
2004 Oct 12
1
[LLVMdev] Re: Hide visible string in variable (Chris Lattner)
Hi,
Thanks so much at first.
> Here are some observations:
>
> > for C level,
> >
> > char a[]="global string test";
> > for(i=0;i<strlen(a);i++){
> > a[i]= a[i]^RANDMON;
> > }
>
> If you compile this C code, "global string test" will occur in the program
> binary, so you have not obfuscated anything. You can
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 =
2015 May 27
2
[LLVMdev] convert GetElemtPtr result to pointer on element?
Hi Tim,
I forgot to say that I try to do all this in the LLVM API, not IR.
I read in a bc'ed program and try to edit it using the API.
Alex
Tim Northover wrote:
>> But I can not succeed in using the getGetElementPtr result in
>> constructing an initalizer for another global value (which expects a
>> ConstantFP* and not a ConstantExpr*).
>
> The result of a