Displaying 20 results from an estimated 200 matches similar to: "[LLVMdev] How to get the Instruction where one function use the global variable."
2012 Nov 17
1
[LLVMdev] constant expression as initial value to global
How can I go about evaluating constant expressions and providing them as
the initial value to globals? I allow my globals to be initialized by
an expression. In C syntax this looks like:
int const global_val = const_expr( 1, 2, 3 );
I use the "const_expr" to indicate construction-time constant folding
will not be possible. The IR optimizers however will likely reduce this
to a single
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
Hi Everyone,
I'm quite new to LLVM and I want to update value of global variable in LLVM
IR. I created new global variable in ModulePass:
bool runOnModule(llvm::Module &M) {
IRBuilder<> Builder(M.getContext());
Instruction *I = &*inst_begin(M.getFunction("main"));
Builder.SetInsertPoint(I);
M.getOrInsertGlobal("globalKey",
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
I don't think it's the same problem as you described. By printing I meant
calling printf function and passing my global variable as one of the
arguments.
My code:
Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key =
2012 Nov 09
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Dmitry,
> I'm attaching a patch that should fix the issue mentioned above. It
> simply makes the same check seen in the same file for global
> variables:
>
> emitPTXAddressSpace(PTy->getAddressSpace(), O);
> if (GVar->getAlignment() == 0)
> O << " .align " << (int) TD->getPrefTypeAlignment(ETy);
> else
> O
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Duncan,
You're right, global variables use preferred alignment. And - yes,
preferred alignment in this case is bigger: 8 instead of 4. NVIDIA's
prop. compiler gives 4. However, since CUDA 5.0 ptx modules are
linkable with each other, I think alignments for externally visible
functions and data should all follow ABI rules.
Is there a guide on making tests? I have ~5 pending patches
2013 Mar 05
4
[LLVMdev] Convert C variable to LLVM IR Variable
Hi everyone,
I am doing some work with LLVM IR, I need to use LLVM IR to do operation
on C variables.
Code emission is done by LLVM JIT.
That variable is C thread local , for example
__thread int* gvar;
I think some methods to convert that variable to LLVM IR,
(1) use external function
I know LLVM IR is able to call an external function, so I can write codes
that look like:
int* load()
2012 Nov 09
3
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Dmitry,
> You're right, global variables use preferred alignment. And - yes,
> preferred alignment in this case is bigger: 8 instead of 4. NVIDIA's
> prop. compiler gives 4. However, since CUDA 5.0 ptx modules are
> linkable with each other, I think alignments for externally visible
> functions and data should all follow ABI rules.
giving it an alignment of 8 does
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Test cases exist under test/CodeGen/NVPTX (name changed in May). Now that
I'm back at NVIDIA, I'm going to be running through the bugzilla issues
(thanks Dmitry for the reports!). I have practically the exact same patch
here in my queue. :)
In this case, I would prefer ABI alignment for compatibility with the
vendor compiler. It should work either way, but I do need to audit the
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Dear all,
I'm attaching a patch that should fix the issue mentioned above. It
simply makes the same check seen in the same file for global
variables:
emitPTXAddressSpace(PTy->getAddressSpace(), O);
if (GVar->getAlignment() == 0)
O << " .align " << (int) TD->getPrefTypeAlignment(ETy);
else
O << " .align " <<
2010 May 12
2
Reading R code help--Beginner
Hi, I am brand new to R and not familiar with the language, though I
have been reading the manuals and making some slow going progress. I am
working with some source code from a Global Vector Auto -Regressive
program written by Ranier Puhr from the R-forge group. I need help
interpreting the processes of the following code.
I am going to
post in parts since it's pretty long:
GVAR
2012 Oct 02
0
[LLVMdev] [RFC] OpenMP Representation in LLVM IR
Not to distract, but the word, `procedurization' is not an English word.
It's just leaping out at me when it is either procedure(s) (noun) or
proceduralize (verb). Even processes would make sense. I couldn't help
myself because the word was distracting.
- Marc
P.S. Not that my vote counts, but I'm more in the camp of Hal whose
approach to tackling the parallelization
2012 Sep 28
11
[LLVMdev] [RFC] OpenMP Representation in LLVM IR
Hi All,
We'd like to make a proposal for OpenMP representation in LLVM IR.
Our goal is to reach an agreement in the community on a simple,
complete and extensible representation of OpenMP language constructs
in LLVM IR. Hopefully, this would serve as a common ground and would
enable further development of OpenMP support both in Clang and LLVM
compiler toolchain.
We seek feedback on the
2011 Jan 12
4
[LLVMdev] How to define a global variable?
Hi,
I'm trying to define a mutable variable, outside functions. The code
below is trying to evaluate an expression much like "x = 1" at the
module level in Python. It appears that when it tries to JIT the
function there is an error because there is no storage allocated for
'x'. How do I do that?
thanks,
Rob
----- dumped IR -----
; ModuleID = 'repl-module'
%0 =
2012 Jul 11
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hello,
FYI, this is a bug http://llvm.org/bugs/show_bug.cgi?id=13324
When compiling the following code for sm_20, func params are by some reason
given with .align 0, which is invalid. Problem does not occur if compiled
for sm_10.
> cat test.ll
; ModuleID = '__kernelgen_main_module'
target datalayout = "e-p:64:64-i64:64:64-f64:64:64-n1:8:16:32:64"
target triple =
2012 Jan 17
0
[LLVMdev] ValueMapper question: no type mapping for GlobalValue?
So it looks like the verifier doesn't catch this condition - I think it
should. The attached program reproduces the problem - verification succeeds,
but the linker fails with a type assertion.
BTW, if no one has the bandwidth to work on this I'm willing to attempt a fix,
assuming that you agree that the verifier should discover this condition.
Michael Muller wrote:
>
>
2005 Aug 14
1
Panel data handling (lags, growth rates)
I have written two functions which do useful things with panel data
a.k.a. longitudinal data, where one unit of observation (a firm or a
person or an animal) is observed on a uniform time grid:
- The first function makes lagged values of variables of your choice.
- The second function makes growth rates w.r.t. q observations ago,
for variables of your choice.
These strike me as
2012 Oct 03
0
[LLVMdev] [RFC] OpenMP Representation in LLVM IR
Andrey,
While I think that it will be relatively easy to have the intrinsics
serve as code-motion barriers for other code that might be threads
sensitive (like other external function calls), we would need to think
through exactly how this would work. The easiest thing would be to make
the intrinsics have having unmodeled side effects, although we might
want to do something more intelligent.
2012 Jan 13
2
[LLVMdev] ValueMapper question: no type mapping for GlobalValue?
=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?= wrote:
> > I can reproduce this consistently, but only under an extremely large pile of
> > code :-) I haven't tried to strip it down to minimal a test case yet, but I
> > will. One salient difference with the code you've provided is that in my
> > code, @a is a struct type. However, changing the example to use a
2013 Feb 27
3
[LLVMdev] llvm get annotations
Hello everyone !
I followed
http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanagerin
order to get annotations from my target bytecode. All the examples
that
I give in the following is related to the code from that link. I have
`__attribute__((annotate("DS"))) int f=0;` into the target C++ program and
the related IR code:
@.str = private unnamed_addr
2013 Mar 05
0
[LLVMdev] Convert C variable to LLVM IR Variable
> Method 2
>
> use LLVM InlineAsm to load that gvar
> so It may look like
> %x = call InlineAsm(... );
>
> but I am not really sure how to write LLVM InlineAsm.
Are you looking for this?
http://llvm.org/docs/LangRef.html#inline-assembler-expressions
HTH,
chenwj
--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan