fix TLS emitting
authorMatthias Braun <matze@braunis.de>
Mon, 2 Apr 2007 16:47:02 +0000 (16:47 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 2 Apr 2007 16:47:02 +0000 (16:47 +0000)
[r12643]

ir/be/ia32/ia32_emitter.c
ir/be/ia32/ia32_new_nodes.c
ir/be/test/thread.c

index 7888d4c..89a0dd9 100644 (file)
@@ -530,6 +530,14 @@ void ia32_emit_am(ia32_emit_env_t *env, const ir_node *node) {
                if (is_ia32_am_sc_sign(node))
                        be_emit_char(env, '-');
                be_emit_ident(env, id);
+
+               if(get_entity_owner(ent) == get_tls_type()) {
+                       if (get_entity_visibility(ent) == visibility_external_allocated) {
+                               be_emit_cstring(env, "@INDNTPOFF");
+                       } else {
+                               be_emit_cstring(env, "@NTPOFF");
+                       }
+               }
        }
 
        if(offs != 0) {
index 54aee05..dc650b7 100644 (file)
 #include "gen_ia32_regalloc_if.h"
 #include "gen_ia32_machine.h"
 
-/**
- * Returns the ident of an entity
- * @param ent The entity
- * @return The ident of the entity
- */
-ident *ia32_get_ent_ident(ir_entity *ent) {
-       ir_type *owner = get_entity_owner(ent);
-       ident   *id    = get_entity_ld_ident(ent);
-
-       if (owner == get_tls_type()) {
-               if (get_entity_visibility(ent) == visibility_external_allocated)
-                       id = mangle(id, new_id_from_chars("@INDNTPOFF", 10));
-               else
-                       id = mangle(id, new_id_from_chars("@NTPOFF", 7));
-       }
-       return id;
-}
-
-#if 0
-/**
- * Returns the ident of a SymConst.
- * @param symc  The SymConst
- * @return The ident of the SymConst
- */
-static ident *get_sc_ident(ir_node *symc) {
-       switch (get_SymConst_kind(symc)) {
-               case symconst_addr_name:
-                       return get_SymConst_name(symc);
-
-               case symconst_addr_ent:
-                       return ia32_get_ent_ident(get_SymConst_entity(symc));
-
-               default:
-                       assert(0 && "Unsupported SymConst");
-       }
-
-       return NULL;
-}
-#endif
-
 /**
  * returns true if a node has x87 registers
  */
index 27e48f9..f48f60a 100644 (file)
@@ -6,7 +6,7 @@ __thread int tls_i[10];
 __thread int tls_j = 5;
 
 int test(int i) {
-        tls_j = i;
+       tls_j = i;
        return tls_i[i];
 }