11213 Commits

Author SHA1 Message Date
Morgan Phillips
5bcce51bd9 Add print-cfg tests 2016-07-14 13:43:11 -07:00
Morgan Phillips
4e74d85056 Id CFG graphs by function name 2016-07-14 12:22:08 -07:00
Morgan Phillips
0cdcf29308 Id CFG graphs by function name 2016-07-14 12:22:08 -07:00
Morgan Phillips
c0a52d377e Merge pull request #7 from mrrrgn/graphviz
Add a print-cfg subcommand.
2016-07-13 14:49:42 -07:00
Morgan Phillips
428e89c566 Merge pull request #7 from mrrrgn/graphviz
Add a print-cfg subcommand.
2016-07-13 14:49:42 -07:00
Morgan Phillips
53ed7f5ea3 Add a print-cfg subcommand.
The command returns parses a .cton file, builds a CFG, and prints it to
stdout in graphviz format.
2016-07-13 14:31:05 -07:00
Morgan Phillips
4a6e53f90d Add a print-cfg subcommand.
The command returns parses a .cton file, builds a CFG, and prints it to
stdout in graphviz format.
2016-07-13 14:31:05 -07:00
Morgan Phillips
6a516c606c Merge pull request #6 from mrrrgn/cfg-1
Control Flow Graph
2016-07-13 11:13:51 -07:00
Morgan Phillips
83279026ba Merge pull request #6 from mrrrgn/cfg-1
Control Flow Graph
2016-07-13 11:13:51 -07:00
Morgan Phillips
985606b12c Replace Results with assertions in invariant cases.
It seems reasonable that certain non-recoverable errors during the building of the
CFG should crash.
2016-07-13 11:04:39 -07:00
Morgan Phillips
295a4eb03f Replace Results with assertions in invariant cases.
It seems reasonable that certain non-recoverable errors during the building of the
CFG should crash.
2016-07-13 11:04:39 -07:00
Morgan Phillips
24b421bd68 Remove misleading test comments 2016-07-12 14:46:24 -07:00
Morgan Phillips
79c7ae6233 Remove misleading test comments 2016-07-12 14:46:24 -07:00
Morgan Phillips
522227c965 Cargo-fmt fixes 2016-07-12 14:42:49 -07:00
Morgan Phillips
180eae3bb5 Cargo-fmt fixes 2016-07-12 14:42:49 -07:00
Morgan Phillips
e4a9c5c13c Add a Control Flow Graph representation.
The CFG must be instantiated against an existing function but may be
modified after creation
2016-07-12 14:37:37 -07:00
Morgan Phillips
c6b1388fdc Add a Control Flow Graph representation.
The CFG must be instantiated against an existing function but may be
modified after creation
2016-07-12 14:37:37 -07:00
Morgan Phillips
942c4b96c9 Ignore cargo-fmt and vim related files 2016-07-12 13:59:27 -07:00
Morgan Phillips
84357c3402 Ignore cargo-fmt and vim related files 2016-07-12 13:59:27 -07:00
Jakob Stoklund Olesen
27b2c90a27 Add tests for parsing call and return. 2016-07-08 16:28:19 -07:00
Jakob Stoklund Olesen
ad5e6b14cf Add tests for parsing call and return. 2016-07-08 16:28:19 -07:00
Jakob Stoklund Olesen
8cb198b23c Delete the concept of 'local SSA form'.
This was supposed to make verification fast, but WebAssembly is no longer in
this form since it's blocks can produce values.

Also, computing a flow graph and dominator tree is really fast anyway.
2016-07-08 16:26:11 -07:00
Jakob Stoklund Olesen
e7adcf9af9 Delete the concept of 'local SSA form'.
This was supposed to make verification fast, but WebAssembly is no longer in
this form since it's blocks can produce values.

Also, computing a flow graph and dominator tree is really fast anyway.
2016-07-08 16:26:11 -07:00
Jakob Stoklund Olesen
3839281414 Define a return instruction.
It is possible to return multiple values from a function, so ReturnData contains
a VariableArgs instance.

We don't want return instructions to appear as 'return (v1)', so tweak the
printing of VariableArgs so the parantheses are added externally.
2016-07-08 16:19:26 -07:00
Jakob Stoklund Olesen
520a438c42 Define a return instruction.
It is possible to return multiple values from a function, so ReturnData contains
a VariableArgs instance.

We don't want return instructions to appear as 'return (v1)', so tweak the
printing of VariableArgs so the parantheses are added externally.
2016-07-08 16:19:26 -07:00
Jakob Stoklund Olesen
6587784d7d Rewrite EBB and value references after parsing.
We llow forward references to values and EBBs, so it is not possible to rewrite
these from the source domain to the in-memory domain during parsing.

Instead go through all the instructions after parsing everything and rewrite the
value and EBB references when everything has been created and mapped.
2016-07-08 15:15:53 -07:00
Jakob Stoklund Olesen
a39e418d32 Rewrite EBB and value references after parsing.
We llow forward references to values and EBBs, so it is not possible to rewrite
these from the source domain to the in-memory domain during parsing.

