Commit Graph

6452 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
a5913e6489 Add more expansion patterns.
RISC-V does not have a flags register, and thus no add-with-carry
instructions. Neither does MIPS.

Add expansions of these instructions in terms of iadd and icmp.
2016-10-19 11:24:08 -07:00
Jakob Stoklund Olesen
b068bace9d Add more expansion patterns.
RISC-V does not have a flags register, and thus no add-with-carry
instructions. Neither does MIPS.

Add expansions of these instructions in terms of iadd and icmp.
2016-10-19 11:24:08 -07:00
Jakob Stoklund Olesen
1e18e66ebe Bump filecheck version to 0.0.1, allow publication. 2016-10-18 13:33:39 -07:00
Jakob Stoklund Olesen
0b674fb28b Bump filecheck version to 0.0.1, allow publication. 2016-10-18 13:33:39 -07:00
Jakob Stoklund Olesen
df06f19979 Parse signature and function declarations.
Also add support for parsing call and call_indirect instructions.
2016-10-18 13:19:24 -07:00
Jakob Stoklund Olesen
d85225c537 Parse signature and function declarations.
Also add support for parsing call and call_indirect instructions.
2016-10-18 13:19:24 -07:00
Jakob Stoklund Olesen
cdb63a547e Add result values to call instructions too.
The make_inst_results() method now understands direct and indirect
calls, and can allocate result values matching the return types of the
function call.
2016-10-18 13:08:50 -07:00
Jakob Stoklund Olesen
7d7a7875d5 Add result values to call instructions too.
The make_inst_results() method now understands direct and indirect
calls, and can allocate result values matching the return types of the
function call.
2016-10-18 13:08:50 -07:00
Jakob Stoklund Olesen
1bcb8e25a2 Add signatures and ext_funcs tables to DataFlowGraph.
These two tables are used to keep track of type signatures of function
calls as well as external function references used in direct function
calls.

Also add an ExtFuncData struct representing an external function that
can be called directly.
2016-10-18 11:28:03 -07:00
Jakob Stoklund Olesen
c961e89fdc Add signatures and ext_funcs tables to DataFlowGraph.
These two tables are used to keep track of type signatures of function
calls as well as external function references used in direct function
calls.

Also add an ExtFuncData struct representing an external function that
can be called directly.
2016-10-18 11:28:03 -07:00
Jakob Stoklund Olesen
bdc95990d4 Add call and call_indirect instructions.
Add a new IndirectCall instruction format which has a value callee as
well as the call arguments.

Define call and call_indirect instructions.
2016-10-18 10:04:06 -07:00
Jakob Stoklund Olesen
e4e1c30f87 Add call and call_indirect instructions.
Add a new IndirectCall instruction format which has a value callee as
well as the call arguments.

Define call and call_indirect instructions.
2016-10-18 10:04:06 -07:00
Jakob Stoklund Olesen
b8a76822cf Track signatures and function references in the source map. 2016-10-18 09:43:20 -07:00
Jakob Stoklund Olesen
8055ac681c Track signatures and function references in the source map. 2016-10-18 09:43:20 -07:00
Jakob Stoklund Olesen
80a6ae203d Generalize def_inst() to def_entity().
Use this source map method for assigning a location to any entity whose
source number is not exposed. This could be

- Instructions.
- Signatures defined implicitly by function decls.

These entities only appear in the location map, not the entity number
maps.
2016-10-18 09:38:05 -07:00
Jakob Stoklund Olesen
45cf655ce4 Generalize def_inst() to def_entity().
Use this source map method for assigning a location to any entity whose
source number is not exposed. This could be

- Instructions.
- Signatures defined implicitly by function decls.

These entities only appear in the location map, not the entity number
maps.
2016-10-18 09:38:05 -07:00
Jakob Stoklund Olesen
f9734458f8 Promote the src/tools crate to the top-level workspace.
The 'src' and 'tests' top-level directories now contain tools sources
and integration tests for any of the library crates.
2016-10-17 15:04:29 -07:00
Jakob Stoklund Olesen
a8a79df620 Promote the src/tools crate to the top-level workspace.
The 'src' and 'tests' top-level directories now contain tools sources
and integration tests for any of the library crates.
2016-10-17 15:04:29 -07:00
Jakob Stoklund Olesen
846db00a21 Move library crates under 'lib/'.
Give these crates each a more standard directory layout with sources in
a 'src' sub-sirectory and Cargo.toml in the top lib/foo directory.

