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


Groups > comp.compilers > #662

Re: A small LLVM tutorial: debugging information

From Vincent Belliard <vincent@famillebelliard.fr>
Newsgroups comp.compilers
Subject Re: A small LLVM tutorial: debugging information
Date 2012-05-31 00:10 -0700
Organization Compilers Central
Message-ID <12-06-001@comp.compilers> (permalink)
References <12-05-029@comp.compilers>

Show all headers | View raw


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 ;
	}
}

Back to comp.compilers | Previous | NextPrevious in thread | Find similar


Thread

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

csiph-web