Commit Graph

47 Commits

Author SHA1 Message Date
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
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
Andrea Canciani
a395f01b3e Fix some typos in the documentation
These were found by the spellchecker.
2017-01-27 09:51:22 -08:00
ranma42
977adddc0a Fix some typos in the Language Reference 2016-11-15 08:13:08 -08:00
Jakob Stoklund Olesen
5fa322f797 Split out instruction definitions.
- cdsl.instructions defines the Instruction class.
- base.instructions defines the base instruction set.
2016-11-08 12:33:50 -08:00
Jakob Stoklund Olesen
0b7010e367 Add glossary entries for IL and IR. 2016-11-02 09:58:02 -07:00
Benjamin Bouvier
de10910324 Fix a few typos in the docs; 2016-10-28 11:31:22 -07:00
Jakob Stoklund Olesen
2fa707bc4f Add a document comparing Cretonne and LLVM. 2016-10-27 13:41:39 -07:00
Jakob Stoklund Olesen
84172ddf98 Define live range splitting instructions.
The copy/spill/fill instructions will be used by the register allocator
for splitting live ranges. The copy instruction is also useful when
rewriting values:

If a primary value is rewritten as a secondary result, a copy
instruction can be used instead:

  a = foo x
=>
  t, vx1 = call ...
  a = copy vx1

Since a primary value must be the first value of an instruction, this
doesn't work:

  a = foo x
=>
  t, a = call ...
2016-10-20 15:34:16 -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
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
29c449f117 Add legalization helper instructions.
The isplit_lohi instruction breaks an integer into two halves. This will
typically be used to get the two halves of an `i64` value on 32-bit
CPUs.

The iconcat_lohi is the reverse operation. It reconstructs the `i64`
from the low and high bits.
2016-09-27 16:22:32 -07:00
Jakob Stoklund Olesen
d915718526 Add documentation links to all existing instructions. 2016-09-23 16:53:48 -07:00
Jakob Stoklund Olesen
686aa4ec1d Add an autoinstgroup Sphinx directive.
This directive documents an instruction group and lists all instructions
contained in the group, whether they have been documented or not.
2016-09-23 16:53:47 -07:00
Jakob Stoklund Olesen
7ec54a5a01 Add a Cretonne testing guide.
Describe the basics of Rust-level tests, and go into more detail about
the file-level tests.
2016-09-23 11:37:40 -07:00
Jakob Stoklund Olesen
f116f03327 Move entry_block() into Layout.
The single entry block in a function is simply the first block in the layout.

Remove the 'entry' keyword from the textual IL, the lexer and parser.
2016-07-22 10:06:51 -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
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
fd9f08c30f Define floating point conversion instructions. 2016-07-08 11:20:19 -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
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
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
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
b1dd4ad373 Add vector instructions.
Use derived type variables with the 'LaneOf' function.

Add u8 immediates to be used for lane indexes and bit shifts.
2016-05-20 15:36:03 -07:00
Jakob Stoklund Olesen
b44d6c6541 Implement select and vselect instructions.
This gives us the opportunity to use the AsBool derived type variables and a
Select instruction format with a non-default typevar_operand setting.
2016-05-20 15:11:17 -07:00
Jakob Stoklund Olesen
ebe224a912 Define control flow instructions.
Rename 'br' to 'jump'. We'll use jump/br to mean unconditional/conditional
control transfer respectively.
2016-05-19 09:01:40 -07:00
Jakob Stoklund Olesen
d85fda0346 Add entity references as a new operand kind.
Define known entities in the cretonne.entities module.
2016-05-18 15:31:02 -07:00
Jakob Stoklund Olesen
42364fda59 Add top-level productions to language reference. 2016-04-28 14:39:42 -07:00
Jakob Stoklund Olesen
8d0311b642 Simplify parser.
Use 'if let' instead of 'match' where it makes sense.

Use EBNF notation for the grammar rules. This simplifies repetition a lot.
2016-04-28 08:06:30 -07:00
Jakob Stoklund Olesen
043bb1aba5 Replace bool with b1, b8, b16, ...
The b1 type is an abstract boolean value. The others are concrete
representations.
2016-04-05 10:45:00 -07:00
Jakob Stoklund Olesen
79e765a183 Display quiet NaNs as 'NaN'.
This is recommended by IEEE 754-2008.

We still distinguish signaling NaNs with 'sNaN'.
2016-04-05 10:27:18 -07:00
Jakob Stoklund Olesen
5f706b0a1f Implement IEEE immediates for binary32 and binary64.
Clarify the textual encoding of floating point numbers.

Don't allow decimal floating point since conversion to/from binary can produce
rounding problems on some (buggy) systems.
2016-04-01 14:40:15 -07:00
Jakob Stoklund Olesen
e5305c249b Move constant instructions into meta.
Add new immediate types for floating point and vector immediates.
Use new immediates to define the constant value instructions in meta.

Split the fconst instruction into two: f32const and f64const. This prevents
confusion about the interpretation of 64 immediate bits when generating an f32
constant.

Add an immvector ImmediateType. This immediate type is variable length, and
provides all the bits of a SIMD vector directly.
2016-04-01 10:08:57 -07:00
Jakob Stoklund Olesen
c3233fb332 Move instruction definitions into meta.
Use the meta language to define instructions, just insert 'autoinst' references
in langref.
2016-04-01 10:08:57 -07:00
Jakob Stoklund Olesen
10903503c4 Add ImmediateType for declaring immediate operands. 2016-03-30 14:17:42 -07:00
Jakob Olesen
06f9b65e12 Add a TypeDocumenter for Cretonne types.
Use the autodoc Sphinx module to add a .. autoctontype:: directive which
generates documentation for one of the types in the cretonne.types module.
2016-02-09 06:55:53 -08:00
Jakob Olesen
f66d2a26a2 Add some more type classes. 2016-02-04 12:19:08 -08:00
Jakob Stoklund Olesen
ec7d65d8f1 Clean up the list of operations somewhat. 2016-01-22 17:30:30 -08:00
Jakob Stoklund Olesen
519fed894b Document heaps. 2016-01-22 16:48:11 -08:00
Jakob Stoklund Olesen
095190b1a7 Load, store, local variables. 2016-01-22 15:47:15 -08:00
Jakob Stoklund Olesen
43b4f7f4e7 Expand on control flow and direct function calls.
Define the syntax for function signatures.
2016-01-22 13:47:53 -08:00
Jakob Stoklund Olesen
74eb6ce901 Clarify local SSA form.
Rename 'local' to 'stack_slot'.
2016-01-22 12:13:38 -08:00
Jakob Stoklund Olesen
45caa52622 Document control flow instructions. 2016-01-21 17:15:20 -08:00
Jakob Stoklund Olesen
a3f97e4d1f Switch SIMD type spelling to i32x4.
Add support for 'type variables' in type directives.
2016-01-21 16:39:45 -08:00
Jakob Stoklund Olesen
401afdc48c Update language reference.
Add a glossary and explain the overall shape of a Cretonne function.
2016-01-21 14:25:16 -08:00
Jakob Olesen
2b2b79dcf8 Add langref example 2016-01-21 11:46:30 -08:00
Jakob Olesen
b5ee157d46 Begin the intermediate language reference. 2016-01-19 19:54:33 -08:00