Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] Statically Initialized Arrays"
2005 Nov 02
0
[LLVMdev] Statically Initialized Arrays
On Wed, 2 Nov 2005, Evan Jones wrote:
> I am trying to generate LLVM code that references a global array.
> Unfortunately, while I am generating the code I do not know the final length
> of the array, as I add elements to it as my compiler goes along. What is the
> best way to do this in LLVM? Ideally, I would be able to define the
> GlobalVariable array and change its length
2005 Nov 02
1
[LLVMdev] Statically Initialized Arrays
On Nov 2, 2005, at 16:39, Chris Lattner wrote:
> 4. Replace the old GV with the new GV using code that looks like this:
>
> OldGV->replaceAllUsesWith(ConstantExpr::getCast(NewGV,
> OldGV->getType());
> OldGV->eraseFromParent();
>
> At the end of this, any instructions or other globals that referenced
> the temporary global will now reference the new one.
2012 Jun 20
2
[LLVMdev] [llvm-commits] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
> Attaching a new patch that has the behaviour we discussed.
>
> The "globaldynamic" and default values have been merged, and LLVM will
> start off with the user-specified model, but choose a more specific
> one if possible.
>
> Please review.
Awesome, thanks!
I will try to do a more complete review tonight or tomorrow. For now,
just two quick observations
*) This
2015 Sep 21
2
GlobalOPT and sections
Chris,
Thanks for the clarification... at least no bug report is due... and I am glad that I've asked.
In my case these transformations are rather useful and forcing them to copy original global variable section is making them compatible with our (rather important) use case, so I guess I will have to fix it locally.
Nevertheless if someone else would have a similar issue - I would be
2012 Jun 21
0
[LLVMdev] [llvm-commits] [Patch, RFC] Re: Adding support for explicitly specified TLS models (PR9788)
On Wed, Jun 20, 2012 at 9:29 PM, Rafael Espíndola
<rafael.espindola at gmail.com> wrote:
>> Attaching a new patch that has the behaviour we discussed.
>>
>> The "globaldynamic" and default values have been merged, and LLVM will
>> start off with the user-specified model, but choose a more specific
>> one if possible.
>>
>> Please review.
2015 Jun 04
2
[LLVMdev] Linking modules across contexts crashes
> 1. How to find all constants in Module? Does this code find all of them, or
> they are somewhere else too?
> for (GlobalVariable &GV : globals()) {
> if (auto C = static_cast<Constant*>(GV.Op<0>().get())) {
> ... C is Constant*
> }
> }
Constants are unfortunately part of the Context, not the module :-(
Cheers,
Rafael
2015 Sep 18
2
GlobalOPT and sections
Hello everyone,
This is a rather ancient code with Chris's name all over it, so I naturally feel humbled :)
I see a conceptual issue in lib/Transforms/IPO/GlobalOpt.cpp with several optimizations that create a copy of GlobalVariable without copying attributes from the original one.
Consider this one:
http://llvm.org/doxygen/GlobalOpt_8cpp_source.html
static bool
2008 Dec 05
1
[LLVMdev] replacing a global variable by a constant
Thanks a lot for your help Matthijs! :)
basically this does the job quite nicely I think:
for (llvm::GlobalVariable::use_iterator U = gv->use_begin(); U !=
gv->use_end(); ++U) {
llvm::Instruction *I = llvm::cast<llvm::Instruction>(U);
I->replaceAllUsesWith(constPtr);
I->eraseFromParent();
}
Cheers,
Ralf
Matthijs Kooijman wrote:
> Hi Ralf,
>
>
>> I
2013 Oct 24
2
[LLVMdev] LLVM use chains
Hi,
I have:
...
@.str1 = private unnamed_addr constant [21 x i8] c"Now f is a
function\0A\00", align 1
; Function Attrs: ssp uwtable
define i32 @_Z1fv() #2 {
entry:
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([21
x i8]* @.str1, i32 0, i32 0))
ret i32 0
}
Then I get after trying to erase the function from the module:
511
2011 Oct 05
2
[LLVMdev] replacing a global variable by a constant
hi
i want replacing a global variable by a constant value for erase
instruction. i had seen the code that as follows
for (llvm::GlobalVariable::use_iterator U = gv->use_begin(); U !=
gv->use_end();--U ) {
llvm::Instruction *I = llvm::cast<llvm::Instruction>(U);
I->replaceAllUsesWith(constPtr);
I->eraseFromParent();
}
but i dont know how can declare constptr.
2009 Jan 19
1
[LLVMdev] Load from abs address generated bad code on LLVM 2.4
Andrew Haley <aph at redhat.com> writes:
> Óscar Fuentes wrote:
>> The following message is a courtesy copy of an article
>> that has been posted to gmane.comp.compilers.llvm.devel as well.
>>
>> Andrew Haley <aph at redhat.com> writes:
>>
>>> This is x86_64. I have a problem where an absolute memory load
>>>
>>> define
2012 Apr 21
4
[LLVMdev] Remove function from module
Thanks, but I replaceAllUsesWith() - works well, but I still get bug in eraseFromParent():
While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
An asserting value handle still pointed to this value!
UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
Yours sincerely,
Kadysev Mikhail
21.04.2012, в 23:45, Nick Lewycky написал(а):
> Михаил wrote:
>> How correctly
2012 Apr 21
3
[LLVMdev] Remove function from module
How correctly remove function from module?
For example:
int f1(int x) {
...
a = f2(smth);
...
}
int f2 (int y) {
...
b = f1(smth);
...
}
I need delete from module both f1 and f2. They haven't uses in other part of module, but I can't delete them with eraseFromParent, because they are use each other.
Yours sincerely,
Kadysev Mikhail
-------------- next part
2017 Apr 04
3
RFC: Adding a string table to the bitcode format
On Tue, Apr 4, 2017 at 12:36 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:
>
> On 2017-Apr-04, at 12:12, Peter Collingbourne <peter at pcc.me.uk> wrote:
>
> On Mon, Apr 3, 2017 at 8:13 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>
>>
>> On Apr 3, 2017, at 7:08 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
>>
2012 Apr 21
0
[LLVMdev] Remove function from module
Михаил wrote:
> How correctly remove function from module?
> For example:
>
> int f1(int x) {
> ...
> a = f2(smth);
> ...
> }
> int f2 (int y) {
> ...
> b = f1(smth);
> ...
> }
>
> I need delete from module both f1 and f2. They haven't uses in other
> part of module, but I can't delete them with eraseFromParent, because
> they are use each
2012 Apr 22
2
[LLVMdev] Remove function from module
It is ModulePass with AnalysisUsage of CallGraph
Yours sincerely,
Kadysev Mikhail
22.04.2012, в 5:20, Nick Lewycky написал(а):
> Михаил wrote:
>> Thanks, but I replaceAllUsesWith() - works well, but I still get bug in
>> eraseFromParent():
>>
>> While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
>> An asserting value handle still pointed to this value!
>>
2013 Oct 24
0
[LLVMdev] LLVM use chains
On 23 October 2013 22:41, Vassil Vassilev <vvasilev at cern.ch> wrote:
> Hi,
> I have:
> ...
> @.str1 = private unnamed_addr constant [21 x i8] c"Now f is a
> function\0A\00", align 1
> ; Function Attrs: ssp uwtable
> define i32 @_Z1fv() #2 {
> entry:
> %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([21 x
> i8]* @.str1, i32 0,
2012 Apr 22
0
[LLVMdev] Remove function from module
Михаил wrote:
> Thanks, but I replaceAllUsesWith() - works well, but I still get bug in
> eraseFromParent():
>
> While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi
> An asserting value handle still pointed to this value!
> UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!
The replaceAllUsesWith + eraseFromParent pattern remains correct, but
there's
2008 Dec 05
2
[LLVMdev] replacing a global variable by a constant
Hi,
I am trying to replace a global variable with a constant.
I did manage to do it, but somehow it appears to be fairly bruteforce by
just iterating over all functions/bblocks/instructions and filtering for
those that load the variable and replacing the instruction with
Instruction::replaceAllUsesWith().
The more intuitive way of iterating over the uses of the variable did
not work out as I
2008 Dec 05
0
[LLVMdev] replacing a global variable by a constant
Hi Ralf,
> I am trying to replace a global variable with a constant.
You should be able to replace the initializer for the global with your
constant, mark it as having internal linkage and then run some optimization
pass over it to do the rest (not sure which one it was again, probably some
constant propagation or global value optimization).
That pass would then probably do some similar