Add RISC-V encodings for spill and fill.

Add a Stack() class for specifying operand constraints for values on the
stack.

Add encoding recipes for RISC-V spill and fill instructions. Don't
implement the encoding recipe functions yet since we don't have the
stack slot layout yet.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-13 13:39:52 -07:00
parent 2875c6ddf9
commit 00551dbc5f
6 changed files with 53 additions and 6 deletions

View File

@@ -56,7 +56,7 @@ from unique_table import UniqueSeqTable
from collections import OrderedDict, defaultdict
import math
import itertools
from cdsl.registers import RegClass, Register
from cdsl.registers import RegClass, Register, Stack
from cdsl.predicates import FieldPredicate
try:
@@ -519,6 +519,10 @@ def emit_operand_constraints(
assert cons == tied[n], "Invalid tied constraint"
fmt.format('kind: ConstraintKind::Tied({}),', cons)
fmt.format('regclass: {},', recipe.ins[cons])
elif isinstance(cons, Stack):
assert n not in tied, "Can't tie stack operand"
fmt.line('kind: ConstraintKind::Stack,')
fmt.format('regclass: {},', cons.regclass)
else:
raise AssertionError(
'Unsupported constraint {}'.format(cons))