Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
a9950b7e
Commit
a9950b7e
authored
Mar 23, 2011
by
Matthias Braun
Browse files
remove get_irg_tls() concept, simply use SymConst and let the backend figure it out
parent
b7a0d752
Changes
25
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irgraph.h
View file @
a9950b7e
...
@@ -227,11 +227,6 @@ FIRM_API ir_node *get_irg_frame(const ir_graph *irg);
...
@@ -227,11 +227,6 @@ FIRM_API ir_node *get_irg_frame(const ir_graph *irg);
/** Sets the node that represents the frame pointer of the given IR graph. */
/** Sets the node that represents the frame pointer of the given IR graph. */
FIRM_API
void
set_irg_frame
(
ir_graph
*
irg
,
ir_node
*
node
);
FIRM_API
void
set_irg_frame
(
ir_graph
*
irg
,
ir_node
*
node
);
/** Returns the node that represents the tls pointer of the given IR graph. */
FIRM_API
ir_node
*
get_irg_tls
(
const
ir_graph
*
irg
);
/** Sets the node that represents the tls pointer of the given IR graph. */
FIRM_API
void
set_irg_tls
(
ir_graph
*
irg
,
ir_node
*
node
);
/** Returns the node that represents the initial memory of the given IR graph. */
/** Returns the node that represents the initial memory of the given IR graph. */
FIRM_API
ir_node
*
get_irg_initial_mem
(
const
ir_graph
*
irg
);
FIRM_API
ir_node
*
get_irg_initial_mem
(
const
ir_graph
*
irg
);
/** Sets the node that represents the initial memory of the given IR graph. */
/** Sets the node that represents the initial memory of the given IR graph. */
...
...
include/libfirm/irnode.h
View file @
a9950b7e
...
@@ -255,12 +255,6 @@ FIRM_API void set_nodes_block (ir_node *node, ir_node *block);
...
@@ -255,12 +255,6 @@ FIRM_API void set_nodes_block (ir_node *node, ir_node *block);
* from Start. If so returns frame type, else Null. */
* from Start. If so returns frame type, else Null. */
FIRM_API
ir_type
*
is_frame_pointer
(
const
ir_node
*
n
);
FIRM_API
ir_type
*
is_frame_pointer
(
const
ir_node
*
n
);
/** Test whether arbitrary node is the thread local storage (tls) pointer.
*
* Test whether arbitrary node is tls pointer, i.e. Proj(pn_Start_P_tls)
* from Start. If so returns tls type, else Null. */
FIRM_API
ir_type
*
is_tls_pointer
(
const
ir_node
*
n
);
/** Return the number of control flow predecessors of a block. */
/** Return the number of control flow predecessors of a block. */
FIRM_API
int
get_Block_n_cfgpreds
(
const
ir_node
*
block
);
FIRM_API
int
get_Block_n_cfgpreds
(
const
ir_node
*
block
);
/** Return the control flow predecessor of a block at a given position. */
/** Return the control flow predecessor of a block at a given position. */
...
...
ir/ana/irmemory.c
View file @
a9950b7e
...
@@ -437,17 +437,14 @@ ir_storage_class_class_t classify_pointer(const ir_node *irn,
...
@@ -437,17 +437,14 @@ ir_storage_class_class_t classify_pointer(const ir_node *irn,
ir_storage_class_class_t
res
=
ir_sc_pointer
;
ir_storage_class_class_t
res
=
ir_sc_pointer
;
if
(
is_Global
(
irn
))
{
if
(
is_Global
(
irn
))
{
ir_entity
*
entity
=
get_Global_entity
(
irn
);
ir_entity
*
entity
=
get_Global_entity
(
irn
);
res
=
ir_sc_globalvar
;
ir_type
*
owner
=
get_entity_owner
(
entity
);
res
=
owner
==
get_tls_type
()
?
ir_sc_tls
:
ir_sc_globalvar
;
if
(
!
(
get_entity_usage
(
entity
)
&
ir_usage_address_taken
))
if
(
!
(
get_entity_usage
(
entity
)
&
ir_usage_address_taken
))
res
|=
ir_sc_modifier_nottaken
;
res
|=
ir_sc_modifier_nottaken
;
}
else
if
(
irn
==
get_irg_frame
(
irg
))
{
}
else
if
(
irn
==
get_irg_frame
(
irg
))
{
res
=
ir_sc_localvar
;
res
=
ir_sc_localvar
;
if
(
ent
!=
NULL
&&
!
(
get_entity_usage
(
ent
)
&
ir_usage_address_taken
))
if
(
ent
!=
NULL
&&
!
(
get_entity_usage
(
ent
)
&
ir_usage_address_taken
))
res
|=
ir_sc_modifier_nottaken
;
res
|=
ir_sc_modifier_nottaken
;
}
else
if
(
irn
==
get_irg_tls
(
irg
))
{
res
=
ir_sc_tls
;
if
(
ent
!=
NULL
&&
!
(
get_entity_usage
(
ent
)
&
ir_usage_address_taken
))
res
|=
ir_sc_modifier_nottaken
;
}
else
if
(
is_Proj
(
irn
)
&&
is_malloc_Result
(
irn
))
{
}
else
if
(
is_Proj
(
irn
)
&&
is_malloc_Result
(
irn
))
{
return
ir_sc_malloced
;
return
ir_sc_malloced
;
}
else
if
(
is_Const
(
irn
))
{
}
else
if
(
is_Const
(
irn
))
{
...
@@ -1189,18 +1186,15 @@ static void print_entity_usage_flags(const ir_type *tp)
...
@@ -1189,18 +1186,15 @@ static void print_entity_usage_flags(const ir_type *tp)
/**
/**
* Post-walker: check for global entity address
* Post-walker: check for global entity address
*/
*/
static
void
check_global_address
(
ir_node
*
irn
,
void
*
env
)
static
void
check_global_address
(
ir_node
*
irn
,
void
*
data
)
{
{
ir_node
*
tls
=
(
ir_node
*
)
env
;
ir_entity
*
ent
;
ir_entity
*
ent
;
unsigned
flags
;
unsigned
flags
;
(
void
)
data
;
if
(
is_Global
(
irn
))
{
if
(
is_Global
(
irn
))
{
/* A global. */
/* A global. */
ent
=
get_Global_entity
(
irn
);
ent
=
get_Global_entity
(
irn
);
}
else
if
(
is_Sel
(
irn
)
&&
get_Sel_ptr
(
irn
)
==
tls
)
{
/* A TLS variable. */
ent
=
get_Sel_entity
(
irn
);
}
else
}
else
return
;
return
;
...
@@ -1231,7 +1225,7 @@ static void analyse_irp_globals_entity_usage(void)
...
@@ -1231,7 +1225,7 @@ static void analyse_irp_globals_entity_usage(void)
ir_graph
*
irg
=
get_irp_irg
(
i
);
ir_graph
*
irg
=
get_irp_irg
(
i
);
assure_irg_outs
(
irg
);
assure_irg_outs
(
irg
);
irg_walk_graph
(
irg
,
NULL
,
check_global_address
,
get_irg_tls
(
irg
)
);
irg_walk_graph
(
irg
,
NULL
,
check_global_address
,
NULL
);
}
}
#ifdef DEBUG_libfirm
#ifdef DEBUG_libfirm
...
...
ir/be/arm/arm_transform.c
View file @
a9950b7e
...
@@ -1434,9 +1434,6 @@ static ir_node *gen_Proj_Start(ir_node *node)
...
@@ -1434,9 +1434,6 @@ static ir_node *gen_Proj_Start(ir_node *node)
case
pn_Start_P_frame_base
:
case
pn_Start_P_frame_base
:
return
be_prolog_get_reg_value
(
abihelper
,
sp_reg
);
return
be_prolog_get_reg_value
(
abihelper
,
sp_reg
);
case
pn_Start_P_tls
:
return
new_r_Bad
(
get_irn_irg
(
node
));
case
pn_Start_max
:
case
pn_Start_max
:
break
;
break
;
}
}
...
...
ir/be/betranshlp.c
View file @
a9950b7e
...
@@ -318,15 +318,6 @@ static void pre_transform_anchor(ir_graph *irg, int anchor)
...
@@ -318,15 +318,6 @@ static void pre_transform_anchor(ir_graph *irg, int anchor)
set_irg_anchor
(
irg
,
anchor
,
transformed
);
set_irg_anchor
(
irg
,
anchor
,
transformed
);
}
}
static
void
kill_unused_anchor
(
int
anchor
)
{
ir_node
*
old_anchor_node
=
get_irn_n
(
env
.
old_anchor
,
anchor
);
ir_node
*
old_bad
=
get_irn_n
(
env
.
old_anchor
,
anchor_bad
);
if
(
old_anchor_node
!=
NULL
&&
get_irn_n_edges
(
old_anchor_node
)
<=
1
)
{
set_irn_n
(
env
.
old_anchor
,
anchor
,
old_bad
);
}
}
/**
/**
* Transforms all nodes. Deletes the old obstack and creates a new one.
* Transforms all nodes. Deletes the old obstack and creates a new one.
*/
*/
...
@@ -366,7 +357,6 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
...
@@ -366,7 +357,6 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
pre_transform_anchor
(
irg
,
anchor_start_block
);
pre_transform_anchor
(
irg
,
anchor_start_block
);
pre_transform_anchor
(
irg
,
anchor_start
);
pre_transform_anchor
(
irg
,
anchor_start
);
pre_transform_anchor
(
irg
,
anchor_frame
);
pre_transform_anchor
(
irg
,
anchor_frame
);
kill_unused_anchor
(
anchor_tls
);
if
(
pre_transform
)
if
(
pre_transform
)
pre_transform
();
pre_transform
();
...
...
ir/be/ia32/ia32_address_mode.c
View file @
a9950b7e
...
@@ -55,7 +55,7 @@ static bitset_t *non_address_mode_nodes;
...
@@ -55,7 +55,7 @@ static bitset_t *non_address_mode_nodes;
*
*
* @return non-zero if the DAG represents an immediate, 0 else
* @return non-zero if the DAG represents an immediate, 0 else
*/
*/
static
int
do_is_immediate
(
const
ir_node
*
node
,
int
*
symconsts
,
int
negate
)
static
bool
do_is_immediate
(
const
ir_node
*
node
,
int
*
symconsts
,
bool
negate
)
{
{
ir_node
*
left
;
ir_node
*
left
;
ir_node
*
right
;
ir_node
*
right
;
...
@@ -69,44 +69,43 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
...
@@ -69,44 +69,43 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
"Optimisation warning tarval of %+F(%+F) is not a long.
\n
"
,
"Optimisation warning tarval of %+F(%+F) is not a long.
\n
"
,
node
,
current_ir_graph
);
node
,
current_ir_graph
);
#endif
#endif
return
0
;
return
false
;
}
}
return
1
;
return
true
;
case
iro_SymConst
:
case
iro_SymConst
:
/* the first SymConst of a DAG can be fold into an immediate */
/* the first SymConst of a DAG can be fold into an immediate */
#ifndef SUPPORT_NEGATIVE_SYMCONSTS
#ifndef SUPPORT_NEGATIVE_SYMCONSTS
/* unfortunately the assembler/linker doesn't support -symconst */
/* unfortunately the assembler/linker doesn't support -symconst */
if
(
negate
)
if
(
negate
)
return
0
;
return
false
;
#endif
#endif
if
(
get_SymConst_kind
(
node
)
!=
symconst_addr_ent
)
if
(
get_SymConst_kind
(
node
)
!=
symconst_addr_ent
)
return
0
;
return
false
;
if
(
++*
symconsts
>
1
)
if
(
++*
symconsts
>
1
)
return
0
;
return
false
;
return
1
;
return
true
;
case
iro_Unknown
:
case
iro_Unknown
:
/* we can use '0' for Unknowns */
/* we can use '0' for Unknowns */
return
1
;
return
true
;
case
iro_Add
:
case
iro_Add
:
case
iro_Sub
:
case
iro_Sub
:
/* Add's and Sub's are typically supported as long as both operands are
/* Add's and Sub's are typically supported as long as both operands are
* immediates */
* immediates */
if
(
ia32_is_non_address_mode_node
(
node
))
if
(
ia32_is_non_address_mode_node
(
node
))
return
0
;
return
false
;
left
=
get_binop_left
(
node
);
left
=
get_binop_left
(
node
);
if
(
!
do_is_immediate
(
left
,
symconsts
,
negate
))
if
(
!
do_is_immediate
(
left
,
symconsts
,
negate
))
return
0
;
return
false
;
right
=
get_binop_right
(
node
);
right
=
get_binop_right
(
node
);
if
(
!
do_is_immediate
(
right
,
symconsts
,
is_Sub
(
node
)
?
!
negate
:
negate
))
if
(
!
do_is_immediate
(
right
,
symconsts
,
is_Sub
(
node
)
?
!
negate
:
negate
))
return
0
;
return
false
;
return
1
;
return
true
;
default:
default:
/* all other nodes are NO immediates */
/* all other nodes are NO immediates */
return
0
;
return
false
;
}
}
}
}
...
@@ -118,7 +117,7 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
...
@@ -118,7 +117,7 @@ static int do_is_immediate(const ir_node *node, int *symconsts, int negate)
* @param node the node
* @param node the node
* @param negate if set, the immediate must be negated
* @param negate if set, the immediate must be negated
*/
*/
static
int
is_immediate
(
ia32_address_t
*
addr
,
const
ir_node
*
node
,
int
negate
)
static
int
is_immediate
(
ia32_address_t
*
addr
,
const
ir_node
*
node
,
bool
negate
)
{
{
int
symconsts
=
(
addr
->
symconst_ent
!=
NULL
);
int
symconsts
=
(
addr
->
symconst_ent
!=
NULL
);
return
do_is_immediate
(
node
,
&
symconsts
,
negate
);
return
do_is_immediate
(
node
,
&
symconsts
,
negate
);
...
@@ -131,7 +130,7 @@ static int is_immediate(ia32_address_t *addr, const ir_node *node, int negate)
...
@@ -131,7 +130,7 @@ static int is_immediate(ia32_address_t *addr, const ir_node *node, int negate)
* @param node the node
* @param node the node
* @param negate if set, the immediate must be negated
* @param negate if set, the immediate must be negated
*/
*/
static
void
eat_immediate
(
ia32_address_t
*
addr
,
ir_node
*
node
,
int
negate
)
static
void
eat_immediate
(
ia32_address_t
*
addr
,
ir_node
*
node
,
bool
negate
)
{
{
ir_tarval
*
tv
;
ir_tarval
*
tv
;
ir_node
*
left
;
ir_node
*
left
;
...
@@ -155,6 +154,8 @@ static void eat_immediate(ia32_address_t *addr, ir_node *node, int negate)
...
@@ -155,6 +154,8 @@ static void eat_immediate(ia32_address_t *addr, ir_node *node, int negate)
panic
(
"Internal error: more than 1 symconst in address calculation"
);
panic
(
"Internal error: more than 1 symconst in address calculation"
);
}
}
addr
->
symconst_ent
=
get_SymConst_entity
(
node
);
addr
->
symconst_ent
=
get_SymConst_entity
(
node
);
if
(
get_entity_owner
(
addr
->
symconst_ent
)
==
get_tls_type
())
addr
->
tls_segment
=
true
;
#ifndef SUPPORT_NEGATIVE_SYMCONSTS
#ifndef SUPPORT_NEGATIVE_SYMCONSTS
assert
(
!
negate
);
assert
(
!
negate
);
#endif
#endif
...
...
ir/be/ia32/ia32_address_mode.h
View file @
a9950b7e
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#ifndef IA32_ADDRESS_MODE_H
#ifndef IA32_ADDRESS_MODE_H
#define IA32_ADDRESS_MODE_H
#define IA32_ADDRESS_MODE_H
#include <stdbool.h>
#include "irtypes.h"
#include "irtypes.h"
#include "../beirg.h"
#include "../beirg.h"
...
@@ -41,9 +42,10 @@ struct ia32_address_t {
...
@@ -41,9 +42,10 @@ struct ia32_address_t {
int
offset
;
/**< An integer offset. */
int
offset
;
/**< An integer offset. */
int
scale
;
/**< An integer scale. {0,1,2,3} */
int
scale
;
/**< An integer scale. {0,1,2,3} */
ir_entity
*
symconst_ent
;
/**< A SynConst entity if any. */
ir_entity
*
symconst_ent
;
/**< A SynConst entity if any. */
int
use_frame
;
/**< Set, if the frame is accessed */
bool
use_frame
;
/**< Set, if the frame is accessed */
bool
tls_segment
;
/**< Set if AM is relative to TLS */
ir_entity
*
frame_entity
;
/**< The accessed frame entity if any. */
ir_entity
*
frame_entity
;
/**< The accessed frame entity if any. */
int
symconst_sign
;
/**< The "sign" of the symconst. */
bool
symconst_sign
;
/**< The "sign" of the symconst. */
};
};
/**
/**
...
...
ir/be/ia32/ia32_common_transform.c
View file @
a9950b7e
...
@@ -781,10 +781,7 @@ ir_node *ia32_gen_CopyB(ir_node *node)
...
@@ -781,10 +781,7 @@ ir_node *ia32_gen_CopyB(ir_node *node)
ir_node
*
ia32_gen_Proj_tls
(
ir_node
*
node
)
ir_node
*
ia32_gen_Proj_tls
(
ir_node
*
node
)
{
{
ir_node
*
block
=
get_new_node
(
get_nodes_block
(
node
));
ir_node
*
block
=
get_new_node
(
get_nodes_block
(
node
));
ir_node
*
res
=
NULL
;
ir_node
*
res
=
new_bd_ia32_LdTls
(
NULL
,
block
);
res
=
new_bd_ia32_LdTls
(
NULL
,
block
,
mode_Iu
);
return
res
;
return
res
;
}
}
...
@@ -931,12 +928,12 @@ int ia32_prevents_AM(ir_node *const block, ir_node *const am_candidate,
...
@@ -931,12 +928,12 @@ int ia32_prevents_AM(ir_node *const block, ir_node *const am_candidate,
ir_node
*
ia32_try_create_Immediate
(
ir_node
*
node
,
char
immediate_constraint_type
)
ir_node
*
ia32_try_create_Immediate
(
ir_node
*
node
,
char
immediate_constraint_type
)
{
{
long
val
=
0
;
long
val
=
0
;
ir_entity
*
symconst_ent
=
NULL
;
ir_entity
*
symconst_ent
=
NULL
;
ir_mode
*
mode
;
ir_mode
*
mode
;
ir_node
*
cnst
=
NULL
;
ir_node
*
cnst
=
NULL
;
ir_node
*
symconst
=
NULL
;
ir_node
*
symconst
=
NULL
;
ir_node
*
new_node
;
ir_node
*
new_node
;
mode
=
get_irn_mode
(
node
);
mode
=
get_irn_mode
(
node
);
if
(
!
mode_is_int
(
mode
)
&&
!
mode_is_reference
(
mode
))
{
if
(
!
mode_is_int
(
mode
)
&&
!
mode_is_reference
(
mode
))
{
...
@@ -946,16 +943,17 @@ ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type
...
@@ -946,16 +943,17 @@ ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type
if
(
is_Const
(
node
))
{
if
(
is_Const
(
node
))
{
cnst
=
node
;
cnst
=
node
;
symconst
=
NULL
;
symconst
=
NULL
;
}
else
if
(
is_Global
(
node
))
{
}
else
if
(
is_SymConst_addr_ent
(
node
)
&&
get_entity_owner
(
get_SymConst_entity
(
node
))
!=
get_tls_type
())
{
cnst
=
NULL
;
cnst
=
NULL
;
symconst
=
node
;
symconst
=
node
;
}
else
if
(
is_Add
(
node
))
{
}
else
if
(
is_Add
(
node
))
{
ir_node
*
left
=
get_Add_left
(
node
);
ir_node
*
left
=
get_Add_left
(
node
);
ir_node
*
right
=
get_Add_right
(
node
);
ir_node
*
right
=
get_Add_right
(
node
);
if
(
is_Const
(
left
)
&&
is_
Global
(
right
))
{
if
(
is_Const
(
left
)
&&
is_
SymConst_addr_ent
(
right
))
{
cnst
=
left
;
cnst
=
left
;
symconst
=
right
;
symconst
=
right
;
}
else
if
(
is_
Global
(
left
)
&&
is_Const
(
right
))
{
}
else
if
(
is_
SymConst_addr_ent
(
left
)
&&
is_Const
(
right
))
{
cnst
=
right
;
cnst
=
right
;
symconst
=
left
;
symconst
=
left
;
}
}
...
...
ir/be/ia32/ia32_emitter.c
View file @
a9950b7e
...
@@ -563,6 +563,9 @@ void ia32_emit_am(const ir_node *node)
...
@@ -563,6 +563,9 @@ void ia32_emit_am(const ir_node *node)
/* just to be sure... */
/* just to be sure... */
assert
(
!
is_ia32_use_frame
(
node
)
||
get_ia32_frame_ent
(
node
)
!=
NULL
);
assert
(
!
is_ia32_use_frame
(
node
)
||
get_ia32_frame_ent
(
node
)
!=
NULL
);
if
(
get_ia32_am_tls_segment
(
node
))
be_emit_cstring
(
"%gs:"
);
/* emit offset */
/* emit offset */
if
(
ent
!=
NULL
)
{
if
(
ent
!=
NULL
)
{
const
ia32_attr_t
*
attr
=
get_ia32_attr_const
(
node
);
const
ia32_attr_t
*
attr
=
get_ia32_attr_const
(
node
);
...
@@ -1606,14 +1609,6 @@ static void emit_ia32_Const(const ir_node *node)
...
@@ -1606,14 +1609,6 @@ static void emit_ia32_Const(const ir_node *node)
ia32_emitf
(
node
,
"
\t
movl %I, %D0
\n
"
);
ia32_emitf
(
node
,
"
\t
movl %I, %D0
\n
"
);
}
}
/**
* Emits code to load the TLS base
*/
static
void
emit_ia32_LdTls
(
const
ir_node
*
node
)
{
ia32_emitf
(
node
,
"
\t
movl %%gs:0, %D0
\n
"
);
}
/* helper function for emit_ia32_Minus64Bit */
/* helper function for emit_ia32_Minus64Bit */
static
void
emit_mov
(
const
ir_node
*
node
,
const
arch_register_t
*
src
,
const
arch_register_t
*
dst
)
static
void
emit_mov
(
const
ir_node
*
node
,
const
arch_register_t
*
src
,
const
arch_register_t
*
dst
)
{
{
...
@@ -1779,7 +1774,6 @@ static void ia32_register_emitters(void)
...
@@ -1779,7 +1774,6 @@ static void ia32_register_emitters(void)
IA32_EMIT
(
IMul
);
IA32_EMIT
(
IMul
);
IA32_EMIT
(
Jcc
);
IA32_EMIT
(
Jcc
);
IA32_EMIT
(
Setcc
);
IA32_EMIT
(
Setcc
);
IA32_EMIT
(
LdTls
);
IA32_EMIT
(
Minus64Bit
);
IA32_EMIT
(
Minus64Bit
);
IA32_EMIT
(
SwitchJmp
);
IA32_EMIT
(
SwitchJmp
);
IA32_EMIT
(
ClimbFrame
);
IA32_EMIT
(
ClimbFrame
);
...
...
ir/be/ia32/ia32_new_nodes.c
View file @
a9950b7e
...
@@ -470,6 +470,18 @@ int is_ia32_am_sc_sign(const ir_node *node)
...
@@ -470,6 +470,18 @@ int is_ia32_am_sc_sign(const ir_node *node)
return
attr
->
data
.
am_sc_sign
;
return
attr
->
data
.
am_sc_sign
;
}
}
void
set_ia32_am_tls_segment
(
ir_node
*
node
,
bool
value
)
{
ia32_attr_t
*
attr
=
get_ia32_attr
(
node
);
attr
->
data
.
am_tls_segment
=
value
;
}
bool
get_ia32_am_tls_segment
(
const
ir_node
*
node
)
{
const
ia32_attr_t
*
attr
=
get_ia32_attr_const
(
node
);
return
attr
->
data
.
am_tls_segment
;
}
/**
/**
* Gets the addr mode const.
* Gets the addr mode const.
*/
*/
...
...
ir/be/ia32/ia32_new_nodes.h
View file @
a9950b7e
...
@@ -155,6 +155,10 @@ void clear_ia32_am_sc_sign(ir_node *node);
...
@@ -155,6 +155,10 @@ void clear_ia32_am_sc_sign(ir_node *node);
*/
*/
int
is_ia32_am_sc_sign
(
const
ir_node
*
node
);
int
is_ia32_am_sc_sign
(
const
ir_node
*
node
);
void
set_ia32_am_tls_segment
(
ir_node
*
node
,
bool
value
);
bool
get_ia32_am_tls_segment
(
const
ir_node
*
node
);
/**
/**
* Gets the addr mode const.
* Gets the addr mode const.
*/
*/
...
...
ir/be/ia32/ia32_nodes_attr.h
View file @
a9950b7e
...
@@ -177,6 +177,7 @@ struct ia32_attr_t {
...
@@ -177,6 +177,7 @@ struct ia32_attr_t {
unsigned
am_sc_sign
:
1
;
/**< The sign bit of the address mode symconst. */
unsigned
am_sc_sign
:
1
;
/**< The sign bit of the address mode symconst. */
unsigned
am_sc_no_pic_adjust
:
1
;
/**< AM symconst can be relative to EIP */
unsigned
am_sc_no_pic_adjust
:
1
;
/**< AM symconst can be relative to EIP */
unsigned
am_tls_segment
:
1
;
/**< addresses are relative to TLS */
unsigned
use_frame
:
1
;
/**< Indicates whether the operation uses the frame pointer or not. */
unsigned
use_frame
:
1
;
/**< Indicates whether the operation uses the frame pointer or not. */
unsigned
has_except_label
:
1
;
/**< Set if this node needs a label because of possible exception. */
unsigned
has_except_label
:
1
;
/**< Set if this node needs a label because of possible exception. */
...
...
ir/be/ia32/ia32_spec.pl
View file @
a9950b7e
...
@@ -1384,6 +1384,8 @@ LdTls => {
...
@@ -1384,6 +1384,8 @@ LdTls => {
irn_flags
=>
[
"
rematerializable
"
],
irn_flags
=>
[
"
rematerializable
"
],
reg_req
=>
{
out
=>
[
"
gp
"
]
},
reg_req
=>
{
out
=>
[
"
gp
"
]
},
units
=>
[
"
GP
"
],
units
=>
[
"
GP
"
],
emit
=>
"
. movl %%gs:0, %D0
",
mode
=>
$mode_gp
,
latency
=>
1
,
latency
=>
1
,
},
},
...
...
ir/be/ia32/ia32_transform.c
View file @
a9950b7e
...
@@ -370,7 +370,14 @@ static ir_node *gen_SymConst(ir_node *node)
...
@@ -370,7 +370,14 @@ static ir_node *gen_SymConst(ir_node *node)
panic
(
"backend only support symconst_addr_ent (at %+F)"
,
node
);
panic
(
"backend only support symconst_addr_ent (at %+F)"
,
node
);
}
}
entity
=
get_SymConst_entity
(
node
);
entity
=
get_SymConst_entity
(
node
);
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
entity
,
0
,
0
,
0
);
if
(
get_entity_owner
(
entity
)
==
get_tls_type
())
{
ir_node
*
tls_base
=
new_bd_ia32_LdTls
(
NULL
,
block
);
ir_node
*
lea
=
new_bd_ia32_Lea
(
dbgi
,
block
,
tls_base
,
noreg_GP
);
set_ia32_am_sc
(
lea
,
entity
);
cnst
=
lea
;
}
else
{
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
entity
,
0
,
0
,
0
);
}
}
}
SET_IA32_ORIG_NODE
(
cnst
,
node
);
SET_IA32_ORIG_NODE
(
cnst
,
node
);
...
@@ -636,6 +643,7 @@ static void build_address(ia32_address_mode_t *am, ir_node *node,
...
@@ -636,6 +643,7 @@ static void build_address(ia32_address_mode_t *am, ir_node *node,
addr
->
index
=
noreg_GP
;
addr
->
index
=
noreg_GP
;
addr
->
mem
=
nomem
;
addr
->
mem
=
nomem
;
addr
->
symconst_ent
=
entity
;
addr
->
symconst_ent
=
entity
;
addr
->
tls_segment
=
false
;
addr
->
use_frame
=
1
;
addr
->
use_frame
=
1
;
am
->
ls_mode
=
get_type_mode
(
get_entity_type
(
entity
));
am
->
ls_mode
=
get_type_mode
(
get_entity_type
(
entity
));
am
->
pinned
=
op_pin_state_floats
;
am
->
pinned
=
op_pin_state_floats
;
...
@@ -664,6 +672,7 @@ static void set_address(ir_node *node, const ia32_address_t *addr)
...
@@ -664,6 +672,7 @@ static void set_address(ir_node *node, const ia32_address_t *addr)
set_ia32_am_scale
(
node
,
addr
->
scale
);
set_ia32_am_scale
(
node
,
addr
->
scale
);
set_ia32_am_sc
(
node
,
addr
->
symconst_ent
);
set_ia32_am_sc
(
node
,
addr
->
symconst_ent
);
set_ia32_am_offs_int
(
node
,
addr
->
offset
);
set_ia32_am_offs_int
(
node
,
addr
->
offset
);
set_ia32_am_tls_segment
(
node
,
addr
->
tls_segment
);
if
(
addr
->
symconst_sign
)
if
(
addr
->
symconst_sign
)
set_ia32_am_sc_sign
(
node
);
set_ia32_am_sc_sign
(
node
);
if
(
addr
->
use_frame
)
if
(
addr
->
use_frame
)
...
@@ -1200,6 +1209,18 @@ static ir_node *create_lea_from_address(dbg_info *dbgi, ir_node *block,
...
@@ -1200,6 +1209,18 @@ static ir_node *create_lea_from_address(dbg_info *dbgi, ir_node *block,
index
=
be_transform_node
(
index
);
index
=
be_transform_node
(
index
);
}
}
/* segment overrides are ineffective for Leas :-( so we have to patch
* around... */
if
(
addr
->
tls_segment
)
{
assert
(
addr
->
symconst_ent
!=
NULL
);
ir_node
*
tls_base
=
new_bd_ia32_LdTls
(
NULL
,
block
);
if
(
base
==
noreg_GP
)
base
=
tls_base
;
else
base
=
new_bd_ia32_Lea
(
dbgi
,
block
,
tls_base
,
base
);
addr
->
tls_segment
=
false
;
}
res
=
new_bd_ia32_Lea
(
dbgi
,
block
,
base
,
index
);
res
=
new_bd_ia32_Lea
(
dbgi
,
block
,
base
,
index
);
set_address
(
res
,
addr
);
set_address
(
res
,
addr
);
...
@@ -4338,6 +4359,7 @@ static ir_node *gen_ia32_l_LLtoFloat(ir_node *node)
...
@@ -4338,6 +4359,7 @@ static ir_node *gen_ia32_l_LLtoFloat(ir_node *node)
am
.
addr
.
offset
=
0
;
am
.
addr
.
offset
=
0
;
am
.
addr
.
scale
=
2
;
am
.
addr
.
scale
=
2
;
am
.
addr
.
symconst_ent
=
ia32_gen_fp_known_const
(
ia32_ULLBIAS
);
am
.
addr
.
symconst_ent
=
ia32_gen_fp_known_const
(
ia32_ULLBIAS
);
am
.
addr
.
tls_segment
=
false
;
am
.
addr
.
use_frame
=
0
;
am
.
addr
.
use_frame
=
0
;
am
.
addr
.
frame_entity
=
NULL
;
am
.
addr
.
frame_entity
=
NULL
;
am
.
addr
.
symconst_sign
=
0
;
am
.
addr
.
symconst_sign
=
0
;
...
@@ -5585,9 +5607,6 @@ static ir_node *gen_Proj(ir_node *node)
...
@@ -5585,9 +5607,6 @@ static ir_node *gen_Proj(ir_node *node)
return
jump
;
return
jump
;
}
}
case
pn_Start_P_tls
:
return
ia32_gen_Proj_tls
(
node
);
}
}
break
;
break
;