On Nov 22, 2011, at 6:54 AM, Simon Marlow wrote:

> On 12/10/2011 11:26, Simon Marlow wrote:
>> On 11/10/2011 18:45, David Peixotto wrote:
>>> Ok, I have attached a set of patches to support building the GHC
>>> runtime with llvm-gcc. The patches are based off of commit
>>> 29a97fded4010bd01aa0a17945c84258e285d421 which was last Friday's HEAD.
>>> These patches are also available from my github repository on the
>>> llvm-gcc branch at
>>> 
>>> git://github.com/dmpots/ghc.git
>>> 
>>> There are three patches:
>>> 
>>> 0001- Uses pthread_getspecific and pthread_setspecfic to
>>> access gct when the `llvm_CC_FLAVOR` CPP macro is
>>> set
>>> 
>>> 0002- Modifies the configure scripts to set the
>>> `llvm_CC_FLAVOR` macro when compiling with an llvm
>>> based compile (either llvm-gcc or clang)
>>> 
>>> 0003- Passes the gct variable as a parameter in the GC. This
>>> change is parameterized with CPP macros so that it
>>> is only in effect when compiling for an llvm-based
>>> compiler.
>>> 
>>> The patches 0001 and 0002 provide the minimal support needed to build
>>> GHC with llvm-gcc. The 0003 patch is there to limit the performance
>>> hit we get by going through pthread functions to access the gct. I
>>> think the 0001 and 0002 patches should not be very controversial, but
>>> the 0003 patch is a more invasive change and perhaps Simon Marlow will
>>> want to clean it up before it is applied.
>> 
>> Thanks, I'll take a look at these soon.
> 
> I committed the first two patches today, except that I skipped the changes to 
> StgCRun.c.  They conflicted with some other changes in that area, and I 
> wasn't really sure what you were trying to do.  Please take a look and tell 
> me if I've borked something.

Thanks for getting these in! Sorry for the delayed response, but I just now got 
a chance to try it out. Seems that the changes skipped in StgCRun.c were 
actually important. Without these changes I get a compiler error:

includes/stg/Regs.h:319:2: error: #error BaseReg must be in a register for 
THREADED_RTS

The changes to StgCRun.c are needed to hide the STG register definitions (which 
use GCC-specific exertions) when compiling with an LLVM-based compiler. As you 
mentioned in a thread a while back, the definitions are not actually needed in 
this file (except for the SPARC architecture) since the STG registers are 
accessed directly in the hand-written assembly code.

To hide the register declarations, the import order of the Rts.h and Stg.h 
headers has to be switched. I've attached a new patch against head that does 
this, except when compiling for SPARC.

-David

Attachment: 0001-Hide-STG-register-declarations-for-LLVM-C-compilers.patch
Description: Binary data

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to