Commit Graph

8 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
6ba604125d Add bitwise ops that invert the second operand.
ARM has all of these as scalar integer instructions. Intel has band_not
in SSE and as a scalar in BMI1.

Add the trivial legalization patterns that use a bnot instruction.
2017-07-20 11:20:06 -07:00
Aleksey Kuznetsov
8b484b1c77 Binary function names (#91)
* Function names should start with %

* Create FunctionName from string

* Implement displaying of FunctionName as %nnnn with fallback to #xxxx

* Run rustfmt and fix FunctionName::with_string in parser

* Implement FunctionName::new as a generic function

* Binary function names should start with #

* Implement NameRepr for function name

* Fix examples in docs to reflect that function names start with %

* Rebase and fix filecheck tests
2017-06-10 10:30:37 -07:00
Jakob Stoklund Olesen
3ae0fe6e2b Avoid creating aliases when expanding legalizer patterns.
Now that we can detach and reuse all values, there is no longer a need
to create a lot of alias values during pattern expansion. Instead, reuse
the values from the source pattern when emitting instructions in the
destination pattern.

If a destination instruction produces the exact same values as a source
instruction, simply leave the values attached and replace the
instruction it. Otherwise, detach the source values, reuse them in the
expansion, and remove the source instruction afterwards.
2017-04-13 09:30:21 -07:00
Jakob Stoklund Olesen
23ae70cacf Flatten the Value reference representation.
All values are now references into the value table, so drop the
distinction between direct and table values. Direct values don't exist
any more.

Also remove the parser support for the 'vxNN' syntax. Only 'vNN' values
can be parsed now.
2017-04-12 14:45:22 -07:00
Jakob Stoklund Olesen
13b0046ed7 Syntax tweak: Omit comma after an initial enum immediate.
This affects the comparison instructions which now read "icmp ult a, b".
This mimics LLVM's style and makes it simpler to add instruction flags
in the future, such as "load v1" -> "load aligned v1".

These enumerated operands and flags feel like opcode modifiers rather
than value operands, so displaying them differently makes sense.

Value and numeric operands are still comma separated.
2017-04-10 10:28:37 -07:00
Jakob Stoklund Olesen
d76280afba Add expansion patterns for large immediates.
Expand foo_imm into iconst + foo.
2016-11-10 15:55:54 -08:00
Jakob Stoklund Olesen
6f1a60366f Create value aliases when necessary.
If a secondary value in the source pattern becomes a primary value in
the destination pattern, it is not possible to overwrite the definition
of the source value.

Instead, change the original source value to an alias to the new promary
value.
2016-11-04 15:31:23 -07:00
Jakob Stoklund Olesen
2b8732ae13 Advance the insertion cursor after replacinf an instruction.
When expanding iadd_cout, the original instruction is replaced with an
iadd, and an icmp is inserted after the iadd.

Make sure we advance the insertion position after replacing iadd_cout so
the icmp gets inserted *after* iadd.
2016-11-04 11:56:21 -07:00