Commit Graph

2269 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
3e87092ce8 Upgrade to Sphinx 1.5.3
Read the Docs is now using the latest version of Sphinx, so upgrade our
recommended version too.

As of Sphinx 1.4, index entries are 5-tuples instead of 4-tuples. Update
the Cretonne Sphinx domain to generate the new 5-tuples.

Since we're over this compatibility bump, there's no reason to recommend
a specific Sphinx version, so just go back to 'current'.
2017-03-09 10:11:37 -08:00
Angus Holder
41e4ea9158 Some refactoring, relaxed error handling so we allow encoding specifiers even without a unique ISA. 2017-03-09 07:19:28 -08:00
Angus Holder
cfdecfdcbf We now parse and record a ValueLoc for each SSA value result of each instruction. Code currently not passing tests. 2017-03-09 07:19:28 -08:00
Jakob Stoklund Olesen
bc1901b766 Handle a half-full func.locations map.
If func.locations has not been properly resized to have an entry for all
values, we should just full in the default location for the missing
values instead of crashing.
2017-03-08 19:44:45 -08:00
Jakob Stoklund Olesen
58756e5d34 Add is_call and is_return instruction attributes. 2017-03-08 14:48:50 -08:00
Jakob Stoklund Olesen
7a45aeebeb Use a unique ISA in 'test cat' file tests.
Add a Function::display() method which can include ISA-specific
information when printing the function.

If a test file has a unique ISA, use that in the `test cat`
implementation.
2017-03-08 13:04:30 -08:00
Angus Holder
10f86baf63 Added tests, some refactoring, fixed a parsing bug. 2017-03-08 13:01:32 -08:00
Angus Holder
a081b09c94 Added parsing of instruction encodings and result registers specifications. 2017-03-08 13:01:32 -08:00
Jakob Stoklund Olesen
fd9d7fae76 Strip trailing white space from regex: directives.
This was particularly confusing when reading a file with Windows line
endings. The CR would become part of the regex.
2017-03-08 12:15:36 -08:00
Jakob Stoklund Olesen
3578fbc428 Implement From traits on ArgAction for convenience. 2017-03-07 15:13:55 -08:00
Jakob Stoklund Olesen
83d3a1020d Heed uext and sext annotations on RISC-V arguments.
Translate the small integer arguments to i32 or i64 with the appropriate
extend and ireduce instructions.
2017-03-07 15:07:00 -08:00
Jakob Stoklund Olesen
25677d1bd8 Add vsplit and vconcat instructions.
Add support for two new type variable functions: half_vector() and
double_vector().

Use these two instructions to break down unsupported SIMD types and
build them up again.
2017-03-07 14:31:57 -08:00
Jakob Stoklund Olesen
5d266acb5f Legalize entry block arguments to match ABI types.
Insert conversion code that reconstructs the original function argument
types from the legalized ABI signature.

Add abi::legalize_abi_value(). This function is used when adapting code
to a legalized function signature.
2017-03-07 13:29:19 -08:00
Jakob Stoklund Olesen
5185cce1e9 Add take_ebb_args(), put_ebb_arg() method pair.
These two methods can be use to rewrite the argument values to an EBB.
In particular, we need to rewrite the arguments to the entry block to be
compatible with a legalized function signature.

Reuse the put_ebb_arg() method in the implementation of
append_ebb_arg().
2017-03-06 15:03:48 -08:00
Jakob Stoklund Olesen
e84a4e41a0 Implement legalize_signature for RISC-V.
Add an abi module with code that is probably useful to all ISAs when
implementing this function.

Add a unit() method to RegClassData which can be used to index the
register units in a class.
2017-03-03 11:09:55 -08:00
Jakob Stoklund Olesen
408395db25 Add a legalize_signature method to TargetIsa.
This entry point will be used for controlling ABI conventions when
legalizing.

Provide an empty implementation for RISC-V and let the other ISAs crash
in legalization.

This is just the scaffolding. We still need to:

- Rewrite the entry block arguments to match the legalized signature.
- Rewrite call and return instructions.
- Implement the legalize_signature() function for all ISAs.
- Add shared generic types to help with the legalize_signature()
  functions.
2017-03-03 11:00:26 -08:00
Jakob Stoklund Olesen
cb3e503f07 Use ISA information to display function signatures.
The argument locations contains register unit references that we want to
display with their correct names.
2017-03-03 10:58:45 -08:00
Jakob Stoklund Olesen
00772fb6c4 Add {ValueLoc,ArgumentLoc}::display().
These functions return an object containing the necessary ISA info to
print a ValueLoc or ArgumentLoc correctly.
2017-03-03 10:56:32 -08:00
Jakob Stoklund Olesen
8c5a69eb47 Fixed for mypy 0.501.
The List and Dict types are no longer implicitly available. They must be
imported from typing.

Type annotations must appear before the doc comment in a function. Also
fix type errors in these functions that weren't detected before.
2017-03-03 09:08:28 -08:00
Davide Italiano
6d3ee32f7b [EntityList] Fix typo. No functional change. 2017-02-28 12:43:53 -08:00
Jakob Stoklund Olesen
8616db60dc Require a current Rust version.
Rust 1.12 did work at one point, but Travis is testing against the
current stable and beta releases, so that is the only versions we can
claim to support.

