Lex: When the real fun begins …

I was happily debugging the test phase of building LLVM in Gentoo hardened SElinux.
Makefile, Perl, Phyton, Bash … I can mostly read through code with occasional help by google.

But Lex (*.ll) files looked like Greek to me, here’s the simplest example I could find:
test/ExecutionEngine/hello.ll

; RUN: lli %s > /dev/null

@.LC0 = internal global [12 x i8] c"Hello World0"		;  [#uses=1]

declare i32 @puts(i8*)

define i32 @main() {
	%reg210 = call i32 @puts( i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) )		;  [#uses=0]
	ret i32 0
}

Ok, it’s a cool thing, a lexical analyzer for source code using regex, but … wtf !

Update:
Looking at the rest of the files, this is the Lex file to “Hello World” in C, C++, ObjC or ObjC++.
I gave up caring after that because I could patch what I was looking for.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: