LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2522 - global register variables not supported
Summary: global register variables not supported
Status: RESOLVED WORKSFORME
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-gcc (show other bugs)
Version: 2.3
Hardware: PC Windows XP
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 4068
  Show dependency tree
 
Reported: 2008-07-07 05:45 PDT by David Kaye
Modified: 2012-05-04 06:41 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
haskell source and makefile to repeat issue (404 bytes, application/zip)
2008-07-08 02:24 PDT, David Kaye
Details
Preprocessed .c source (194.09 KB, application/octet-stream)
2008-07-08 03:15 PDT, Anton Korobeynikov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kaye 2008-07-07 05:45:50 PDT
While attempting to compile a C file generated by GHC. llvm-gcc chocked with the error message "sorry, unimplemented: LLVM cannot register variable 'R1'." and requested I report a bug.

The GHC version was ghc-6.8.3.

From the root of the GHC installation the path to the header llvm-gcc was parsing is "include/Regs.h" and the error occured at line 220.

David
Comment 1 Anton Korobeynikov 2008-07-07 06:44:05 PDT
Please attach reproducible testcase
Comment 2 Chris Lattner 2008-07-07 15:08:29 PDT
GHC probably depends on the GNU extension to pin global variables to physregs.  This is not fully supported by llvm-gcc at this time.  Please *do* include a testcase though.
Comment 3 David Kaye 2008-07-08 02:24:37 PDT
Created attachment 1808 [details]
haskell source and makefile to repeat issue

llvm-gcc output does say the feature is not implemented. It also requests I submit a bug report which is why I have.

I checked this out a little further today, and GHC does allow me to work around the register issue by defining 'NO_REGS'.
Comment 4 David Kaye 2008-07-08 02:33:02 PDT
Forgot to mention. The makefile requires a variable.

'GHC_HOME=path/to/ghc-6.8.3/installation'
Comment 5 Anton Korobeynikov 2008-07-08 03:15:22 PDT
Created attachment 1809 [details]
Preprocessed .c source

Please next time include .c source, not haskell :)
Comment 6 Chris Lattner 2008-07-09 23:49:15 PDT
This is basically:

register StgUnion R1 __asm__("%" "esi");

where StgUnion is a big and scary thing.  Putting a union in a register is vaguely wierd, but I can see why you'd want to do it. :)
Comment 7 Török Edwin 2011-02-19 08:50:08 PST
This is also an issue if you try to build a 32-bit Linux kernel (ARCH=i386):
/home/edwin/builds/linux-2.6/arch/x86/include/asm/thread_info.h:179:24: error: global register variables are not supported
register unsigned long current_stack_pointer asm("esp") __used;
                       ^
Comment 8 Duncan Sands 2012-05-04 06:41:23 PDT
Edwin's example works for me with dragonegg.  The preprocessed source for the
original example is rejected by recent versions of gcc.