Fixes #51.
2017-02-27 15:03:06 -08:00
rep-nop
077f39d8da Fixes error on propagating a Result<()> with the ? operator 2017-02-26 07:50:55 -08:00
rep-nop
7edbc90d5e Ran rustfmt 2017-02-26 07:50:55 -08:00
rep-nop
9f8748ee08 Fixes formatting for settings.rs 2017-02-26 07:50:55 -08:00
rep-nop
7459fee71a Converts all try! macros to ? syntax.
Fixes #46
2017-02-26 07:50:55 -08:00
Jakob Stoklund Olesen
c8be39fa9d Add ABI annotations to function signatures.
Specify the location of arguments as well as the size of stack argument
array needed. The ABI annotations are optional, just like the value
locations.

Remove the Eq implementation for Signature which was only used by a
single parser test.
2017-02-24 13:53:46 -08:00
Jakob Stoklund Olesen
15e0822ac3 Add an ArgumentLoc data type.
This will be used to amend function signatures with ABI lowering
information.
2017-02-24 12:09:24 -08:00
Jakob Stoklund Olesen
b51cf57e39 Add a section about implementation limits.
Fix a few other minor issues with the documentation.
2017-02-24 11:08:15 -08:00
Jakob Stoklund Olesen
afd42cf9c2 Convert try! to ? in extfunc.rs 2017-02-24 10:33:08 -08:00
Angus Holder
bf26fffc92 Shortened comment to pass lint. 2017-02-23 09:22:16 -08:00
Angus Holder
a35d946bc4 Added tests, some fixes. 2017-02-23 09:22:16 -08:00
Angus Holder
0b310017b7 Lexer can now scan names, hex sequences, brackets and minus signs. 2017-02-23 09:22:16 -08:00
Jakob Stoklund Olesen
4ba5cfeed3 Add a 'regalloc' filetest command.
Run functions through the register allocator, and then filecheck.
2017-02-22 11:53:01 -08:00
Jakob Stoklund Olesen
ccda0a192c Also write out register assignments in write_instruction.
The value locations appear after the encodings:

> [R#0c,%x2]              v0 = iadd vx0, vx1
> [Iret#19]               return_reg v0
2017-02-22 11:53:01 -08:00
Jakob Stoklund Olesen
83571028d9 Add a register allocation context module.
Collect the data structures that hang around between function
compilations.

Provide a main entry point to the register allocator passes.
2017-02-22 11:53:01 -08:00
Jakob Stoklund Olesen
329e51ac4f SSA register coloring pass.
This is a bare-bones outline of the SSA coloring pass. Many features are
missing, including:

- Handling instruction operand constraints beyond simple register
  classes.
- Handling ABI requirements for function arguments and return values.
- Generating shuffle code for EBB arguments.
2017-02-22 11:53:01 -08:00
Angus Holder
2ec7412a81 Removed unnecessary documentation. 2017-02-22 10:22:08 -08:00
Angus Holder
81a6e343ad Add assertion that the NonZero optimization works on Option<Opcode>. 2017-02-22 10:22:08 -08:00
Angus Holder
75a426a812 Fix test case that I missed before. 2017-02-22 10:22:08 -08:00
Angus Holder
a4e4776087 Removed the Opcode::NotAnOpcode variant, replaced its uses with Option<Opcode>, and used the NonZero optimization to maintain the small 1-byte size of an optional Opcode. 2017-02-22 10:22:08 -08:00
Angus Holder
3d0240d244 Documentation fix for what appears to be a minor copy-paste mistake. 2017-02-22 09:33:17 -08:00
Jakob Stoklund Olesen
62334b26b4 Add return_reg encodings for RISC-V. 2017-02-21 16:29:23 -08:00
Jakob Stoklund Olesen
a7d24ab1dc Compute the controlling type variable accurately.
Some polymorphic instructions don't return the controlling type
variable, so it has to be computed from the designated operand instead.

- Add a requires_typevar_operand() method to the operand constraints
  which indicates that.
- Add a ctrl_typevar(dfg) method to InstructionData which computes the
  controlling type variable correctly, and returns VOID for monomorphic
  instructions.
- Use ctrl_typevar(dfg) to drive the level-1 encoding table lookups.
2017-02-21 16:26:19 -08:00
Jakob Stoklund Olesen
20ff2f0025 Add a return_reg instruction to the base instruction set.
Register-style return is used by all RISC architectures, so it is
natural to have a shared instruction representation.
2017-02-21 13:05:17 -08:00
Jakob Stoklund Olesen
74eb13c17a Create live ranges for dead defs.
When the liveness pass implements dead code elimination, missing live
ranges can be used to indicate unused values that it may be possible to
remove. But even then, we may have to keep dead defs around if the
instruction has side effects or other live defs.
2017-02-21 12:24:39 -08:00
Jakob Stoklund Olesen
706720eba9 Improve assertion text for missing live ranges. 2017-02-21 12:24:37 -08:00
Jakob Stoklund Olesen
fa205d049d Make the DominatorTree reusable.
Add a compute() method which can recompute a dominator tree for
different functions.

Add a dominator tree data to the cretonne::Context.
2017-02-17 13:09:41 -08:00
Jakob Stoklund Olesen
0f29fc7a52 Make the ControlFlowGraph reusable.
Move the flow graph computation into a compute method which can be
called with multiple functions.

This allows us to reuse the ControlFlowGraph memory and keep an instance
in the Context.
2017-02-17 12:20:33 -08:00
Jakob Stoklund Olesen
793b3a140a Return slices instead of &Vec references.
We Don't need to expose the internal control flow graph representation.
2017-02-17 12:05:27 -08:00
Jakob Stoklund Olesen
518d30b379 Add a compilation context struct.
This will provide main entry points for compiling functions, and it
serves as a place for keeping data structures that should be preserved
between function compilations to reduce allocator thrashing.

So far, Context is just basic scaffolding. More to be added.
2017-02-17 12:04:53 -08:00