New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang doesn't support pinning variables to registers with __asm__("eax") #4305
Comments
assigned to @echristo |
previously, clang just ignored the register name, which could lead to miscompilations, telling the user that we don't support it yet is better. One work-around for this is to just remove the asm register declaration from the source, its use is dubious anyway. |
There is precedent here; llvm-gcc currently ignores the register name. |
Llvmgcc honors it in inline asm stmts that the value is live across, which is technically all that is required for local vars. |
FYI, I've opened bug #1357 on redmine.ruby-lang.org about this with a patch removing the assignment-to-specific-registers code (see http://redmine.ruby-lang.org/issues/show/1357). |
This also seems to prevent the FreeBSD kernel from being built. Fails somewhere when building ACPI code if I remember correctly. |
*** Bug llvm/llvm-bugzilla-archive#6665 has been marked as a duplicate of this bug. *** |
tcmalloc (google-perftools) also needs this. |
Chromium apparently also needs this. |
I'll take a look. |
This is now the last thing that keeps us from building all of chromium (binary and all tests) on linux. |
*** Bug llvm/llvm-bugzilla-archive#8874 has been marked as a duplicate of this bug. *** |
I intend to do a partial fix for this as described in llvm/llvm-bugzilla-archive#8874 . Just remember that a variable was declared with asm("reg") and use that register if the variable is an argument to a asm statement. We should probably also reject or at least warn about things like register uint64_t foo asm("rbx"); asm("..." : "=a" (foo)); |
I think the most important part has been fixed in 122643. We are intentionally more restrictive than gcc, if too restrictive for a particular use, please open a new bug report. The generated code also has more moves than the one produced by gcc, but that is an llvm problem, not clang's. |
mentioned in issue llvm/llvm-bugzilla-archive#5511 |
mentioned in issue llvm/llvm-bugzilla-archive#6665 |
mentioned in issue #1234 |
mentioned in issue llvm/llvm-bugzilla-archive#8874 |
Extended Description
At around r68030, ruby was compiling mostly fine (see other ticket on tests failing), now it does not anymore (I'm now using r68372 on OSX).
ruby -Ks ../tool/insns2vm.rb --srcdir=".." vmtc.inc
ruby -Ks ../tool/insns2vm.rb --srcdir=".." vm.inc
clang -O -pipe -m64 -g -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-field-initializers -Wshorten-64-to-32 -Wpointer-arith -Wwrite-strings -I. -I.ext/include/i386-darwin9.6.0 -I../include -I.. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o vm.o -c ../vm.c
clang: warning: argument unused during compilation: '-Wno-parentheses'
...
<lots of "uninteresting" warnings skipped>
In file included from ../vm.c:23:
../vm_exec.c:58:5: error: cannot compile this asm yet
DECL_SC_REG(VALUE *, pc, "14");
^
:183:1: note: instantiated from:
reg_pc
^
../vm_exec.c:59:5: error: cannot compile this asm yet
DECL_SC_REG(rb_control_frame_t *, cfp, "15");
^
:184:1: note: instantiated from:
reg_cfp
^
The text was updated successfully, but these errors were encountered: