Commit Graph

6452 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
63a6ade0a5 Add InstructionFormat.imm_fields.
Consolidate the imm_members and imm_kinds into this list so the
FormatField is the single definition of these properties.

This makes it easier to access the precomputed FormatFields
parametrically, avoiding going through getattr().

This is better for type checking too.
2017-03-31 13:46:39 -07:00
Jakob Stoklund Olesen
89ff979d75 Add InstructionFormat.imm_fields.
Consolidate the imm_members and imm_kinds into this list so the
FormatField is the single definition of these properties.

This makes it easier to access the precomputed FormatFields
parametrically, avoiding going through getattr().

This is better for type checking too.
2017-03-31 13:46:39 -07:00
Jakob Stoklund Olesen
2f50ae3166 Add an IsEqual FieldPredicate.
Compare an immediate operand to a constant value.
2017-03-31 13:46:38 -07:00
Jakob Stoklund Olesen
b31ca83b91 Add an IsEqual FieldPredicate.
Compare an immediate operand to a constant value.
2017-03-31 13:46:38 -07:00
Jakob Stoklund Olesen
98ecebd85b Add a mypy.ini file and enable some more warnings.
Also require all Python functions to have a type declaration.
2017-03-30 19:52:49 -07:00
Jakob Stoklund Olesen
3b0ac20ce2 Add a mypy.ini file and enable some more warnings.
Also require all Python functions to have a type declaration.
2017-03-30 19:52:49 -07:00
Jakob Stoklund Olesen
fc979c474f Add mypy types for gen_settings.py. 2017-03-30 18:42:06 -07:00
Jakob Stoklund Olesen
a9ec28ab7c Add mypy types for gen_settings.py. 2017-03-30 18:42:06 -07:00
Jakob Stoklund Olesen
469ecd91bf Add mypy types for gen_encoding.py. 2017-03-30 17:07:24 -07:00
Jakob Stoklund Olesen
49766bae12 Add mypy types for gen_encoding.py. 2017-03-30 17:07:24 -07:00
Jakob Stoklund Olesen
1a066c4054 Add mypy types for gen_instr.py.
Declare the Instruction.number opcode number field.
2017-03-30 16:20:40 -07:00
Jakob Stoklund Olesen
c5f2ef8edb Add mypy types for gen_instr.py.
Declare the Instruction.number opcode number field.
2017-03-30 16:20:40 -07:00
Angus Holder
353dc72b5b Verify integrity of the existing control flow graph of the context. (#70)
* Verify integrity of the existing control flow graph of the context.

* Make checking more thorough.
2017-03-30 15:34:50 -07:00
Angus Holder
b94d01f892 Verify integrity of the existing control flow graph of the context. (#70)
* Verify integrity of the existing control flow graph of the context.

* Make checking more thorough.
2017-03-30 15:34:50 -07:00
Jakob Stoklund Olesen
cfe2c7f46f Add more mypy annotations. 2017-03-30 15:16:44 -07:00
Jakob Stoklund Olesen
a82e521291 Add more mypy annotations. 2017-03-30 15:16:44 -07:00
Jakob Stoklund Olesen
02051c4764 Add mypy annotations to cdsl.predicates, settings.
Wherein we learned that only BoolSettings can be used as predicates.
2017-03-30 14:11:19 -07:00
Jakob Stoklund Olesen
ae12c94d04 Add mypy annotations to cdsl.predicates, settings.
Wherein we learned that only BoolSettings can be used as predicates.
2017-03-30 14:11:19 -07:00
Jakob Stoklund Olesen
aa06e40456 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
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
cb33f93fcd Use pretty_verifier_error in runone too. 2017-03-29 15:30:44 -07:00
Jakob Stoklund Olesen
ffeeba7c93 Use pretty_verifier_error in runone too. 2017-03-29 15:30:44 -07:00
Jakob Stoklund Olesen
4c3e590bb9 Run verifier after legalizer and regalloc file tests.
Run the verify_contexti() function after invoking the legalize() and
regalloc() context functions. This will help catch bad code produced by
these passes.
2017-03-29 15:19:03 -07:00
Jakob Stoklund Olesen
e1711f42f6 Run verifier after legalizer and regalloc file tests.
Run the verify_contexti() function after invoking the legalize() and
regalloc() context functions. This will help catch bad code produced by
these passes.
2017-03-29 15:19:03 -07:00
Jakob Stoklund Olesen
7a0092754d Allow vector types for isplit and iconcat.
These two instructions make sense for vector types by simply performing
the same operation on each lane, like most other vector operations.

Problem found by @angusholder's verifier.
2017-03-29 15:18:39 -07:00
Jakob Stoklund Olesen
de543bb308 Allow vector types for isplit and iconcat.
These two instructions make sense for vector types by simply performing
the same operation on each lane, like most other vector operations.

Problem found by @angusholder's verifier.
2017-03-29 15:18:39 -07:00
Jakob Stoklund Olesen
b5d4046591 Fix a type error in the legalizer patterns.
The carry and borrow values are boolean, so we have to convert them to
an integer type with bint(c) before we can add them to the result.

Also tweak the default legalizer action for unsupported types: Only
attempt a narrowing pattern for lane types > 32 bits.

This was found by @angusholder's new type checks in the verifier.
2017-03-29 15:00:27 -07:00
Jakob Stoklund Olesen
62641d4553 Fix a type error in the legalizer patterns.
The carry and borrow values are boolean, so we have to convert them to
an integer type with bint(c) before we can add them to the result.

Also tweak the default legalizer action for unsupported types: Only
attempt a narrowing pattern for lane types > 32 bits.

This was found by @angusholder's new type checks in the verifier.
2017-03-29 15:00:27 -07:00
Jakob Stoklund Olesen
4613cbcf18 Test binary encodings of some RV32I instructions.
These are the R-format instructions in RV32I.
2017-03-29 13:16:12 -07:00
Jakob Stoklund Olesen
a5d4839002 Test binary encodings of some RV32I instructions.
These are the R-format instructions in RV32I.
2017-03-29 13:16:12 -07:00
Jakob Stoklund Olesen
269f6d3dd0 Add Vim syntax support for Name and HexSequence tokens.
Also disable spell checking for .cton files. They tend to contain very
few words, and even comments are pretty cryptic.
2017-03-29 13:16:12 -07:00
Jakob Stoklund Olesen
f968c60724 Add Vim syntax support for Name and HexSequence tokens.
Also disable spell checking for .cton files. They tend to contain very
few words, and even comments are pretty cryptic.
2017-03-29 13:16:12 -07:00
Angus Holder
892ad25b1b Type checking and Dominator Tree integrity checks in Verifier (#66)
* Verify that a recomputed dominator tree is identical to the existing one.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* Added `inst_{fixed,variable}_args` accessor functions.
* Improved error messages in verifier.
* Type check return statements against the function signature.
2017-03-29 13:14:42 -07:00
Angus Holder
b5fda64b49 Type checking and Dominator Tree integrity checks in Verifier (#66)
* Verify that a recomputed dominator tree is identical to the existing one.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* The verifier now typechecks instruction results and arguments.
* Added `inst_{fixed,variable}_args` accessor functions.
* Improved error messages in verifier.
* Type check return statements against the function signature.
2017-03-29 13:14:42 -07:00
Jakob Stoklund Olesen
6ad34f90aa Allow for unencoded instructions in the binemit tests.
If an instruction doesn't have an associated encoding, use the standard
TargetIsa hook to encode it.

The test still fails if an instruction can't be encoded. There is no
legalization step.
2017-03-29 09:55:49 -07:00
Jakob Stoklund Olesen
1d6049b8f8 Allow for unencoded instructions in the binemit tests.
If an instruction doesn't have an associated encoding, use the standard
TargetIsa hook to encode it.

The test still fails if an instruction can't be encoded. There is no
legalization step.
2017-03-29 09:55:49 -07:00
Jakob Stoklund Olesen
f540cb0664 Add a binemit test command.
This makes it possible to write file tests that verify the binary
encoding of machine code.
2017-03-28 15:56:30 -07:00
Jakob Stoklund Olesen
36eb39a1f8 Add a binemit test command.
This makes it possible to write file tests that verify the binary
encoding of machine code.
2017-03-28 15:56:30 -07:00
Jakob Stoklund Olesen
0619d6f827 Generate binemit::emit_inst() functions.
Use the meta language encoding recipes to generate an emit_inst()
function for each ISA. The generated calls into recipe_*() functions
that must be implemented by hand.

Implement recipe_*() functions for the RISC-V recipes.

Add the TargetIsa::emit_inst() entry point which emits an instruction to
a CodeSink trait object.
2017-03-28 14:44:36 -07:00
Jakob Stoklund Olesen
ca2b1c79d7 Generate binemit::emit_inst() functions.
Use the meta language encoding recipes to generate an emit_inst()
function for each ISA. The generated calls into recipe_*() functions
that must be implemented by hand.

Implement recipe_*() functions for the RISC-V recipes.

Add the TargetIsa::emit_inst() entry point which emits an instruction to
a CodeSink trait object.
2017-03-28 14:44:36 -07:00
Jakob Stoklund Olesen
19710af5b7 Start the binemit module.
This module will provide supporting code for emitting binary machine
code with relocations.
2017-03-23 15:18:11 -07:00
Jakob Stoklund Olesen
bbbae4dc47 Start the binemit module.
This module will provide supporting code for emitting binary machine
code with relocations.
2017-03-23 15:18:11 -07:00
Jakob Stoklund Olesen
5027e096b5 Add dfg.inst_args(_mut) methods.
A shortcut for calling arguments() directly that goes with the existing
inst_results() method.
2017-03-23 15:07:22 -07:00
Jakob Stoklund Olesen
f710f13949 Add dfg.inst_args(_mut) methods.
A shortcut for calling arguments() directly that goes with the existing
inst_results() method.
2017-03-23 15:07:22 -07:00
Jakob Stoklund Olesen
6fdbbf2b1a Legalize EBBs in a reverse post-order.
This means that whenever we need to split a value, it is either already
defined by a concatenation instruction in a previously processed EBB, or
it's an EBB argument.
2017-03-23 09:50:26 -07:00
Jakob Stoklund Olesen
c5c9f211df Legalize EBBs in a reverse post-order.
This means that whenever we need to split a value, it is either already
defined by a concatenation instruction in a previously processed EBB, or
it's an EBB argument.
2017-03-23 09:50:26 -07:00
Jakob Stoklund Olesen
cc5c4932ca Remove spurious shell redirections from install commands. 2017-03-23 09:42:36 -07:00
Jakob Stoklund Olesen
cd52b671e6 Remove spurious shell redirections from install commands. 2017-03-23 09:42:36 -07:00
Jakob Stoklund Olesen
d9f325f6cd Simplify branch arguments after splitting EBB arguments.
The EBB argument splitting may generate concat-split dependencies when
it repairs branch arguments in EBBs that have not yet been fully
legalized. Add a branch argument simplification step that can resolve
these dependency chains.

This means that all split and concatenation instructions will be dead
after legalization for types that have no legal instructions using them.
2017-03-22 15:29:06 -07:00
Jakob Stoklund Olesen
12b2af3f8a Simplify branch arguments after splitting EBB arguments.
The EBB argument splitting may generate concat-split dependencies when
it repairs branch arguments in EBBs that have not yet been fully
legalized. Add a branch argument simplification step that can resolve
these dependency chains.

This means that all split and concatenation instructions will be dead
after legalization for types that have no legal instructions using them.
2017-03-22 15:29:06 -07:00