Commit ba96d25a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Add and use the helper function is_tls_entity().

parent 7d128813
......@@ -11,7 +11,9 @@
#ifndef FIRM_BE_BEUTIL_H
#define FIRM_BE_BEUTIL_H
#include "entity_t.h"
#include "firm_types.h"
#include "irprog_t.h"
/**
* Convenient block getter.
......@@ -54,4 +56,9 @@ ir_node **be_get_cfgpostorder(ir_graph *irg);
*/
ir_node *get_first_block_succ(const ir_node *block);
static inline bool is_tls_entity(ir_entity *const ent)
{
return get_entity_owner(ent) == get_tls_type();
}
#endif
......@@ -10,6 +10,7 @@
* @author Matthias Braun
*/
#include "beirg.h"
#include "beutil.h"
#include "ia32_address_mode.h"
#include "ia32_transform.h"
......@@ -127,7 +128,7 @@ static void eat_immediate(ia32_address_t *addr, ir_node *node, bool negate)
panic("Internal error: more than 1 symconst in address calculation");
}
addr->symconst_ent = get_SymConst_entity(node);
if (get_entity_owner(addr->symconst_ent) == get_tls_type())
if (is_tls_entity(addr->symconst_ent))
addr->tls_segment = true;
assert(!negate);
break;
......
......@@ -10,6 +10,7 @@
* @author Matthias Braun, Sebastian Buchwald
*/
#include "bearch_ia32_t.h"
#include "beutil.h"
#include "error.h"
#include "ircons.h"
#include "irprintf.h"
......@@ -801,8 +802,7 @@ ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type
if (is_Const(node)) {
cnst = node;
symconst = NULL;
} else if (is_SymConst_addr_ent(node)
&& get_entity_owner(get_SymConst_entity(node)) != get_tls_type()) {
} else if (is_SymConst_addr_ent(node) && !is_tls_entity(get_SymConst_entity(node))) {
cnst = NULL;
symconst = node;
} else if (is_Add(node)) {
......
......@@ -188,7 +188,7 @@ static void ia32_emit_entity(ir_entity *entity, int no_pic_adjust)
{
be_gas_emit_entity(entity);
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
if (!entity_has_definition(entity)) {
be_emit_cstring("@INDNTPOFF");
} else {
......@@ -1842,7 +1842,7 @@ static void bemit_entity(ir_entity *entity, int offset, bool is_relative)
be_emit_cstring("\t.long ");
be_gas_emit_entity(entity);
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
if (!entity_has_definition(entity)) {
be_emit_cstring("@INDNTPOFF");
} else {
......
......@@ -337,7 +337,7 @@ static ir_node *gen_SymConst(ir_node *node)
ir_entity *entity = get_SymConst_entity(node);
ir_node *cnst;
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
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);
......
......@@ -10,6 +10,7 @@
*/
#include <limits.h>
#include "beutil.h"
#include "bitfiddle.h"
#include "xmalloc.h"
#include "tv.h"
......@@ -67,7 +68,7 @@ static void sparc_emit_immediate(int32_t value, ir_entity *entity)
assert(sparc_is_value_imm_encodeable(value));
be_emit_irprintf("%d", value);
} else {
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
be_emit_cstring("%tle_lox10(");
} else {
be_emit_cstring("%lo(");
......@@ -89,7 +90,7 @@ static void sparc_emit_high_immediate(ir_node const *node)
uint32_t value = (uint32_t) attr->immediate_value;
be_emit_irprintf("%%hi(0x%X)", value);
} else {
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
be_emit_cstring("%tle_hix22(");
} else {
be_emit_cstring("%hi(");
......
......@@ -755,7 +755,7 @@ static ir_node *make_tls_offset(dbg_info *dbgi, ir_node *block,
static ir_node *make_address(dbg_info *dbgi, ir_node *block, ir_entity *entity,
int32_t offset)
{
if (get_entity_owner(entity) == get_tls_type()) {
if (is_tls_entity(entity)) {
ir_graph *irg = get_irn_irg(block);
ir_node *g7 = get_g7(irg);
ir_node *offsetn = make_tls_offset(dbgi, block, entity, offset);
......@@ -804,7 +804,7 @@ static void match_address(ir_node *ptr, address_t *address, bool use_ptr2)
ir_node *block = get_nodes_block(ptr);
ir_node *new_block = be_transform_node(block);
if (get_entity_owner(sc_entity) == get_tls_type()) {
if (is_tls_entity(sc_entity)) {
if (!use_ptr2) {
goto only_offset;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment