Monday, January 31, 2011

LLVM

Since I went to a workshop held several weeks ago, I got interested in LLVM. LLVM stands for Low Level Virtual Machine which is a compiler infrastructure (a good tool to use when you write your compiler). There are lots of project going on using LLVM, unladen swallow is a famous one of them. Now I'm reading LLVM tutorial and I found it's not only good for understanding LLVM, but it's very helpful to understand compiler itself, i.e. lexer, parser, and code generation, with lots of practical tips. It's not difficult at all if you have a basic knowledge of C++.

The following info are some tips to run the sample program (toy.cpp) on fedora.

1) Installation


yum install llvm
yum install clang
yum install llvm-doc
yum install clang-doc
yum install llvm-devel


2) Add -rdynamic option when you compile chapter 5 example program.

g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy -rdynamic

Accoding to the gcc man page,

Pass the flag -export-dynamic to the ELF linker, on targets that
support it. This instructs the linker to add all symbols, not only
used ones, to the dynamic symbol table. This option is needed for
some uses of "dlopen" or to allow obtaining backtraces from within
a program.


Without this, you'll see an error message when you use "putchard"

LLVM ERROR: Program used external function 'putchard' which could not be resolved!


3) To Make the chapter 5 example program work exactly like the document, comment out the following line.
Adding this will do some more optimization.

OurFPM.add(createCFGSimplificationPass());


4) If you are puzzled by the following part of chapter5's If/Then/Else section,

// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
ThenBB = Builder.GetInsertBlock();

try executing the following code and see what it generates.

extern foo();
extern bar();
extern kou();
extern tam();
def baz(x) if x then if foo() then kou() else tam() else bar();

and be aware that if/then/else/merge always ends its execution at merge(ifcont) block.

Sunday, January 30, 2011

PyCon mini JP

Yesterday we held PyCon mini JP.




















Ice break

















I think it was a big success. We had a wide variety of sessions and attendances seemed to enjoy them a lot. It was the first time for me to participate in holding a conference. I don't think I could work like others who regularly do it but I enjoyed it a lot and had a good experience. It was interesting that the way people who likes holding conferences think are quite different from other developers, they think about communities much more seriously for example.

Sunday, January 23, 2011

One more video

Find .mov and .ogv from a directory and its sub directories, convert them to .avi files and store them to another directory. 1080p available.

Thursday, January 13, 2011

Zamami pre-alpha

This is a software I've been making.
Watch them on full screen mode with 720p to see how the tool works in detail.

Basic usage


Batch execute and built-in debugger


sqlite


Detect missing files in an image sequence


job dispatch


fancy template


I made a twitter client on it for a complecated node-network example but twitter has turned off Basic auth last year and it doesn't work now. I'll upload it when I've made it working.