Commit Graph

101 Commits

Author SHA1 Message Date
Jakub Krauz
bab3c73100 Put arm32 backend behind experimental_arm32 flag 2020-09-22 12:53:14 +02:00
bjorn3
45ccc6940e Fix Switch for 128bit integers 2020-09-21 14:50:59 +02:00
bjorn3
f1fdd5764a Limit jump tables to 32bit in Switch
This is the maximum size supported by the x64 backend
2020-09-08 15:00:24 +02:00
Chris Fallin
1d09c8e46b Merge pull request #1939 from bjorn3/128bit_switch
Fix Switch for 128bit integers
2020-07-14 11:16:33 -07:00
bjorn3
88a84e90ef Fix Switch for 128bit integers 2020-07-14 18:07:52 +02:00
Nick Fitzgerald
a2f4202800 cranelift-frontend: Add the FunctionBuilder::insert_block_after method 2020-06-30 12:00:57 -07:00
Nick Fitzgerald
8c5f59c0cf wasmtime: Implement table.get and table.set
These instructions have fast, inline JIT paths for the common cases, and only
call out to host VM functions for the slow paths. This required some changes to
`cranelift-wasm`'s `FuncEnvironment`: instead of taking a `FuncCursor` to insert
an instruction sequence within the current basic block,
`FuncEnvironment::translate_table_{get,set}` now take a `&mut FunctionBuilder`
so that they can create whole new basic blocks. This is necessary for
implementing GC read/write barriers that involve branching (e.g. checking for
null, or whether a store buffer is at capacity).

Furthermore, it required that the `load`, `load_complex`, and `store`
instructions handle loading and storing through an `r{32,64}` rather than just
`i{32,64}` addresses. This involved making `r{32,64}` types acceptable
instantiations of the `iAddr` type variable, plus a few new instruction
encodings.

