Commit Graph

10 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
222ccae4b2 Support constant integers in AST expressions.
Make it possible to write AST nodes: iconst.i32(imm64(0)).
2017-07-28 13:54:25 -07:00
Jakob Stoklund Olesen
d2eb745265 Allow dot syntax notation for enumerated immediate operands.
The meta language patterns sometimes need to refer to specific values of
enumerated immediate operands. The dot syntax provides a namespaced,
typed way of doing that: icmp(intcc.ult, a, x).

Add an ast.Enumerator class for representing this kind of AST leaf node.

Add value definitions for the intcc and floatcc immediate operand kinds.
2017-03-30 11:37:05 -07:00
Jakob Stoklund Olesen
be7ff71b15 Change InstBuilder low-level format constructor signatures.
The per-instruction format low-level constructors in InstBuilder should
be independent of the relative ordering of value and immediate operands
in order to prepare for the future instruction format merger.

Reorder their arguments such that all the immediate operands are placed
before the value operands.

For instruction formats that use a value list representation, just take
a single ValueList argument. The value lists are created by the
individual instruction constructors. This means that the format
constructor doesn't care how many of the instructions operands are
'fixed' and how many are 'variable' arguments.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
2b209c791d Add value_opnums and imm_opnums fields to Instruction.
These two tuples contain operand indexes of the explicit value operands
and immediate operands respectively. We can no longer use the
instruction format value_operands field.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
cd06b176ac Remove some has_value_list workarounds.
Now that all variable_args formats use has_value_list, we can remove
some workarounds that allowed the old boxed_storage form.
2017-03-09 19:12:00 -08:00
Jakob Stoklund Olesen
ac798c1aed Fix flake8 style issue. 2017-01-20 10:33:45 -08:00
Jakob Stoklund Olesen
45fd134d3e Assign a type variable to all VALUE operands.
A few operands have a fixed type assigned. Create a singleton type
variable for these exceptions. Most instructions are polymorphic, so
this is a little overhead.

Eliminate the Operand.typ field and replace it with an Operand.typevar
field which is always a TypeVar, but which only exists in VALUE
operands.
2016-11-08 14:58:44 -08:00
Jakob Stoklund Olesen
fa7dc6825a Move Operand itself into cdsl.operands. 2016-11-08 11:30:31 -08:00
Jakob Stoklund Olesen
93a1387f2f Get rid of operand_kind()
This method caused lots of import cycles when type checking.

Use isinstance() in the Operand constructor instead to decipher the
OperandSpec union type.
2016-11-08 11:26:26 -08:00
Jakob Stoklund Olesen
bb28dc6686 Split out operand descriptions.
- cdsl.operands has the Operand and OperandKind classes.
2016-11-08 10:58:23 -08:00