similar to: [LLVMdev] Variable declarations vs. definitions

Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] Variable declarations vs. definitions"

2010 Jan 09
0
[LLVMdev] Variable declarations vs. definitions
On Jan 9, 2010, at 12:57 PM, Dustin Laurence wrote: > I have yet another question that I believe also stems from deep > ignorance of the linkage types. How do you declare a global variable > without defining it? The equivalent of "extern int G;" is: @G = external global i32 -Chris
2010 Jan 10
2
[LLVMdev] Variable declarations vs. definitions
On 01/09/2010 01:12 PM, Chris Lattner wrote: > The equivalent of "extern int G;" is: > > @G = external global i32 OK, then I want to whine a little bit about how that is more obscurely hinted at than discussed. Whine, whine.... :-) Even knowing the word to search on, the only explicit application of the keyword to data is incidental to an example about structures. I think
2010 Jan 09
0
[LLVMdev] Variable declarations vs. definitions
Hello, Dustin > To be clear: remember I'm using Stone Knives here. :-) In some cases it's better to realize that it's year 2010 now. :) Just write small snippet in C and use llvm-gcc -emit-llvm to emit LLVM IR corresponding to it. You can use e.g. http://llvm.org/demo/ for this. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State
2010 Jan 10
2
[LLVMdev] Variable declarations vs. definitions
On 01/09/2010 01:12 PM, Chris Lattner wrote: > The equivalent of "extern int G;" is: > > @G = external global i32 Hmm. Is it really? This @foo = external global i32 @foo = global i32 5 define i32 @main(i32 %argc, i8 **%argv) { %fooVal = load i32* @foo ret i32 %fooVal } produces a "redefinition of global '@foo'" error. But this extern int x;
2010 Jan 10
0
[LLVMdev] Variable declarations vs. definitions
On Jan 9, 2010, at 5:53 PM, Dustin Laurence wrote: > On 01/09/2010 01:12 PM, Chris Lattner wrote: > >> The equivalent of "extern int G;" is: >> >> @G = external global i32 > > OK, then I want to whine a little bit about how that is more obscurely > hinted at than discussed. Whine, whine.... :-) Patches welcome! -Chris
2010 Jan 09
0
[LLVMdev] Variable declarations vs. definitions
On Sat, Jan 9, 2010 at 12:57 PM, Dustin Laurence <dllaurence at dslextreme.com> wrote: > I have yet another question that I believe also stems from deep > ignorance of the linkage types.  How do you declare a global variable > without defining it?  The IR ref. clearly indicates that you can do > this, but it looks like one of the many "too obvious to mention" things
2010 Jan 09
2
[LLVMdev] Inlining
On 01/09/2010 10:00 AM, Samuel Crow wrote: > > Always inline is the closest to a preprocessor macro you can get in > LLVM Assembly since it doesn't have a preprocessor at all. Mine does. :-) > ...LLVM does > aggressive inlining for functions used only once so those instances > don't require specification as alwaysinline. What I'm trying to do is understand the
2010 Jan 10
0
[LLVMdev] Variable declarations vs. definitions
On Jan 9, 2010, at 9:31 PM, Dustin Laurence wrote: > On 01/09/2010 01:12 PM, Chris Lattner wrote: > >> The equivalent of "extern int G;" is: >> >> @G = external global i32 > > Hmm. Is it really? Yes. > But this > extern int x; > > int x = 5; The equivalent of that is: @x = global i32 5 I made no claim that 'external' in
2010 Jan 08
4
[LLVMdev] Inlining
On 01/08/2010 02:10 PM, John McCall wrote: > 'llc' is an IR-to-assembly compiler; at -O3 it does some pretty neat > machine-code and object-file optimizations, but it does not apply > high-level optimizations like CSE or inlining. 'opt' is the tool > which does IR-to-IR optimization. A vital clue, but I'm still not getting it: --- gemini:~/Projects/Nil/nil(0)$
2010 Jan 09
0
[LLVMdev] Inlining
Hello Dustin, Alwaysinline is not a hint. It forces something inline that wouldn't have otherwise been as long as the linkage type permits it. (You just ran into a situation where linkage did not permit it.) Personally, I don't see the need for a preprocessor in most circumstances. If you need to do type substitution you can use an opaque type. The only reason for conditional
2010 Jan 08
4
[LLVMdev] Inlining
OK, I wanted to understand function inlining in LLVM but had avoided going to the effort of finding out if the inlining was really happening. The advice I got to "use the assembly source, Luke" suggested I go ahead and investigate inlining for a bit of practice, since (so I figured) even a monkey with really weak x86-fu could tell whether a function call was happening or not. If this
2010 Jan 13
5
[LLVMdev] invoke/unwind
I put invoke/unwind aside because I couldn't get them to work, but I'm working on my evaluator now and it would be nice to figure this out so I don't have to unwind the stack manually. This was the reason for my earlier question about global declarations, and as that's cleared up I can easily pass exception data...if I can make unwind return out of some deep recursion. The
2010 Jan 13
1
[LLVMdev] invoke/unwind
On 01/13/2010 02:07 AM, Duncan Sands wrote: > Hi Dustin, the code generators do not support unwind, only the > interpreter does. Ah, the secret is not to even try to frob the gnorts. Manual unwinding, here I come. :-( I was going to say the interpreter doesn't either, but then I recalled it JITs when it can. I don't know how to call into libc from the interpreter to test that.
2010 Jan 07
5
[LLVMdev] First-class aggregate semantics
I think I'm missing something basic about the semantics of returning an aggregate type (in my case, a structure) from a function. Returning a structure containing only compile-time constants is simple enough. But I don't quite get how this works with a struct composed at run-time. If I constructed it on the stack with alloca, would I be letting a stack variable escape to to a context
2010 Jan 09
2
[LLVMdev] Inlining
On 01/08/2010 09:17 PM, Nick Lewycky wrote: > Try using 'internal' linkage instead of 'linkonce'. That did it, thanks. --- gemini:~/Projects/LLVM/Tests/Inline(0)$ cat testInline.optdis.ll ; ModuleID = 'testInline.optbc' define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { ret i32 42 } gemini:~/Projects/LLVM/Tests/Inline(0)$ --- > If you're
2010 Jan 10
1
[LLVMdev] LangRef 'external' patch
Here is a patch for LangRef.html that adds a section for 'external' linkage. It probably needs love from someone with more knowledge, but perhaps the patch will motivate that person to improve it. Dustin -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: LangRef.patch URL:
2010 Jan 15
2
[LLVMdev] [PATCH] - Union types, attempt 2
On 01/15/2010 11:37 AM, Talin wrote: > Yes, that's closer to the frontend semantics: the variants of a > union type don't have any natural ordering, so list semantics could > cause problems. I agree. I probably shouldn't even comment, as I know so little about LLVM. But I've hand-written a couple kLOC of IR now and am starting to get a feel for the
2010 Jan 09
0
[LLVMdev] Inlining
On Jan 8, 2010, at 3:08 PM, Dustin Laurence wrote: > On 01/08/2010 02:10 PM, John McCall wrote: > >> 'llc' is an IR-to-assembly compiler; at -O3 it does some pretty neat >> machine-code and object-file optimizations, but it does not apply >> high-level optimizations like CSE or inlining. 'opt' is the tool >> which does IR-to-IR optimization. >
2010 Jan 07
6
[LLVMdev] First-class aggregate semantics
On 01/07/2010 01:38 PM, David Greene wrote: > The way this works on many targets is that the caller allocates stack > space in its frame for the returned struct and passes a pointer to it > as a first "hidden" argument to the callee. The callee then copies > that data into the space pointed to by the address. <nod> > Long-term, first-class status means that
2010 Jan 13
1
[LLVMdev] LangRef.html invoke/unwind patch
On 01/13/2010 01:52 PM, Duncan Sands wrote: > as I mentioned in another email, unwind is not completely unsupported: > it does work for rethrowing an exception. Good point. Not understanding how languages implement exceptions under the hood, I lose the nuances that should be in a reference document. How's this version? Dustin -------------- next part -------------- An embedded and