Add license and description fields to each.

The build script for the cretonne crate now lives in
'lib/cretonne/build.rs' separating it from the normal library sources
under 'lib/cretonne/src'.
2016-10-17 14:44:43 -07:00
Jakob Stoklund Olesen
0764df28b5 Move library crates under 'lib/'.
Give these crates each a more standard directory layout with sources in
a 'src' sub-sirectory and Cargo.toml in the top lib/foo directory.

Add license and description fields to each.

The build script for the cretonne crate now lives in
'lib/cretonne/build.rs' separating it from the normal library sources
under 'lib/cretonne/src'.
2016-10-17 14:44:43 -07:00
Jakob Stoklund Olesen
af6355e2ef Move the 'meta' dir to 'lib/cretonne/meta'.
The 'lib/cretonne' directory will be the new root of a stand-alone
cretonne crate containg both Python and Rust sources.

This is in preparation for publishing crates on crates.io.
2016-10-17 14:19:23 -07:00
Jakob Stoklund Olesen
e7f30a40b4 Move the 'meta' dir to 'lib/cretonne/meta'.
The 'lib/cretonne' directory will be the new root of a stand-alone
cretonne crate containg both Python and Rust sources.

This is in preparation for publishing crates on crates.io.
2016-10-17 14:19:23 -07:00
Jakob Stoklund Olesen
680387a53a Remove test_utils.
These test utilities have been subsumed by ir::Builder.
2016-10-14 15:17:34 -07:00
Jakob Stoklund Olesen
8480879f3e Remove test_utils.
These test utilities have been subsumed by ir::Builder.
2016-10-14 15:17:34 -07:00
Jakob Stoklund Olesen
98308177cc Switch domtree tests to using Builder. 2016-10-14 15:16:29 -07:00
Jakob Stoklund Olesen
af8f8d98e6 Switch domtree tests to using Builder. 2016-10-14 15:16:29 -07:00
Jakob Stoklund Olesen
8fb8a41f8e Give Builder a Cursor.
The Builder keeps track of a position in the layout and inserts new
instructions there.

Add insert_ebb() and ebb() methods to Builder.

Use Builder in the cfg tests.
2016-10-14 15:02:58 -07:00
Jakob Stoklund Olesen
d4197ca731 Give Builder a Cursor.
The Builder keeps track of a position in the layout and inserts new
instructions there.

Add insert_ebb() and ebb() methods to Builder.

Use Builder in the cfg tests.
2016-10-14 15:02:58 -07:00
Jakob Stoklund Olesen
7aef6bd535 Add Cursor::insert_ebb() method.
Insert an EBB at the current position and switch to inserting
instructions there. Call the relevant Layout methods to do so.
2016-10-14 14:01:49 -07:00
Jakob Stoklund Olesen
eb5cea7c6a Add Cursor::insert_ebb() method.
Insert an EBB at the current position and switch to inserting
instructions there. Call the relevant Layout methods to do so.
2016-10-14 14:01:49 -07:00
Jakob Stoklund Olesen
a41b34c11c Add Layout::insert_ebb_after() method.
Symmetrical with the existing insert_ebb().
2016-10-14 13:54:26 -07:00
Jakob Stoklund Olesen
8592979fc9 Add Layout::insert_ebb_after() method.
Symmetrical with the existing insert_ebb().
2016-10-14 13:54:26 -07:00
Jakob Stoklund Olesen
d1fd91021d Add Layout::split_ebb().
This method splits an EBB in two and moves trailing instructions to a
new EBB.
2016-10-14 12:33:54 -07:00
Jakob Stoklund Olesen
10c579e0cd Add Layout::split_ebb().
This method splits an EBB in two and moves trailing instructions to a
new EBB.
2016-10-14 12:33:54 -07:00
Jakob Stoklund Olesen
54a4b9b0d7 Add Cursor::insert_inst().
Insert an instruction at thecurrent cursor position.
2016-10-14 10:09:57 -07:00
Jakob Stoklund Olesen
6f68673e8a Add Cursor::insert_inst().
Insert an instruction at thecurrent cursor position.
2016-10-14 10:09:57 -07:00
Jakob Stoklund Olesen
177ac85db5 Add a LAyout Cursor data structure.
A layout cursor can be used instead of an iterator to keep track of a
position in a basic block *and* permitting instructions to be
manipulated.
2016-10-13 14:36:34 -07:00
Jakob Stoklund Olesen
d650d30b88 Add a LAyout Cursor data structure.
A layout cursor can be used instead of an iterator to keep track of a
position in a basic block *and* permitting instructions to be
manipulated.
2016-10-13 14:36:34 -07:00
Jakob Stoklund Olesen
6ce6f25626 Generate a Builder data type. WIP.
The Builder provides a convenient interface for inserting instructions
into an extended basic block.

