Make regalloc visit fallthrough_return instructions.

Add an explicit "is_ghost" property to selected instructions, and use
that to determine whether reload and coloring should visit instructions.
This allows them to visit fallthrough_return instructions and insert
fills and register moves as needed.
This commit is contained in:
Dan Gohman
2018-10-26 06:39:44 -07:00
committed by Benjamin Bouvier
parent 681cb5e20a
commit 88bbbca6cd
5 changed files with 101 additions and 60 deletions

View File

@@ -844,7 +844,7 @@ vsplit = Instruction(
the lanes from ``x``. The result may be two scalars if ``x`` only had
two lanes.
""",
ins=x, outs=(lo, hi))
ins=x, outs=(lo, hi), is_ghost=True)
Any128 = TypeVar(
'Any128', 'Any scalar or vector type with as most 128 lanes',
@@ -864,7 +864,7 @@ vconcat = Instruction(
It is possible to form a vector by concatenating two scalars.
""",
ins=(x, y), outs=a)
ins=(x, y), outs=a, is_ghost=True)
c = Operand('c', TxN.as_bool(), doc='Controlling vector')
x = Operand('x', TxN, doc='Value to use where `c` is true')
@@ -2009,7 +2009,7 @@ isplit = Instruction(
Returns the low half of `x` and the high half of `x` as two independent
values.
""",
ins=x, outs=(lo, hi))
ins=x, outs=(lo, hi), is_ghost=True)
NarrowInt = TypeVar(
@@ -2029,6 +2029,6 @@ iconcat = Instruction(
the same number of lanes as the inputs, but the lanes are twice the
size.
""",
ins=(lo, hi), outs=a)
ins=(lo, hi), outs=a, is_ghost=True)
GROUP.close()

View File

@@ -92,6 +92,7 @@ class Instruction(object):
:param is_indirect_branch: This is an indirect branch instruction.
:param is_call: This is a call instruction.
:param is_return: This is a return instruction.
:param is_ghost: This is a ghost instruction.
:param can_trap: This instruction can trap.
:param can_load: This instruction can load from memory.
:param can_store: This instruction can store to memory.
@@ -108,6 +109,7 @@ class Instruction(object):
'True for all indirect branch or jump instructions.',
'is_call': 'Is this a call instruction?',
'is_return': 'Is this a return instruction?',
'is_ghost': 'Is this a ghost instruction?',
'can_load': 'Can this instruction read from memory?',
'can_store': 'Can this instruction write to memory?',
'can_trap': 'Can this instruction cause a trap?',