git repository of the tutorial

Hi,

I'm learning the tutorial.

http://llvm.org/docs/tutorial/

I'm wondering if there is already a git repository of the examples in
the tutorial so that I don't have to copy the code from the webpage.
Thanks!

Peng,

If you have LLVM source tree, please seek "example".

http://llvm.org/viewvc/llvm-project/llvm/branches/release_32/examples/Kaleidoscope/

You may also fetch llvm.git from http://llvm.org/git/llvm.git (master,
release_xx)

...Takumi

Hello Peng Yu and List,

I have put toy.cpp into github but it has a form of LLVM project
makefile infrastructure. So you can build it together with LLVM
Project source tree.

git://github.com/Journeyer/klang.git

There exist many branches and each branch is for each chapter of Kaleidoscope.

Regards
Journeyer

Also, klang is organized similar to how clang is organized, so it will
help you get familiar with clang too.

-- Sean Silva

Hi Journeyer,

Thanks! I'm following instructions in the README. But I get the
following error when run make -j8 in llvm_obj_dir$. Do you know what
is wrong?

llvm[4]: Compiling ASTNodes.cpp for Debug+Asserts build
In file included from
/Users/py/dvcs_src/llvm/projects/klang/lib/AST/ASTNodes.cpp:15:
/Users/py/dvcs_src/llvm_obj_dir/projects/klang/../../../llvm/projects/klang/include/klang/Driver/Driver.h:23:10:
fatal error:
      'llvm/Support/IRBuilder.h' file not found
#include "llvm/Support/IRBuilder.h"
         ^
1 error generated.

Klang is tested with LLVM 3.1
Header file location is often changed. I guess that's why..

What version of LLVM do you use?

I use the lastest one from github.

~/dvcs_src/llvm/.git$ cat config
...
[remote "origin"]
  url = https://github.com/llvm-mirror/llvm.git
  fetch = +refs/heads/*:refs/remotes/origin/*

I think that klang should be based on the latest SVN/git version of LLVM.

-- Sean Silva

I think that klang should be based on the latest SVN/git version of LLVM.

OK. I am testing it with LLVM 3.2 wait a minute.
-- Journeyer

Hello,

I just applied changes of LLVM 3.2 and it is tested with LLVM 3.2
downloaded from the LLVM Download Page.

I just worked for master branch only.
The rest of the other branches need to be changed about this also.
This will be done as soon as possible.
(Before I fix this, If you look at the commits for this issue for
master branch, you can easily fix it and test for others also.)

Sorry for the late update.
Thank you for the concern.

Best regards
Journeyer

All branches are now tested with LLVM 3.2 on LLVM Download page.

Thank you for the report.
Journeyer

Hello,

I just applied changes of LLVM 3.2 and it is tested with LLVM 3.2
downloaded from the LLVM Download Page.

I just worked for master branch only.
The rest of the other branches need to be changed about this also.
This will be done as soon as possible.
(Before I fix this, If you look at the commits for this issue for
master branch, you can easily fix it and test for others also.)

I have pulled llvm from github.

The last commit is this.
commit 5284f976327d789b9e52089ff684fb36f6d964dd
Author: Craig Topper <craig.topper@gmail.com>

    Merge AVX/SSE instruction definitions for SQRTPS/PD, RSQRTPS,
RCPPS. No funcitonal change intended.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171337
91177308-0d34-0410-b5e6-96231b3b80d8

But when I compile it. I still get the following link error. I don't
understand why the architecture is not correct. My machine is Mac OS X
10.8.2.

~/dvcs_src/llvm_obj_dir$ ../llvm/configure ; make -j8

....

llvm[4]: Linking Debug+Asserts executable klang
ld: warning: ld: warning: ignoring file
/Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86AsmParser.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86AsmParser.aignoring
file /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Disassembler.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Disassembler.a

ld: warning: ignoring file
/Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Desc.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Desc.a
ld: warning: ignoring file
/Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMMCParser.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMMCParser.ald:
warning:
ignoring file /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Info.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Info.a
ld: warning: ignoring file
/Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86AsmPrinter.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86AsmPrinter.a
ld: warning: ignoring file
/Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Utils.a,
file was built for archive which is not the architecture being linked
(i386): /Users/py/dvcs_src/llvm_obj_dir/Debug+Asserts/lib/libLLVMX86Utils.a

Hello Peng Yu,

I found the same error on my Macbook Air.
This was my first trying on MacOS X.

Troubleshooting this might take sometime.

Only thing I can say now that klang is tested successfully on Ubuntu with
- LLVM 3.2 official release on LLVM download page
- LLVM svn latest update

Clang compile produces an error message on MacOS X with the LLVM svn
latest update

I am trying to find the problem. And might need a help.

Best regards
Happy New Year!

Journeyer

Hello Peng Yu,

I found that most branches of klang doesn't get compiled on Mac OS X.

But I have almost no experience of using Mac.

I think supporting Mac will take long time.

When klang gets testing infrastructure or testing script, I think
supporting Mac will be achieved.

Until that time, Klang only supports Ubuntu.
I am sorry that I didn't let you know about this earlier.

Sincerely
Journeyer