Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #652 > unrolled thread

A small LLVM tutorial: debugging information

Started byvincent_belliard <vincent@famillebelliard.fr>
First post2012-05-25 10:06 -0700
Last post2012-05-31 00:10 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.compilers


Contents

  A small LLVM tutorial: debugging information vincent_belliard <vincent@famillebelliard.fr> - 2012-05-25 10:06 -0700
    Re: A small LLVM tutorial: debugging information Eric Christopher <echristo@gmail.com> - 2012-05-29 17:59 -0700
      Re: A small LLVM tutorial: debugging information Vincent Belliard <vincent@famillebelliard.fr> - 2012-05-31 00:10 -0700

#652 — A small LLVM tutorial: debugging information

Fromvincent_belliard <vincent@famillebelliard.fr>
Date2012-05-25 10:06 -0700
SubjectA small LLVM tutorial: debugging information
Message-ID<12-05-023@comp.compilers>
Hello,

I updated my LLVM tutorial. I added few things about debugging generation. You can find the whole tutorial at:

http://entity-language.googlecode.com/files/llvm_tutorial.pdf

[toc] | [next] | [standalone]


#658

FromEric Christopher <echristo@gmail.com>
Date2012-05-29 17:59 -0700
Message-ID<12-05-029@comp.compilers>
In reply to#652
On Fri, May 25, 2012 at 10:06 AM, vincent_belliard <vincent@famillebelliard.fr> wrote:
> Hello,
>
> I updated my LLVM tutorial. I added few things about debugging generation. You can find the whole tutorial at:
>
> http://entity-language.googlecode.com/files/llvm_tutorial.pdf

One thing your tutorial doesn't mention is that it's much easier to produce a
frontend if you use the "builder" classes (or bindings to them). IRBuilder and
DIBuilder (LLVM IR and debug info metadata respectively) are much easier
to generate when you use these interfaces.

-eric

[toc] | [prev] | [next] | [standalone]


#662

FromVincent Belliard <vincent@famillebelliard.fr>
Date2012-05-31 00:10 -0700
Message-ID<12-06-001@comp.compilers>
In reply to#658
Yes, of course, using the LLVM builder is much easier (or, at least,
quicker to start). In my case, I needed to do all with my language
Entity so I couldn't use the builders. I did my own which are simpler
than the LLVM ones as they cover only what I needed.

This small tutorial is still useful if you use the builders. May some
topics won't be necessary but it's always good to understand deeply
what you are using.

Nevertheless, in the next version, I will add your comment.

vincent


PS: I made a very small language close to C but close to LLVM. It's very
useful to write small libraries functions with a deep control over the
generated code without writting directly in LLVM.
Here is an example of a string compare with my zero padded strings:

i1 @equals_string_contents(%_self: %string_content*, %_cmp: %string_content*)
{
var size_ref: i64 = %_self->size ;
var size_cmp: i64 = %_cmp->size ;
if (size_ref ne size_cmp) return 0 ;
var count: i64 = size_ref >> 3 ;
var ref: i64* = <i64*>%_self->data ;
var cmp: i64* = <i64*>%_cmp->data ;
loop
	{
	phi phi_count: i64 = count | next_count ;
	phi phi_ref: i64* = ref | next_ref ;
	phi phi_cmp: i64* = cmp | next_cmp ;
	if (phi_count eq 0) return 1 ;
	if (*phi_ref ne *phi_cmp) return 0 ;
	var next_count: i64 = phi_count - 1 ;
	var next_ref: i64* = phi_ref + 1 ;
	var next_cmp: i64* = phi_cmp + 1 ;
	}
}

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web