search for: setconst

Displaying 13 results from an estimated 13 matches for "setconst".

Did you mean: getconst
2010 Jun 16
0
[LLVMdev] Optimization - Converting Globals to Constants
...ive the variables an initial value and make sure that the Global Variable Optimizer can recognize that these variables can indeed be optimized into constants? You'll essentially have to do it yourself, I think, but it's not hard: just call GlobalVariable::setInitializer and GlobalVariable::setConstant on the globals in question once the bitcode is loaded, then run instcombine to propagate the constants. I don't think globalopt has enough information in your situation to do the optimization in question. -Eli
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...nt(I); M.getOrInsertGlobal("globalKey", Builder.getInt64Ty()); GlobalVariable* gVar = M.getNamedGlobal("globalKey"); gVar->setLinkage(GlobalValue::InternalLinkage); gVar->setAlignment(Align(8)); gVar->setInitializer(Builder.getInt64(0)); gVar->setConstant(false); for (Function &F : M.functions()) { InstructionVisitor visitor(DL, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F)); for (Instruction &I : instructions(F)) { visitor.visit(I); } } return true;} Later in InstructionVisi...
2010 Jun 16
2
[LLVMdev] Optimization - Converting Globals to Constants
I'm working on the implementation of a high-performance financial trading simulation system. The simulations are CPU bound so faster is always better. I'm trying to determine the optimal architecture. So far, I'm very pleased with LLVM. I've been able to get our Basic-flavor scripting language for defining the simulation rules to perform at the equivalent of code that was written
2004 Oct 12
1
[LLVMdev] Re: Hide visible string in variable (Chris Lattner)
...give me a very simple example to show me how to do it. > 3. Change the initializer of the global variable to the new constant with > setInitializer(). > 4. Clear the "constant" flag on the string, because the program will be > dynamically hacking on the string: GV->setConstant(false); > 5. Insert the for loop that translates the string when main runs. > > For #5, write the for loop you want, compile it with llvmgcc, then figure > out how to generate it at compile time. Alternatively, you could put the > 'decryption' routine in a library and ju...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...t;, Builder.getInt64Ty()); > > GlobalVariable* gVar = M.getNamedGlobal("globalKey"); > > gVar->setLinkage(GlobalValue::InternalLinkage); > > gVar->setAlignment(Align(8)); > > gVar->setInitializer(Builder.getInt64(0)); > > gVar->setConstant(false); > > > > for (Function &F : M.functions()) { > > InstructionVisitor visitor(DL, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F)); > > for (Instruction &I : instructions(F)) { > > visitor.visit(I); > >...
2011 Mar 06
2
[LLVMdev] how to zero-init a global
Hi! I have a module containing a constant e.g. @input = global %0 zeroinitializer, align 16 when I copy the global into another module I use newGlobal->copyAttributesFrom(global); but the new module now has @input = external global %0, align 16 i.e. the zeroinitializer is missing. how do I set it or copy it from the other global? -Jochen
2011 Mar 06
0
[LLVMdev] how to zero-init a global
...t;setInitializer(global->getInitializer()); Note that, as I mentioned in response to your earlier question, not all constants are safe to use in a different module. So simply copying the initializer may be unsafe... Note that linkage and constness don't seem to count either. newGlobal->setConstant(global->isConstant()); newGlobal->setLinkage(global->getLinkage()); All three of these can also be passed to the constructor for newGlobal, by the way. According to the comment on GlobalValue::copyAttributesFrom() (as well as its GlobalVariable override) this seems to be the defining...
2011 May 27
0
[LLVMdev] Precompiled templates
Hi Andreas, > I'm currently investigating the use of LLVM for a project. For example, > if I have a function like > > int a(int x, int y) { > if (P == 0) { > return x - y; > } else { > return y - x; > } > } > > and P could be considered constant, one of the code paths could be > optimized out. Now I want to load a compiled bitcode
2011 May 25
2
[LLVMdev] Precompiled templates
Hello list, I'm currently investigating the use of LLVM for a project. For example, if I have a function like int a(int x, int y) { if (P == 0) { return x - y; } else { return y - x; } } and P could be considered constant, one of the code paths could be optimized out. Now I want to load a compiled bitcode file into a CFG, replace all occurrences of P with the value (either 0
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
2017 Nov 23
1
JIT and atexit crash
Hi, Not sure whether this matches your use case, but the Orc-based JIT used in LLI appears to be using `llvm::orc::LocalCXXRuntimeOverrides` (http://llvm.org/doxygen/classllvm_1_1orc_1_1LocalCXXRuntimeOverrides.html) to override `__cxa_atexit`: https://github.com/llvm-mirror/llvm/blob/release_50/tools/lli/OrcLazyJIT.h#L74
2017 Aug 24
4
Building LLVM's fuzzers
On Thu, Aug 24, 2017 at 3:21 PM, Kostya Serebryany via llvm-dev < llvm-dev at lists.llvm.org> wrote: > > > On Thu, Aug 24, 2017 at 3:20 PM, Justin Bogner <mail at justinbogner.com> > wrote: > >> I think the simplest fix is something like this: >> >> diff --git a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp >>
2004 Apr 27
15
Building wxruby on Solaris 9
Hi all, Ruby 1.8.1 Solaris 9 wxwindows 2.4.2 (package from blastwave.org) wxruby 0.3.0 I''m having trouble getting this sucker to build on my Solaris box. Here''s how I''m building: ruby extconf.rb --with-xrc-dir=/opt/csw --with-xrc-include=/opt/csw/lib/wx The include directive I added because the setup.h file is there (for whatever reason). And yes, /opt/csw/bin and