The bulk of the builder methods are generated automatically from the
meta language instruction descriptions.

Still TODO: Keep track of an insertion position.
2016-10-12 16:47:11 -07:00
Jakob Stoklund Olesen
8ca970ba5c Generate a Builder data type. WIP.
The Builder provides a convenient interface for inserting instructions
into an extended basic block.

The bulk of the builder methods are generated automatically from the
meta language instruction descriptions.

Still TODO: Keep track of an insertion position.
2016-10-12 16:47:11 -07:00
Jakob Stoklund Olesen
93f79d7a48 Move second_result outside boxed storage.
In instruction formats that have multiple results AND boxed storage,
place the second_result field outside the boxed storage. The 16-byte
instruction format has room for opcode, type, second_result in the first
8 bytes, and the boxed pointer in the last 8 bytes.

This provides a simpler implementation of the second_result() and
second_result_mut() InstructionData methods.
2016-10-12 16:01:06 -07:00
Jakob Stoklund Olesen
5a2f8cbdf8 Move second_result outside boxed storage.
In instruction formats that have multiple results AND boxed storage,
place the second_result field outside the boxed storage. The 16-byte
instruction format has room for opcode, type, second_result in the first
8 bytes, and the boxed pointer in the last 8 bytes.

This provides a simpler implementation of the second_result() and
second_result_mut() InstructionData methods.
2016-10-12 16:01:06 -07:00
Jakob Stoklund Olesen
3ff28ed064 Capture the Rust type used to represent an operand kind.
The Rust type is usually the camel-cased name of the operand kind, but
there are variations, so allow an explicit rust_type='IntCC' when
defining operand kinds.
2016-10-12 15:51:50 -07:00
Jakob Stoklund Olesen
f78baf9c0b Capture the Rust type used to represent an operand kind.
The Rust type is usually the camel-cased name of the operand kind, but
there are variations, so allow an explicit rust_type='IntCC' when
defining operand kinds.
2016-10-12 15:51:50 -07:00
Jakob Stoklund Olesen
cf8d628254 Add simple Uimm8 and ImmVector immediate types.
Implement the boxed storage of the UnaryImmVector instruction format.
2016-10-12 15:51:22 -07:00
Jakob Stoklund Olesen
b8a537bb13 Add simple Uimm8 and ImmVector immediate types.
Implement the boxed storage of the UnaryImmVector instruction format.
2016-10-12 15:51:22 -07:00
Jakob Stoklund Olesen
e35811e120 Add FuncRef and SigRef entity references.
These refer to external functions and function signatures declared in
the preamble. Since we're already using the type names 'Signature' and
'Function', these entity references don't folow the usual EntityData /
Entity naming convention.
2016-10-12 15:20:46 -07:00
Jakob Stoklund Olesen
7cf25a073b Add FuncRef and SigRef entity references.
These refer to external functions and function signatures declared in
the preamble. Since we're already using the type names 'Signature' and
'Function', these entity references don't folow the usual EntityData /
Entity naming convention.
2016-10-12 15:20:46 -07:00
Jakob Stoklund Olesen
75406ad5be Move signatures into new ir::extfunc module.
This new module will gain more data types dealing with external function
calls.
2016-10-12 13:56:26 -07:00
Jakob Stoklund Olesen
b42d85ae24 Move signatures into new ir::extfunc module.
This new module will gain more data types dealing with external function
calls.
2016-10-12 13:56:26 -07:00