Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: gcc/gcc/config/i386/i386.c

Side-by-side diff isn't available for this file because of its large size.
Issue 3453012: [gcc] x86_64 TLS support refactoring (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: ready for code review Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | gcc/gcc/config/i386/i386.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/gcc/config/i386/i386.c
diff --git a/gcc/gcc/config/i386/i386.c b/gcc/gcc/config/i386/i386.c
index d0612988f47dae4c6c09908ac73407ebaf1f6278..82802ef35ef979c138903e1682bc2624470aeb9b 100644
--- a/gcc/gcc/config/i386/i386.c
+++ b/gcc/gcc/config/i386/i386.c
@@ -10113,6 +10113,31 @@ get_thread_pointer (int to_reg)
{
rtx tp, reg, insn;
+ if (TARGET_64BIT && TARGET_NACL)
+ {
+ rtx rax = gen_rtx_REG (Pmode, AX_REG);
+
+ insn = emit_call_insn (
+ gen_rtx_SET (
+ VOIDmode,
+ rax,
+ gen_rtx_CALL (
+ VOIDmode,
+ gen_rtx_MEM (
+ QImode,
+ gen_rtx_SYMBOL_REF (Pmode, "__nacl_read_tp")),
+ const0_rtx)));
+ /* For ix86_cmodel == CM_LARGE_PIC we should add use of pic register
+ (see ix86_expand_call). However, NaCl can't use CM_LARGE* models */
+ RTL_CONST_CALL_P (insn) = 1;
+
+ reg = gen_reg_rtx (Pmode);
+ insn = gen_rtx_SET (VOIDmode, reg, rax);
+ insn = emit_insn (insn);
+
+ return reg;
+ }
+
tp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TP);
if (!to_reg)
return tp;
@@ -10137,6 +10162,11 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
switch (model)
{
case TLS_MODEL_GLOBAL_DYNAMIC:
+ /* NaCl64: x may come in Pmode and in ptr_mode (if for_mov is true?).
+ Force Pmode for tls_global_dynamic_64 insn. */
+ if (TARGET_64BIT && TARGET_NACL)
+ x = convert_memory_address (Pmode, x);
+
dest = gen_reg_rtx (Pmode);
tp = TARGET_GNU2_TLS ? get_thread_pointer (1) : 0;
@@ -10166,6 +10196,11 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
break;
case TLS_MODEL_LOCAL_DYNAMIC:
+ /* NaCl64: x may come in Pmode and in ptr_mode (if for_mov is true?).
+ Force Pmode for tls_local_dynamic_base_64 insn. */
+ if (TARGET_64BIT && TARGET_NACL)
+ x = convert_memory_address (Pmode, x);
+
base = gen_reg_rtx (Pmode);
tp = TARGET_GNU2_TLS ? get_thread_pointer (1) : 0;
@@ -10257,15 +10292,6 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
break;
case TLS_MODEL_LOCAL_EXEC:
- if (TARGET_64BIT && TARGET_NACL)
- {
- rtx rax = gen_rtx_REG (Pmode, AX_REG);
- emit_insn (gen_naclcall_tls (rax, x));
- dest = gen_reg_rtx (Pmode);
- emit_move_insn (dest, rax);
- return dest;
- }
-
off = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, x),
(TARGET_64BIT || TARGET_ANY_GNU_TLS)
? UNSPEC_NTPOFF : UNSPEC_TPOFF);
« no previous file with comments | « no previous file | gcc/gcc/config/i386/i386.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698