Part of #929
2020-06-30 12:00:57 -07:00
bjorn3
eeb1e141ba Add some assertions to cranelift_frontend 2020-05-26 10:17:08 +02:00
teapotd
8ee8c322ae Seal blocks created by cranelift_frontend::Switch 2020-04-29 11:42:41 -07:00
teapotd
11497a5207 Ignore already sealed blocks in seal_all_blocks 2020-04-29 11:42:41 -07:00
Andrew Brown
0672d1dc0f Declare constants in the function preamble
This allows us to give names to constants in the constant pool and then use these names in the function body. The original behavior, specifiying the constant value as an instruction immediate, is still supported as a shortcut but some filetests had to change since the canonical way of printing the CLIF constants is now in the preamble.
2020-04-17 11:59:47 -07:00
bjorn3
bc462404b3 [cranelift-frontend] Fix emit_zero for vectors (#1428)
* Fix emit_zero for vectors
* Add undef_vector_vars frontend test
* Remove unused import
2020-03-30 13:01:14 -07:00
Y-Nak
bcddce5fe0 Simplify ssa builder (#1340)
* Simplify SSABuilder with basic block

* Simplify FunctionBuilder with basic block

* Update SSABuilder test

* Update SSABuilder doc
2020-03-20 11:54:44 -07:00
Ryan Hunt
07f335dca6 Rename 'an block' to 'a block'
Missed this in the automatic rename of 'Ebb' to 'Block'.
2020-03-03 13:21:13 -06:00
bjorn3
45cc95e60e Merge emit_small_memcpy and emit_small_memmove (#1301)
* Merge emit_small_memcpy and emit_small_memmove

* Fix typo
2020-02-14 16:44:40 -06:00
Ryan Hunt
832666c45e Mass rename Ebb and relatives to Block (#1365)
* Manually rename BasicBlock to BlockPredecessor

BasicBlock is a pair of (Ebb, Inst) that is used to represent the
basic block subcomponent of an Ebb that is a predecessor to an Ebb.

Eventually we will be able to remove this struct, but for now it
makes sense to give it a non-conflicting name so that we can start
to transition Ebb to represent a basic block.

I have not updated any comments that refer to BasicBlock, as
eventually we will remove BlockPredecessor and replace with Block,
which is a basic block, so the comments will become correct.

* Manually rename SSABuilder block types to avoid conflict

SSABuilder has its own Block and BlockData types. These along with
associated identifier will cause conflicts in a later commit, so
they are renamed to be more verbose here.

* Automatically rename 'Ebb' to 'Block' in *.rs

* Automatically rename 'EBB' to 'block' in *.rs

* Automatically rename 'ebb' to 'block' in *.rs

* Automatically rename 'extended basic block' to 'basic block' in *.rs

* Automatically rename 'an basic block' to 'a basic block' in *.rs

* Manually update comment for `Block`

`Block`'s wikipedia article required an update.

* Automatically rename 'an `Block`' to 'a `Block`' in *.rs

* Automatically rename 'extended_basic_block' to 'basic_block' in *.rs

* Automatically rename 'ebb' to 'block' in *.clif

* Manually rename clif constant that contains 'ebb' as substring to avoid conflict

* Automatically rename filecheck uses of 'EBB' to 'BB'

'regex: EBB' -> 'regex: BB'
'$EBB' -> '$BB'

* Automatically rename 'EBB' 'Ebb' to 'block' in *.clif

* Automatically rename 'an block' to 'a block' in *.clif

* Fix broken testcase when function name length increases

Test function names are limited to 16 characters. This causes
the new longer name to be truncated and fail a filecheck test. An
outdated comment was also fixed.
2020-02-07 10:46:47 -06:00
Ryan Hunt
c360007b19 Drop 'basic-blocks' feature (#1363)
* All: Drop 'basic-blocks' feature

This makes it so that 'basic-blocks' cannot be disabled and we can
start assuming it everywhere.

* Tests: Replace non-bb filetests with bb version

* Tests: Adapt solver-fixedconflict filetests to use basic blocks
2020-01-23 22:36:06 -07:00
Joshua Nelson
175b9641e0 frontend: Add entries() API for Switch (#1358) 2020-01-20 14:29:05 +01:00
Andrew Brown
e1d513ab4b Fix remaining clippy warnings (#1340)
* clippy: allow complex encoding function

* clippy: remove unnecessary main() function in doctest

* clippy: remove redundant `Type` suffix on LaneType enum variants

* clippy: ignore incorrect debug_assert_with_mut_call warning

* clippy: fix FDE clippy warnings
2020-01-17 14:03:30 -06:00
Oliver Scherer
e1b0f1f990 Use less vague language 2019-11-04 12:46:58 +01:00
Oliver Scherer @ Cosmian
9903c75f82 Update variable.rs 2019-11-04 12:46:58 +01:00
Oliver Scherer @ Cosmian
d8fa5dcb29 Update outdated documentation 2019-11-04 12:46:58 +01:00
Peter Huene
9f506692c2 Fix clippy warnings.
This commit fixes the current set of (stable) clippy warnings in the repo.
2019-10-24 17:20:12 -07:00
Sean Stangl
46b44ad82d Increase legibility of the SSABuilder (#1142) 2019-10-17 11:30:38 -06:00
bjorn3
bb8fa40ef0 Rustfmt 2019-10-02 11:50:44 -07:00
bjorn3
c274d81b5b Fix it 2019-10-02 11:50:44 -07:00
bjorn3
1a99ac6b4a Always use extern crate std in cranelift-frontend 2019-10-02 11:50:44 -07:00
Joshua Nelson
a1f6457e8a Allow building without std (#1069)
Closes https://github.com/CraneStation/cranelift/issues/1067
2019-09-26 18:00:03 +02:00
Erin Power
5426e42a27 Revert "Remove FunctionBuilderContext from API, and change FunctionBuilder API"
This reverts commit 39e638af99dbe6537bc935bfb1a74669b62877b3.
2019-09-17 08:58:46 +02:00
Wander Lairson Costa
a51606bfeb [frontend] Add message for pristine assertion violation
After we add any instruction to an EBB, we can't add EBB parameters
anymore. There is an assertion in `append_ebb_param` to detect this
error, but the backtrace generated doesn't give any hint what happened.

We add an error message to the assertion so the user can understand what
is wrong.

fixes #1003
2019-09-16 14:55:19 +02:00
Nicolas B. Pierron
abb157315b Basic Blocks: Fix frontend::sample_function test case. (#1007) 2019-09-10 15:02:11 -06:00
Julian Seward
c6a4c60a0f EbbHeaderBlockData::predecessors: use SmallVec instead of Vec
Allocations associated with pushes to EbbHeaderBlockData::predecessors account
for 4.9% of all heap allocation (calls) in CL.  This change avoids almost all
of them by changing it to be a SmallVec<[PredBlock; 4]>.  Dynamic instruction
count falls by 0.15%.
2019-09-09 11:37:04 +02:00
Aaron Power
8fd1128990 Remove FunctionBuilderContext from API, and change FunctionBuilder API 2019-09-07 14:43:07 -07:00
Nicolas B. Pierron
1c5711c12b Basic Block: Fix IR builder library example. (#989) 2019-09-06 14:27:02 -06:00
Nicolas B. Pierron
891944dba1 Generate basic-blocks instead of Ebb in frontend::switch. (#981) 2019-09-06 14:07:06 -06:00
Pat Hickey
89d741f8ae upgrade to target-lexicon 0.8.0
* the target-lexicon crate no longer has or needs the std feature
  in cargo, so we can delete all default-features=false, any mentions
  of its std feature, and the nostd configs in many lib.rs files
* the representation of arm architectures has changed, so some case
  statements needed refactoring
2019-09-04 15:12:17 -07:00
Joshua Nelson
bf77985e25 Fix broken links using rustdoc nightly
Uses cross-crate documentation links so that rustdoc does the hard work
of making relative links for us.

Requires nightly version of rustdoc in order to generate links based on
path names, see
https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
for details.
2019-08-19 11:48:37 +02:00
Carmen Kwan
19257f80c1 Add reference types R32 and R64
-Add resumable_trap, safepoint, isnull, and null instructions
-Add Stackmap struct and StackmapSink trait

Co-authored-by: Mir Ahmed <mirahmed753@gmail.com>
Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2019-08-16 11:35:16 -07:00
Sean Stangl
70c91f913d Produce more helpful basic block errors in cranelift-frontend.
Previously, the error just notified that there was a failure.
The new-style error says specifically in which ebb, on which instruction.
2019-07-23 07:58:57 -06:00
Sean Stangl
ffa9d315e6 Add some comments to the frontend code. 2019-07-23 07:58:57 -06:00
Sean Stangl
8efaeec502 Verify that FunctionBuilder blocks are basic blocks in debug mode (#857)
To use, enable the "basic-blocks" feature on cranelift-frontend.
2019-07-19 09:52:05 -06:00
Mark McCaskey
f856b124fd Use Default trait for Position and DisplayFunctionAnnotations (#843) 2019-07-12 11:21:00 +02:00
Benjamin Bouvier
d7d48d5cc6 Add the dyn keyword before trait objects; 2019-06-24 11:42:26 +02:00
bjorn3
c27b0a0c3e Add note about needing to call func.dfg.collect_debug_info for set_val_label to have any effect 2019-05-15 09:26:16 +02:00
Yury Delendik
8f95c51730 Reconstruct locations of the original source variable 2019-05-09 00:35:44 -07:00
bjorn3
45efbf7973 Optimize switch codegen and improve docs (#712) 2019-03-26 11:04:02 +01:00
bjorn3
b4608c02c7 Fixed test 2019-03-05 06:19:46 -08:00
Dan Gohman
395de457c0 Add more tests for emit_small_memset and emit_small_memcpy. (#1) 2019-03-05 06:19:46 -08:00
bjorn3
2d2b041766 Fix emit_small_memset 2019-03-05 06:19:46 -08:00
Rett Berg
084722a118 fix typos in cranelift-frontend/src/lib.rs 2019-02-06 20:31:01 -08:00