-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add new MachInst backend and ARM64 support.
#1494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
875d275
ARM64 backend, part 1 / 11: misc changes to existing code.
cfallin f80fe94
ARM64 backend, part 2 / 11: remove old ARM64 backend.
cfallin d835742
ARM64 backend, part 3 / 11: MachInst infrastructure.
cfallin 548ce94
ARM64 backend, part 4 / 11: ARM64 instruction definitions.
cfallin 0f725a3
ARM64 backend, part 5 / 11: ABI implementation.
cfallin aaa5a12
ARM64 backend, part 6 / 11: CLIF -> VCode<Inst> lowering.
cfallin a0e629e
ARM64 backend, part 7 / 11: Arm64Backend toplevel.
cfallin 60990ae
ARM64 backend, part 8 / 11: integration.
cfallin bab0c79
ARM64 backend, part 9 / 11: wasmtime support.
cfallin 402303f
ARM64 backend, part 10 / 11: filetest support for VCode tests.
cfallin 3de504c
ARM64 backend, part 11 / 11: filetests for ARM64 VCode.
cfallin 48cf2c2
Address review comments:
cfallin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| //! Instruction predicates/properties, shared by various analyses. | ||
|
|
||
| use crate::ir::{DataFlowGraph, Function, Inst, InstructionData, Opcode}; | ||
| use cranelift_entity::EntityRef; | ||
|
|
||
| /// Preserve instructions with used result values. | ||
| pub fn any_inst_results_used(inst: Inst, live: &[bool], dfg: &DataFlowGraph) -> bool { | ||
| dfg.inst_results(inst).iter().any(|v| live[v.index()]) | ||
| } | ||
|
|
||
| /// Test whether the given opcode is unsafe to even consider as side-effect-free. | ||
| fn trivially_has_side_effects(opcode: Opcode) -> bool { | ||
| opcode.is_call() | ||
| || opcode.is_branch() | ||
| || opcode.is_terminator() | ||
| || opcode.is_return() | ||
| || opcode.can_trap() | ||
| || opcode.other_side_effects() | ||
| || opcode.can_store() | ||
| } | ||
|
|
||
| /// Load instructions without the `notrap` flag are defined to trap when | ||
| /// operating on inaccessible memory, so we can't treat them as side-effect-free even if the loaded | ||
| /// value is unused. | ||
| fn is_load_with_defined_trapping(opcode: Opcode, data: &InstructionData) -> bool { | ||
| if !opcode.can_load() { | ||
| return false; | ||
| } | ||
| match *data { | ||
| InstructionData::StackLoad { .. } => false, | ||
| InstructionData::Load { flags, .. } => !flags.notrap(), | ||
| _ => true, | ||
| } | ||
| } | ||
|
|
||
| /// Does the given instruction have any side-effect that would preclude it from being removed when | ||
| /// its value is unused? | ||
| pub fn has_side_effect(func: &Function, inst: Inst) -> bool { | ||
| let data = &func.dfg[inst]; | ||
| let opcode = data.opcode(); | ||
| trivially_has_side_effects(opcode) || is_load_with_defined_trapping(opcode, data) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.