I noticed that the open projects lists porting glibc to LLVM. I was wondering if anyone was working on this currently. If no one is on it, does anyone have an idea of how nasty this would be to do? I'd like to have LLVM output to a new ISA, it'd be great if all I had to do was proxy system calls like read and write in my architectural simulator. -- Francesco Spadini http://www.crhc.uiuc.edu/~spadini spadini at crhc.uiuc.edu "The universe is full of magical things, patiently waiting for our wits to grow sharper." - Eden Phillpots
On Fri, Mar 07, 2003 at 10:08:23PM -0600, Francesco Spadini wrote:> I noticed that the open projects lists porting glibc to LLVM. I was > wondering if anyone was working on this currently. If no one is on > it, does anyone have an idea of how nasty this would be to do?You'd just have to make glibc compile using llvm-gcc... :) It may need some minor tweaks to be accepted as LLVM-valid code. It may show that there are some bugs in llvm-gcc (if it cannot handle glibc due to an internal error) or it might work, but it may not be necessarily verified to be correct. So in response to your question, the nastiness is waiting to be discovered. To the best of my knowledge, this is not being done right now.> I'd like to have LLVM output to a new ISA, it'd be great if all I had > to do was proxy system calls like read and write in my architectural > simulator.Note that compiling glibc with LLVM does not give you a solution to THIS problem: you'd still have to write a new backend for your ISA. There is currently a Sparc backend and an X86 backend. Depending on how similar your architecture is to one or the other, you might be able to leverage existing code. Take a look at llvm/lib/Target/{Sparc,X86}, though the X86 target codebase is smaller. Also note that having glibc compiled by LLVM isn't a prerequisite for your new ISA, as long as you either emulate the library calls or you have it compiled in some other manner for your target architecture. -- Misha Brukman :: http://uiuc.edu/~brukman
> Note that compiling glibc with LLVM does not give you a solution to THIS > problem: you'd still have to write a new backend for your ISA. There is > currently a Sparc backend and an X86 backend. Depending on how similar > your architecture is to one or the other, you might be able to leverage > existing code. Take a look at llvm/lib/Target/{Sparc,X86}, though the > X86 target codebase is smaller.Yeah, that's the easy part. My ISA is going to have a near 1:1 mapping to LLVM bytecode.> > Also note that having glibc compiled by LLVM isn't a prerequisite for > your new ISA, as long as you either emulate the library calls or you > have it compiled in some other manner for your target architecture. >The nasty thing about this, is that from my experience SPECInt spends a considerable amount of time in standard library calls (esp. the memory and string manipulation functions). I think I'll try playing around with glibc for a bit. At worst I'll end up adding a compatibility mode and hand-code some of the common simple ones (memcpy, memset, etc.). Thanks for your help. -- Francesco Spadini http://www.crhc.uiuc.edu/~spadini spadini at crhc.uiuc.edu "The universe is full of magical things, patiently waiting for our wits to grow sharper." - Eden Phillpots