x86_imm.h 1.38 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * This file is part of libFirm.
 * Copyright (C) 2015 University of Karlsruhe.
 */

/**
 * @file
 * @brief  Data structures for immediate values and relocations.
 * @author Matthias Braun
 */
#ifndef FIRM_BE_IA32_IMM_H
#define FIRM_BE_IA32_IMM_H

#include <stdbool.h>
#include <stdint.h>
#include "compiler.h"
#include "firm_types.h"

19
20
21
22
23
/** immediate/relocation types (see also ELF file format) */
typedef enum x86_immediate_kind_t {
	X86_IMM_VALUE,       /**< no relocation, just a value */
	X86_IMM_ADDR,        /**< "normal" absolute addresses to a symbol */
	X86_IMM_PICBASE_REL, /**< relative to pic base address */
24
25
	X86_IMM_TLS_IE,      /**< thread local storage, initial exec */
	X86_IMM_TLS_LE,      /**< thread local storage, load exec */
26
	X86_IMM_FRAMEOFFSET, /**< offset to entity on stackframe */
Matthias Braun's avatar
Matthias Braun committed
27
	X86_IMM_GOTPCREL,    /**< global offset table entry PIC relative (elf64) */
28
29
} x86_immediate_kind_t;

30
typedef struct x86_imm32_t {
31
32
33
	ir_entity                   *entity;
	int32_t                      offset;
	ENUMBF(x86_immediate_kind_t) kind:8;
34
35
36
37
38
39
40
41
} x86_imm32_t;

bool x86_match_immediate(x86_imm32_t *immediate, const ir_node *node,
                         char constraint);

static inline bool x86_imm32_equal(x86_imm32_t const *const imm0,
								   x86_imm32_t const *const imm1)
{
42
43
	return imm0->entity == imm1->entity && imm0->offset == imm1->offset
	    && imm0->kind == imm1->kind;
44
45
46
}

#endif