Port of libcpu to llvm tot

72 views
Skip to first unread message

Garrison Venn

unread,
Oct 8, 2011, 9:53:50 AM10/8/11
to lib...@googlegroups.com
I just ported the libcpu project to llvm tot (3.0) enough so that it builds without warnings, however I'm not sure if the result works (on OS X 10.7.1). Seems like the fibonacci test only works for m88k, the others seem to continually dump the module. Since the project does not seem too active, I don't want to bother going forward in my debugging effort if project is no longer in any use. Is this worth while pursuing?

Thanks in advance

Garrison

Gianluca Guida

unread,
Oct 8, 2011, 3:33:30 PM10/8/11
to lib...@googlegroups.com
Hi Garrison,

On Oct 8, 2011, at 3:53 PM, Garrison Venn wrote:

> I just ported the libcpu project to llvm tot (3.0) enough so that it builds without warnings, however I'm not sure if the result works (on OS X 10.7.1). Seems like the fibonacci test only works for m88k, the others seem to continually dump the module. Since the project does not seem too active, I don't want to bother going forward in my debugging effort if project is no longer in any use. Is this worth while pursuing?

First of all thank you very much for updating libcpu to 3.0 llvm. I had a few patches to keep it in sync somewhere in my trees but I never cleaned/committed them.

As for me, I think it would be very useful to keep libcpu up-to-date. There are many things that definitely need to be improved, yet libcpu is definitely an useful and interesting project. As for me, I am very interested in this project and hopefully I'll be active again in the near future.

Thanks again,
Gianluca

Garrison Venn

unread,
Oct 8, 2011, 3:52:57 PM10/8/11
to lib...@googlegroups.com
Do you want my patch? Where do I send it?

Thanks in advance

Garrison

Pekka Enberg

unread,
Oct 10, 2011, 2:39:52 AM10/10/11
to lib...@googlegroups.com, glg...@me.com
On Sat, Oct 8, 2011 at 10:52 PM, Garrison Venn <garris...@gmail.com> wrote:
> Do you want my patch? Where do I send it?

I can carry it in my tree if you want:

https://github.com/penberg/libcpu

I might even push it to the official svn repository if I find my
password somewhere...

Pekka

Gianluca Guida

unread,
Oct 10, 2011, 4:54:44 AM10/10/11
to lib...@googlegroups.com

On Oct 10, 2011, at 8:39 AM, Pekka Enberg wrote:

> I might even push it to the official svn repository if I find my
> password somewhere...

That's the same problem I have with current svn. I'd say to post the patch to the list, so that we can check it, test it and Pekka can push it to its own git tree.

Thanks again,
Gianluca

Garrison Venn

unread,
Oct 10, 2011, 6:40:01 AM10/10/11
to lib...@googlegroups.com
Ok I've attached the patch. Couple of notes:

1) There was a build warning that I did not see before. I did not check to see if the grammar rule in question was hit (yacc/bison warning).

[BISON][UpccParser] Building parser with bison 2.3
ast/parser.y: conflicts: 81 shift/reduce, 81 reduce/reduce
ast/parser.y:444.27-34: warning: rule never reduced because of conflicts: primary_expr: mem_expr

2) Except for branches/glguida-bbhacks/libcpu/libcpu.h, I only made modifications to, and tested trunk.

3) I'm using test/scripts/m88k_fib.sh as my test case, but I don't really know if it is working as I did not check the fibonacci results although the test states both host and guest have the same result. As I implied before both arm_fib.sh, and mips_fib.sh just seem to continually regenerate and dump the module without generating results. Beyond running cbmbasic.sh to get a prompt, I never entered any basic commands. ./build/libcpu/run_m88k test/bin/m88k/openbsd/date crashes. I did not conduct any other tests.

4) I use this weird combination of vi in emacs (viper mode), and have my indentation set to spaces for tabs. While I was editing, I could not tell what indentation standard was being used for this project so I left my sw set to 8. This will result in a different alignment if 8 spaces for a tab is not the correct indentation setting. What is the indentation being use?

