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
df7b9be1
Commit
df7b9be1
authored
Jan 24, 2016
by
Christoph Mallon
Browse files
amd64, ia32: Support the asm constraint 'e'.
parent
6236a862
Changes
4
Hide whitespace changes
Inline
Side-by-side
NEWS.md
View file @
df7b9be1
...
...
@@ -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)
...
...
ir/be/amd64/amd64_transform.c
View file @
df7b9be1
...
...
@@ -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
...
...
ir/be/ia32/ia32_transform.c
View file @
df7b9be1
...
...
@@ -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
},
...
...
ir/be/ia32/x86_imm.c
View file @
df7b9be1
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment