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

amd64, ia32: Support the asm constraint 'e'.

parent 6236a862
......@@ -6,6 +6,7 @@ libFirm 1.22.1 (2016-01-07)
* Generate 'mov $~1, %r; rol x, %r' for '~(1 << x)' (ia32)
* Generate 'mov $~0x80000000, %r; ror x, %r' for '~(0x80000000 >> x)' (ia32)
* Stub support for the asm constraint modifier '%'
* Support the asm constraint 'e' (amd64, ia32)
* Bugfixes
libFirm 1.22.0 (2015-12-31)
......
......@@ -87,6 +87,7 @@ const x86_asm_constraint_list_t amd64_asm_constraints = {
['b'] = { MATCH_REG, GP, 1 << REG_GP_RBX },
['c'] = { MATCH_REG, GP, 1 << REG_GP_RCX },
['d'] = { MATCH_REG, GP, 1 << REG_GP_RDX },
['e'] = { MATCH_IMM, GP, 0 },
['g'] = { MATCH_ANY, GP, 0 },
['i'] = { MATCH_IMM, GP, 0 },
['l'] = { MATCH_REG, GP, 1 << REG_GP_RAX | 1 << REG_GP_RBX
......
......@@ -93,6 +93,7 @@ const x86_asm_constraint_list_t ia32_asm_constraints = {
['b'] = { MATCH_REG, GP, 1 << REG_GP_EBX },
['c'] = { MATCH_REG, GP, 1 << REG_GP_ECX },
['d'] = { MATCH_REG, GP, 1 << REG_GP_EDX },
['e'] = { MATCH_IMM, GP, 0 },
['f'] = { MATCH_REG, FP, 0 },
['g'] = { MATCH_ANY, GP, 0 },
['i'] = { MATCH_IMM, GP, 0 },
......
......@@ -22,11 +22,14 @@
static bool check_immediate_constraint(long val, char immediate_constraint_type)
{
/* Workaround for warning about always true comparison when long has 32 bits. */
long long const v31 = 2147483648;
switch (immediate_constraint_type) {
case 'g':
case 'i':
case 'n': return true;
case 'e': return -v31 <= val && val < v31;
case 'I': return 0 <= val && val <= 31;
case 'J': return 0 <= val && val <= 63;
case 'K': return -128 <= val && val < 128;
......@@ -65,9 +68,13 @@ bool x86_match_immediate(x86_imm32_t *immediate, const ir_node *node,
x86_immediate_kind_t kind = (x86_immediate_kind_t)reloc_kind;
if (entity != NULL) {
/* we need full 32bits for entities */
if (constraint != 'i' && constraint != 'g')
return false;
/* We need an immediate, which can hold all bits of an address. */
switch (constraint) {
case 'e': if (get_mode_size_bits(mode_P) > 32) return false;
case 'g': break;
case 'i': break;
default: return false;
}
if (kind == X86_IMM_VALUE)
kind = X86_IMM_ADDR;
}
......
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