5) This was a very quick syntax port so someone may want to refine it to the proper style/coding conventions :-). Making the git mirror the real repository would be nice. Is this possible?

Garrison

initLlvm3_0Port.patch

Garrison Venn

unread,
Oct 10, 2011, 6:43:39 AM10/10/11
to lib...@googlegroups.com
I forgot to mention that this port was built and tested on OS X 10.7.1 with gcc == gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00). This is in actuality llvm-gcc-4.2. I'm currently working on porting over to using clang.

Garrison

> <initLlvm3_0Port.patch>

Garrison Venn

unread,
Oct 10, 2011, 10:44:22 AM10/10/11
to lib...@googlegroups.com
For whatever it is worth, I'm attaching a patch which allows the project to work with clang (~3 week old TOT). Set environment variables CC, and CXX appropriately to clang/clang++ paths. Same comments apply as before. One extra comment concerns the cmake detection of -isysroot support for clang. At least for cmake 2.8.0, the default cmake macro cmake_gnu_has_isysroot found in Darwin-GNU.cmake, does not seem to correctly test for clang's support of the -isysroot flag, as "clang -v --help" output does not contain the string (unlike gcc). I ignored this issue as it did not seem to affect the build. However I'm not a cmake person so maybe someone can find a better solution to this, and my hack in general. Working with clang did find at least one "real" bug (array out of bounds warning).

Tested with gcc and clang on OS X 10.7.1

clangLlvm3_0Port.patch

Pekka Enberg

unread,
Oct 10, 2011, 12:40:01 PM10/10/11
to lib...@googlegroups.com
On Mon, Oct 10, 2011 at 1:40 PM, Garrison Venn <garris...@gmail.com> wrote:
> Making the git mirror the real repository would be nice. Is this possible?

I'm happy to review and merge patches unless other devs object to that.

Pekka Enberg

unread,
Oct 10, 2011, 12:56:41 PM10/10/11
to lib...@googlegroups.com
On Mon, Oct 10, 2011 at 1:40 PM, Garrison Venn <garris...@gmail.com> wrote:
> Ok I've attached the patch. Couple of notes:

Is this supposed to work with LLVM 2.8 or is 3.0 API incompatible?

Garrison Venn

unread,
Oct 10, 2011, 1:06:40 PM10/10/11
to lib...@googlegroups.com
It is incompatible with 2.8.

Garrison

Michael Steil

unread,
Oct 10, 2011, 1:45:49 PM10/10/11
to Pekka Enberg, lib...@googlegroups.com, glg...@me.com
I am absolutely okay if you move development to github and make it the official repository (and change the link in the Wiki)! :-)

Michael

Pekka Enberg

unread,
Oct 10, 2011, 2:02:59 PM10/10/11
to lib...@googlegroups.com, glg...@me.com, mis...@mac.com
On Mon, Oct 10, 2011 at 8:45 PM, Michael Steil <mis...@mac.com> wrote:
> I am absolutely okay if you move development to github and make it the official repository (and change the link in the Wiki)! :-)

I have created a Github organization for us:

https://github.com/libcpu

I'll convert the Subversion repository to Git but I'd like to map svn
users to git users. Here's what I have so far:

abbeyj = James Abbatiello
dave = David Anderson
gianluca = Gianluca Guida
johnk = ?
masteraxl = ?
me = ?
mist = Michael Steil
orlando = Orlando Bassotto
penberg = Pekka Enberg
stevi = ?
tilmann = Tilmann Scheller

I'll look up email addresses from the mailing list if that's OK with everyone.

Pekka

Garrison Venn

unread,
Oct 10, 2011, 2:06:38 PM10/10/11
to lib...@googlegroups.com, glg...@me.com, mis...@mac.com
Cool

Garrison

Schmidt-Bilkenroth Stefan

unread,
Oct 10, 2011, 2:09:17 PM10/10/11
to lib...@googlegroups.com, lib...@googlegroups.com, glg...@me.com, mis...@mac.com
Even i had not enough time to provide my PPC disassembler to libcpu, just add me to the git users. ssb