Instead go through all the instructions after parsing everything and rewrite the
value and EBB references when everything has been created and mapped.
2016-07-08 15:15:53 -07:00
Jakob Stoklund Olesen
3c5c5a9e40 Don't print a space after quoted function names. 2016-07-08 11:44:20 -07:00
Jakob Stoklund Olesen
02861df78c Don't print a space after quoted function names. 2016-07-08 11:44:20 -07:00
Jakob Stoklund Olesen
b710dd8464 Define floating point conversion instructions. 2016-07-08 11:20:19 -07:00
Jakob Stoklund Olesen
fd9f08c30f Define floating point conversion instructions. 2016-07-08 11:20:19 -07:00
Jakob Stoklund Olesen
ed535d90ad Fix the recommended Sphinx version.
The latest Sphinx 1.4.4 produces lots of warnings about four-column indices.
We'll wait for Read the Docs to upgrade their systems before moving to the newer
Sphinx version.
2016-07-07 19:24:08 -07:00
Jakob Stoklund Olesen
6971ae4e40 Fix the recommended Sphinx version.
The latest Sphinx 1.4.4 produces lots of warnings about four-column indices.
We'll wait for Read the Docs to upgrade their systems before moving to the newer
Sphinx version.
2016-07-07 19:24:08 -07:00
Jakob Stoklund Olesen
26ed45160e Fix rustc warning about unused Write trait. 2016-07-07 18:24:22 -07:00
Jakob Stoklund Olesen
84abe28837 Fix rustc warning about unused Write trait. 2016-07-07 18:24:22 -07:00
Jakob Stoklund Olesen
62e96f4d3e Metadefs for integer reduce and extend operations.
Naming is interesting here. Since 'truncate' refers to removing the least
significant digits, use 'ireduce' instead. The 'extend' use is fairly
established. Don't abbreviate, avoid unfortunate modern vernacular.
2016-07-07 18:17:16 -07:00
Jakob Stoklund Olesen
6321fd1f5f Metadefs for integer reduce and extend operations.
Naming is interesting here. Since 'truncate' refers to removing the least
significant digits, use 'ireduce' instead. The 'extend' use is fairly
established. Don't abbreviate, avoid unfortunate modern vernacular.
2016-07-07 18:17:16 -07:00
Jakob Stoklund Olesen
05826c8a69 Fix Travis script path. 2016-07-07 17:27:51 -07:00
Jakob Stoklund Olesen
ce7524d68f Fix Travis script path. 2016-07-07 17:27:51 -07:00
Jakob Stoklund Olesen
31520717d3 Include parser tests in the test-all.sh script.
Move test-all.sh to the top level directory, and also run the parser tests from
this script.

Use a release build of cton-util to run the parser tests. As we accumulate many
tests in the tests directory tree, this will mean they can still be run quickly.

Point Travis config to the new test script.
2016-07-07 17:25:01 -07:00
Jakob Stoklund Olesen
a8c7ca6c75 Include parser tests in the test-all.sh script.
Move test-all.sh to the top level directory, and also run the parser tests from
this script.

Use a release build of cton-util to run the parser tests. As we accumulate many
tests in the tests directory tree, this will mean they can still be run quickly.

Point Travis config to the new test script.
2016-07-07 17:25:01 -07:00
Jakob Stoklund Olesen
c82b772315 Add meta definition for bitcast.
This instruction uses two type variables: input and output. Make sure that our
parser can handle it. The output type variable annotation is mandatory.

Add a ValueTypeSet::example() method which is used to provide better diagnostics
for a missing type variable.
2016-07-07 14:01:00 -07:00
Jakob Stoklund Olesen
4a929f5e41 Add meta definition for bitcast.
This instruction uses two type variables: input and output. Make sure that our
parser can handle it. The output type variable annotation is mandatory.

Add a ValueTypeSet::example() method which is used to provide better diagnostics
for a missing type variable.
2016-07-07 14:01:00 -07:00
Jakob Stoklund Olesen
81ca406dd0 Add meta definitions for floating point operations.
Rename the Select instruction format to Ternary since it is also used by the fma
instruction.
2016-07-07 13:16:24 -07:00
Jakob Stoklund Olesen
2bfb4ca5b7 Add meta definitions for floating point operations.
Rename the Select instruction format to Ternary since it is also used by the fma
instruction.
2016-07-07 13:16:24 -07:00
Jakob Stoklund Olesen
5d8fb0fdc3 Define icmp and fcmp comparison instructions.
Add new intcc and floatcc operand types for the immediate condition codes on
these instructions.

Add new IntCompare and FloatCompare instruction formats.

Add a generic match_enum() parser function that can match any identifier-like
enumerated operand kind that implements FromStr.

Define the icmp and fcmp instructions in case.py. Include documentation for the
condition codes with these two instructions.
2016-07-07 11:43:12 -07:00
Jakob Stoklund Olesen
86688053a6 Define icmp and fcmp comparison instructions.
Add new intcc and floatcc operand types for the immediate condition codes on
these instructions.

Add new IntCompare and FloatCompare instruction formats.

Add a generic match_enum() parser function that can match any identifier-like
enumerated operand kind that implements FromStr.

Define the icmp and fcmp instructions in case.py. Include documentation for the
condition codes with these two instructions.
2016-07-07 11:43:12 -07:00
Jakob Stoklund Olesen
70507a3be0 Add enums for condition codes.
The icmp and fmp instructions use different kinds of condition codes because
integers and floating point values behave differently.

Add a CondCode trait implementing shared behavior.
2016-07-06 15:51:41 -07:00
Jakob Stoklund Olesen
90bb2fd27d Add enums for condition codes.
The icmp and fmp instructions use different kinds of condition codes because
integers and floating point values behave differently.

Add a CondCode trait implementing shared behavior.
2016-07-06 15:51:41 -07:00
Jakob Stoklund Olesen
7f8479e097 Parse insertlane and extractlane instruction formats.
These instruction formats take immediate lane index operands. We store these as
u8 fields and require them to be in decimal format in the source. No hexadecimal
lane indexes are supported.
2016-07-06 13:36:15 -07:00