Maybe an ARM disassembler might follow later...

ciao

Von meinem iPad gesendet

Pekka Enberg

unread,
Oct 10, 2011, 2:32:10 PM10/10/11
to lib...@googlegroups.com, garris...@gmail.com
On Mon, Oct 10, 2011 at 8:06 PM, Garrison Venn <garris...@gmail.com> wrote:
> It is incompatible with 2.8.

Right. That's somewhat unfortunate as Fedora 15, for example, ships with 2.8.
Is there no sane way to support both? Is aggressive upgrades recommended
by the LLVM developers?

Pekka

Garrison Venn

unread,
Oct 10, 2011, 2:59:34 PM10/10/11
to Pekka Enberg, lib...@googlegroups.com
No it is unfortunate. As you may know LLVM purposely remains backward incompatible so to maximize flexibility for future design evolutions. The libcpu project does not have to update. I'm just doing this I since I always work with TOT, and in this case because I want to explore using libcpu as a tool to understand LLVM's backend infrastructure at TOT.

Personally I have a fair degree of confidence with their approach since they have buildbots running continuously against regression tests. It is not to say that there are not bugs, or that their regression, or buildbot system does not have problems from time to time, but relatively speaking it is pretty stable especially for an open source project. I usually stay between 2 to 3 weeks out, and build from source.

Again though I understand if there is reticence in this regard since libcpu is not tied to LLVM dev branches. Your call. You could create a git branch for 3.0. The LLVM 3.0 (TOT) will be branched and frozen in 2 weeks, with a an official release coming sometime afterwards.

Hope this helps

Garrison

Samuel Crow

unread,
Oct 10, 2011, 3:08:37 PM10/10/11
to lib...@googlegroups.com
Hi folks,

Only the major releases are not backward compatible to some extent.  1.9 was incompatible with 2.0.  2.8 and 2.9 are incompatible with the next release: 3.0.  Version 3.0 branches in only a few weeks so ToT is very close to what the 3.0 release will be.

Just thought I'd add that,

--Sam Crow

Pekka Enberg

unread,
Oct 10, 2011, 3:18:03 PM10/10/11
to lib...@googlegroups.com, garris...@gmail.com
On Mon, Oct 10, 2011 at 9:59 PM, Garrison Venn <garris...@gmail.com> wrote:
> Again though I understand if there is reticence in this regard since libcpu is not tied
> to LLVM dev branches. Your call. You could create a git branch for 3.0. The LLVM
> 3.0 (TOT) will be branched and frozen in 2 weeks, with a an official release coming
> sometime afterwards.

Well, that's the thing, I worry that it'll create extra hassle for
people who want to try
out libcpu. That said, it seems we don't even support LLVM 2.8 so your
patch is an
improvement over the current situation.

I'll get the libcpu tree moved over to github first and then revisit your patch.

Pekka

Garrison Venn

unread,
Oct 10, 2011, 3:35:44 PM10/10/11
to Pekka Enberg, lib...@googlegroups.com
Sounds good to me.

Garrison

Pekka Enberg

unread,
Oct 17, 2011, 2:58:58 AM10/17/11
to lib...@googlegroups.com, garris...@gmail.com
Hi Garrison,

On Mon, Oct 10, 2011 at 10:35 PM, Garrison Venn <garris...@gmail.com> wrote:
> Sounds good to me.

Your patch won't apply on top of latest master because I did some
fixes to make libcpu compile with LLVM 2.8:

https://github.com/libcpu/libcpu

I'm happy to create a new llvm-3.0 branch on github and put your
changes there if you rebase your patch. I'd prefer to keep master
working with 2.8 until Fedora and other Linux distributions start
shipping 3.0.

Pekka

Garrison Venn

unread,
Oct 17, 2011, 5:40:08 AM10/17/11
to Pekka Enberg, lib...@googlegroups.com
Sure Peka, I'll try to work on it this week.

Should not be too bad.

Garrison

Reply all
Reply to author
Forward
0 new messages