Update to rustfmt-preview (#348)
* Update to rustfmt-preview. * Run "cargo fmt --all" with rustfmt 0.4.1. rustfmt 0.4.1 is the latest release of rustfmt-preview available on the stable channel. * Fix a long line that rustfmt 0.4.1 can't handle. * Remove unneeded commas left behind by rustfmt.
This commit is contained in:
@@ -166,9 +166,9 @@ impl DataFlowGraph {
|
||||
/// Get the type of a value.
|
||||
pub fn value_type(&self, v: Value) -> Type {
|
||||
match self.values[v] {
|
||||
ValueData::Inst { ty, .. } |
|
||||
ValueData::Param { ty, .. } |
|
||||
ValueData::Alias { ty, .. } => ty,
|
||||
ValueData::Inst { ty, .. }
|
||||
| ValueData::Param { ty, .. }
|
||||
| ValueData::Alias { ty, .. } => ty,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,11 +235,9 @@ impl DataFlowGraph {
|
||||
// This also avoids the creation of loops.
|
||||
let original = self.resolve_aliases(src);
|
||||
debug_assert_ne!(
|
||||
dest,
|
||||
original,
|
||||
dest, original,
|
||||
"Aliasing {} to {} would create a loop",
|
||||
dest,
|
||||
src
|
||||
dest, src
|
||||
);
|
||||
let ty = self.value_type(original);
|
||||
debug_assert_eq!(
|
||||
@@ -267,8 +265,7 @@ impl DataFlowGraph {
|
||||
///
|
||||
pub fn replace_with_aliases(&mut self, dest_inst: Inst, src_inst: Inst) {
|
||||
debug_assert_ne!(
|
||||
dest_inst,
|
||||
src_inst,
|
||||
dest_inst, src_inst,
|
||||
"Replacing {} with itself would create a loop",
|
||||
dest_inst
|
||||
);
|
||||
@@ -342,8 +339,7 @@ impl ValueDef {
|
||||
/// this value.
|
||||
pub fn num(self) -> usize {
|
||||
match self {
|
||||
ValueDef::Result(_, n) |
|
||||
ValueDef::Param(_, n) => n,
|
||||
ValueDef::Result(_, n) | ValueDef::Param(_, n) => n,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,9 +570,9 @@ impl DataFlowGraph {
|
||||
///
|
||||
/// Panics if the instruction doesn't support arguments.
|
||||
pub fn append_inst_arg(&mut self, inst: Inst, new_arg: Value) {
|
||||
let mut branch_values = self.insts[inst].take_value_list().expect(
|
||||
"the instruction doesn't have value arguments",
|
||||
);
|
||||
let mut branch_values = self.insts[inst]
|
||||
.take_value_list()
|
||||
.expect("the instruction doesn't have value arguments");
|
||||
branch_values.push(new_arg, &mut self.value_lists);
|
||||
self.insts[inst].put_value_list(branch_values)
|
||||
}
|
||||
@@ -585,9 +581,9 @@ impl DataFlowGraph {
|
||||
///
|
||||
/// This function panics if the instruction doesn't have any result.
|
||||
pub fn first_result(&self, inst: Inst) -> Value {
|
||||
self.results[inst].first(&self.value_lists).expect(
|
||||
"Instruction has no results",
|
||||
)
|
||||
self.results[inst]
|
||||
.first(&self.value_lists)
|
||||
.expect("Instruction has no results")
|
||||
}
|
||||
|
||||
/// Test if `inst` has any result values currently.
|
||||
@@ -653,9 +649,11 @@ impl DataFlowGraph {
|
||||
} else if constraints.requires_typevar_operand() {
|
||||
// Not all instruction formats have a designated operand, but in that case
|
||||
// `requires_typevar_operand()` should never be true.
|
||||
self.value_type(self[inst].typevar_operand(&self.value_lists).expect(
|
||||
"Instruction format doesn't have a designated operand, bad opcode.",
|
||||
))
|
||||
self.value_type(
|
||||
self[inst]
|
||||
.typevar_operand(&self.value_lists)
|
||||
.expect("Instruction format doesn't have a designated operand, bad opcode."),
|
||||
)
|
||||
} else {
|
||||
self.value_type(self.first_result(inst))
|
||||
}
|
||||
@@ -721,13 +719,16 @@ impl DataFlowGraph {
|
||||
} else {
|
||||
panic!("{} must be an EBB parameter", val);
|
||||
};
|
||||
self.ebbs[ebb].params.swap_remove(
|
||||
num as usize,
|
||||
&mut self.value_lists,
|
||||
);
|
||||
self.ebbs[ebb]
|
||||
.params
|
||||
.swap_remove(num as usize, &mut self.value_lists);
|
||||
if let Some(last_arg_val) = self.ebbs[ebb].params.get(num as usize, &self.value_lists) {
|
||||
// We update the position of the old last arg.
|
||||
if let ValueData::Param { num: ref mut old_num, .. } = self.values[last_arg_val] {
|
||||
if let ValueData::Param {
|
||||
num: ref mut old_num,
|
||||
..
|
||||
} = self.values[last_arg_val]
|
||||
{
|
||||
*old_num = num;
|
||||
} else {
|
||||
panic!("{} should be an Ebb parameter", last_arg_val);
|
||||
@@ -744,27 +745,25 @@ impl DataFlowGraph {
|
||||
} else {
|
||||
panic!("{} must be an EBB parameter", val);
|
||||
};
|
||||
self.ebbs[ebb].params.remove(
|
||||
num as usize,
|
||||
&mut self.value_lists,
|
||||
);
|
||||
self.ebbs[ebb]
|
||||
.params
|
||||
.remove(num as usize, &mut self.value_lists);
|
||||
for index in num..(self.num_ebb_params(ebb) as u16) {
|
||||
match self.values[self.ebbs[ebb]
|
||||
.params
|
||||
.get(index as usize, &self.value_lists)
|
||||
.unwrap()] {
|
||||
.params
|
||||
.get(index as usize, &self.value_lists)
|
||||
.unwrap()]
|
||||
{
|
||||
ValueData::Param { ref mut num, .. } => {
|
||||
*num -= 1;
|
||||
}
|
||||
_ => {
|
||||
panic!(
|
||||
"{} must be an EBB parameter",
|
||||
self.ebbs[ebb]
|
||||
.params
|
||||
.get(index as usize, &self.value_lists)
|
||||
.unwrap()
|
||||
)
|
||||
}
|
||||
_ => panic!(
|
||||
"{} must be an EBB parameter",
|
||||
self.ebbs[ebb]
|
||||
.params
|
||||
.get(index as usize, &self.value_lists)
|
||||
.unwrap()
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -835,7 +834,9 @@ struct EbbData {
|
||||
|
||||
impl EbbData {
|
||||
fn new() -> Self {
|
||||
Self { params: ValueList::new() }
|
||||
Self {
|
||||
params: ValueList::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,9 +879,9 @@ impl DataFlowGraph {
|
||||
"this function is only for assigning types to previously invalid values"
|
||||
);
|
||||
match self.values[v] {
|
||||
ValueData::Inst { ref mut ty, .. } |
|
||||
ValueData::Param { ref mut ty, .. } |
|
||||
ValueData::Alias { ref mut ty, .. } => *ty = t,
|
||||
ValueData::Inst { ref mut ty, .. }
|
||||
| ValueData::Param { ref mut ty, .. }
|
||||
| ValueData::Alias { ref mut ty, .. } => *ty = t,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,11 @@ impl Ebb {
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Self> {
|
||||
if n < u32::MAX { Some(Ebb(n)) } else { None }
|
||||
if n < u32::MAX {
|
||||
Some(Ebb(n))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +128,11 @@ impl FuncRef {
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Self> {
|
||||
if n < u32::MAX { Some(FuncRef(n)) } else { None }
|
||||
if n < u32::MAX {
|
||||
Some(FuncRef(n))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +146,11 @@ impl SigRef {
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Self> {
|
||||
if n < u32::MAX { Some(SigRef(n)) } else { None }
|
||||
if n < u32::MAX {
|
||||
Some(SigRef(n))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +164,11 @@ impl Heap {
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Self> {
|
||||
if n < u32::MAX { Some(Heap(n)) } else { None }
|
||||
if n < u32::MAX {
|
||||
Some(Heap(n))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -384,8 +384,7 @@ mod tests {
|
||||
CallConv::SystemV,
|
||||
CallConv::WindowsFastcall,
|
||||
CallConv::Baldrdash,
|
||||
]
|
||||
{
|
||||
] {
|
||||
assert_eq!(Ok(cc), cc.to_string().parse())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use ir::{DataFlowGraph, ExternalName, Layout, Signature};
|
||||
use ir::{Ebb, ExtFuncData, FuncRef, GlobalVar, GlobalVarData, Heap, HeapData, JumpTable,
|
||||
JumpTableData, SigRef, StackSlot, StackSlotData};
|
||||
use ir::{EbbOffsets, InstEncodings, JumpTables, SourceLocs, StackSlots, ValueLocations};
|
||||
use isa::{EncInfo, Legalize, TargetIsa, Encoding};
|
||||
use isa::{EncInfo, Encoding, Legalize, TargetIsa};
|
||||
use settings::CallConv;
|
||||
use std::fmt;
|
||||
use write::write_function;
|
||||
@@ -151,9 +151,9 @@ impl Function {
|
||||
/// Returns the value of the last `purpose` parameter, or `None` if no such parameter exists.
|
||||
pub fn special_param(&self, purpose: ir::ArgumentPurpose) -> Option<ir::Value> {
|
||||
let entry = self.layout.entry_block().expect("Function is empty");
|
||||
self.signature.special_param_index(purpose).map(|i| {
|
||||
self.dfg.ebb_params(entry)[i]
|
||||
})
|
||||
self.signature
|
||||
.special_param_index(purpose)
|
||||
.map(|i| self.dfg.ebb_params(entry)[i])
|
||||
}
|
||||
|
||||
/// Get an iterator over the instructions in `ebb`, including offsets and encoded instruction
|
||||
|
||||
@@ -192,10 +192,12 @@ impl FromStr for Uimm32 {
|
||||
|
||||
// Parse a decimal or hexadecimal `Uimm32`, formatted as above.
|
||||
fn from_str(s: &str) -> Result<Self, &'static str> {
|
||||
parse_i64(s).and_then(|x| if 0 <= x && x <= i64::from(u32::MAX) {
|
||||
Ok(Uimm32(x as u32))
|
||||
} else {
|
||||
Err("Uimm32 out of range")
|
||||
parse_i64(s).and_then(|x| {
|
||||
if 0 <= x && x <= i64::from(u32::MAX) {
|
||||
Ok(Uimm32(x as u32))
|
||||
} else {
|
||||
Err("Uimm32 out of range")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -259,12 +261,12 @@ impl FromStr for Offset32 {
|
||||
if !(s.starts_with('-') || s.starts_with('+')) {
|
||||
return Err("Offset must begin with sign");
|
||||
}
|
||||
parse_i64(s).and_then(|x| if i64::from(i32::MIN) <= x &&
|
||||
x <= i64::from(i32::MAX)
|
||||
{
|
||||
Ok(Self::new(x as i32))
|
||||
} else {
|
||||
Err("Offset out of range")
|
||||
parse_i64(s).and_then(|x| {
|
||||
if i64::from(i32::MIN) <= x && x <= i64::from(i32::MAX) {
|
||||
Ok(Self::new(x as i32))
|
||||
} else {
|
||||
Err("Offset out of range")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -447,18 +449,16 @@ fn parse_float(s: &str, w: u8, t: u8) -> Result<u64, &'static str> {
|
||||
Err(_) => return Err("Bad exponent"),
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
match ch.to_digit(16) {
|
||||
Some(digit) => {
|
||||
digits += 1;
|
||||
if digits > 16 {
|
||||
return Err("Too many digits");
|
||||
}
|
||||
significand = (significand << 4) | u64::from(digit);
|
||||
_ => match ch.to_digit(16) {
|
||||
Some(digit) => {
|
||||
digits += 1;
|
||||
if digits > 16 {
|
||||
return Err("Too many digits");
|
||||
}
|
||||
None => return Err("Invalid character"),
|
||||
significand = (significand << 4) | u64::from(digit);
|
||||
}
|
||||
}
|
||||
None => return Err("Invalid character"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,9 +546,7 @@ impl Ieee32 {
|
||||
let n = n.into();
|
||||
debug_assert!(n < 32);
|
||||
debug_assert!(23 + 1 - n < 32);
|
||||
Self::with_bits(
|
||||
(1u32 << (32 - 1)) | Self::pow2(n - 1).0 | (1u32 << (23 + 1 - n)),
|
||||
)
|
||||
Self::with_bits((1u32 << (32 - 1)) | Self::pow2(n - 1).0 | (1u32 << (23 + 1 - n)))
|
||||
}
|
||||
|
||||
/// Return self negated.
|
||||
@@ -609,9 +607,7 @@ impl Ieee64 {
|
||||
let n = n.into();
|
||||
debug_assert!(n < 64);
|
||||
debug_assert!(52 + 1 - n < 64);
|
||||
Self::with_bits(
|
||||
(1u64 << (64 - 1)) | Self::pow2(n - 1).0 | (1u64 << (52 + 1 - n)),
|
||||
)
|
||||
Self::with_bits((1u64 << (64 - 1)) | Self::pow2(n - 1).0 | (1u64 << (52 + 1 - n)))
|
||||
}
|
||||
|
||||
/// Return self negated.
|
||||
|
||||
@@ -178,13 +178,13 @@ impl InstructionData {
|
||||
destination,
|
||||
ref args,
|
||||
..
|
||||
} |
|
||||
InstructionData::BranchFloat {
|
||||
}
|
||||
| InstructionData::BranchFloat {
|
||||
destination,
|
||||
ref args,
|
||||
..
|
||||
} |
|
||||
InstructionData::Branch {
|
||||
}
|
||||
| InstructionData::Branch {
|
||||
destination,
|
||||
ref args,
|
||||
..
|
||||
@@ -208,11 +208,11 @@ impl InstructionData {
|
||||
/// Multi-destination branches like `br_table` return `None`.
|
||||
pub fn branch_destination(&self) -> Option<Ebb> {
|
||||
match *self {
|
||||
InstructionData::Jump { destination, .. } |
|
||||
InstructionData::Branch { destination, .. } |
|
||||
InstructionData::BranchInt { destination, .. } |
|
||||
InstructionData::BranchFloat { destination, .. } |
|
||||
InstructionData::BranchIcmp { destination, .. } => Some(destination),
|
||||
InstructionData::Jump { destination, .. }
|
||||
| InstructionData::Branch { destination, .. }
|
||||
| InstructionData::BranchInt { destination, .. }
|
||||
| InstructionData::BranchFloat { destination, .. }
|
||||
| InstructionData::BranchIcmp { destination, .. } => Some(destination),
|
||||
InstructionData::BranchTable { .. } => None,
|
||||
_ => {
|
||||
debug_assert!(!self.opcode().is_branch());
|
||||
@@ -227,11 +227,26 @@ impl InstructionData {
|
||||
/// Multi-destination branches like `br_table` return `None`.
|
||||
pub fn branch_destination_mut(&mut self) -> Option<&mut Ebb> {
|
||||
match *self {
|
||||
InstructionData::Jump { ref mut destination, .. } |
|
||||
InstructionData::Branch { ref mut destination, .. } |
|
||||
InstructionData::BranchInt { ref mut destination, .. } |
|
||||
InstructionData::BranchFloat { ref mut destination, .. } |
|
||||
InstructionData::BranchIcmp { ref mut destination, .. } => Some(destination),
|
||||
InstructionData::Jump {
|
||||
ref mut destination,
|
||||
..
|
||||
}
|
||||
| InstructionData::Branch {
|
||||
ref mut destination,
|
||||
..
|
||||
}
|
||||
| InstructionData::BranchInt {
|
||||
ref mut destination,
|
||||
..
|
||||
}
|
||||
| InstructionData::BranchFloat {
|
||||
ref mut destination,
|
||||
..
|
||||
}
|
||||
| InstructionData::BranchIcmp {
|
||||
ref mut destination,
|
||||
..
|
||||
} => Some(destination),
|
||||
InstructionData::BranchTable { .. } => None,
|
||||
_ => {
|
||||
debug_assert!(!self.opcode().is_branch());
|
||||
@@ -245,12 +260,12 @@ impl InstructionData {
|
||||
/// Any instruction that can call another function reveals its call signature here.
|
||||
pub fn analyze_call<'a>(&'a self, pool: &'a ValueListPool) -> CallInfo<'a> {
|
||||
match *self {
|
||||
InstructionData::Call { func_ref, ref args, .. } => {
|
||||
CallInfo::Direct(func_ref, args.as_slice(pool))
|
||||
}
|
||||
InstructionData::CallIndirect { sig_ref, ref args, .. } => {
|
||||
CallInfo::Indirect(sig_ref, &args.as_slice(pool)[1..])
|
||||
}
|
||||
InstructionData::Call {
|
||||
func_ref, ref args, ..
|
||||
} => CallInfo::Direct(func_ref, args.as_slice(pool)),
|
||||
InstructionData::CallIndirect {
|
||||
sig_ref, ref args, ..
|
||||
} => CallInfo::Indirect(sig_ref, &args.as_slice(pool)[1..]),
|
||||
_ => {
|
||||
debug_assert!(!self.opcode().is_call());
|
||||
CallInfo::NotACall
|
||||
@@ -512,12 +527,16 @@ impl OperandConstraint {
|
||||
LaneOf => Bound(ctrl_type.lane_type()),
|
||||
AsBool => Bound(ctrl_type.as_bool()),
|
||||
HalfWidth => Bound(ctrl_type.half_width().expect("invalid type for half_width")),
|
||||
DoubleWidth => Bound(ctrl_type.double_width().expect(
|
||||
"invalid type for double_width",
|
||||
)),
|
||||
HalfVector => Bound(ctrl_type.half_vector().expect(
|
||||
"invalid type for half_vector",
|
||||
)),
|
||||
DoubleWidth => Bound(
|
||||
ctrl_type
|
||||
.double_width()
|
||||
.expect("invalid type for double_width"),
|
||||
),
|
||||
HalfVector => Bound(
|
||||
ctrl_type
|
||||
.half_vector()
|
||||
.expect("invalid type for half_vector"),
|
||||
),
|
||||
DoubleVector => Bound(ctrl_type.by(2).expect("invalid type for double_vector")),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ impl JumpTableData {
|
||||
|
||||
/// Checks if any of the entries branch to `ebb`.
|
||||
pub fn branches_to(&self, ebb: Ebb) -> bool {
|
||||
self.table.iter().any(|target_ebb| {
|
||||
target_ebb.expand() == Some(ebb)
|
||||
})
|
||||
self.table
|
||||
.iter()
|
||||
.any(|target_ebb| target_ebb.expand() == Some(ebb))
|
||||
}
|
||||
|
||||
/// Access the whole table as a mutable slice.
|
||||
|
||||
@@ -90,7 +90,11 @@ fn midpoint(a: SequenceNumber, b: SequenceNumber) -> Option<SequenceNumber> {
|
||||
debug_assert!(a < b);
|
||||
// Avoid integer overflow.
|
||||
let m = a + (b - a) / 2;
|
||||
if m > a { Some(m) } else { None }
|
||||
if m > a {
|
||||
Some(m)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -178,9 +182,8 @@ impl Layout {
|
||||
/// Assign a valid sequence number to `inst` such that the numbers are still monotonic. This may
|
||||
/// require renumbering.
|
||||
fn assign_inst_seq(&mut self, inst: Inst) {
|
||||
let ebb = self.inst_ebb(inst).expect(
|
||||
"inst must be inserted before assigning an seq",
|
||||
);
|
||||
let ebb = self.inst_ebb(inst)
|
||||
.expect("inst must be inserted before assigning an seq");
|
||||
|
||||
// Get the sequence number immediately before `inst`.
|
||||
let prev_seq = match self.insts[inst].prev.expand() {
|
||||
@@ -566,9 +569,8 @@ impl Layout {
|
||||
/// Insert `inst` before the instruction `before` in the same EBB.
|
||||
pub fn insert_inst(&mut self, inst: Inst, before: Inst) {
|
||||
debug_assert_eq!(self.inst_ebb(inst), None);
|
||||
let ebb = self.inst_ebb(before).expect(
|
||||
"Instruction before insertion point not in the layout",
|
||||
);
|
||||
let ebb = self.inst_ebb(before)
|
||||
.expect("Instruction before insertion point not in the layout");
|
||||
let after = self.insts[before].prev;
|
||||
{
|
||||
let inst_node = &mut self.insts[inst];
|
||||
@@ -641,9 +643,8 @@ impl Layout {
|
||||
/// i4
|
||||
/// ```
|
||||
pub fn split_ebb(&mut self, new_ebb: Ebb, before: Inst) {
|
||||
let old_ebb = self.inst_ebb(before).expect(
|
||||
"The `before` instruction must be in the layout",
|
||||
);
|
||||
let old_ebb = self.inst_ebb(before)
|
||||
.expect("The `before` instruction must be in the layout");
|
||||
debug_assert!(!self.is_ebb_inserted(new_ebb));
|
||||
|
||||
// Insert new_ebb after old_ebb.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Naming well-known routines in the runtime library.
|
||||
|
||||
use ir::{types, Opcode, Type, Inst, Function, FuncRef, ExternalName, Signature, AbiParam,
|
||||
ExtFuncData, ArgumentPurpose};
|
||||
use ir::{types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst,
|
||||
Opcode, Signature, Type};
|
||||
use isa::{RegUnit, TargetIsa};
|
||||
use settings::CallConv;
|
||||
use isa::{TargetIsa, RegUnit};
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
||||
@@ -82,24 +82,20 @@ impl LibCall {
|
||||
/// Returns `None` if no well-known library routine name exists for that instruction.
|
||||
pub fn for_inst(opcode: Opcode, ctrl_type: Type) -> Option<Self> {
|
||||
Some(match ctrl_type {
|
||||
types::F32 => {
|
||||
match opcode {
|
||||
Opcode::Ceil => LibCall::CeilF32,
|
||||
Opcode::Floor => LibCall::FloorF32,
|
||||
Opcode::Trunc => LibCall::TruncF32,
|
||||
Opcode::Nearest => LibCall::NearestF32,
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
types::F64 => {
|
||||
match opcode {
|
||||
Opcode::Ceil => LibCall::CeilF64,
|
||||
Opcode::Floor => LibCall::FloorF64,
|
||||
Opcode::Trunc => LibCall::TruncF64,
|
||||
Opcode::Nearest => LibCall::NearestF64,
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
types::F32 => match opcode {
|
||||
Opcode::Ceil => LibCall::CeilF32,
|
||||
Opcode::Floor => LibCall::FloorF32,
|
||||
Opcode::Trunc => LibCall::TruncF32,
|
||||
Opcode::Nearest => LibCall::NearestF32,
|
||||
_ => return None,
|
||||
},
|
||||
types::F64 => match opcode {
|
||||
Opcode::Ceil => LibCall::CeilF64,
|
||||
Opcode::Floor => LibCall::FloorF64,
|
||||
Opcode::Trunc => LibCall::TruncF64,
|
||||
Opcode::Nearest => LibCall::NearestF64,
|
||||
_ => return None,
|
||||
},
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -127,9 +123,8 @@ pub fn get_probestack_funcref(
|
||||
arg_reg: RegUnit,
|
||||
isa: &TargetIsa,
|
||||
) -> FuncRef {
|
||||
find_funcref(LibCall::Probestack, func).unwrap_or_else(|| {
|
||||
make_funcref_for_probestack(func, reg_type, arg_reg, isa)
|
||||
})
|
||||
find_funcref(LibCall::Probestack, func)
|
||||
.unwrap_or_else(|| make_funcref_for_probestack(func, reg_type, arg_reg, isa))
|
||||
}
|
||||
|
||||
/// Get the existing function reference for `libcall` in `func` if it exists.
|
||||
|
||||
@@ -33,7 +33,7 @@ pub use ir::heap::{HeapBase, HeapData, HeapStyle};
|
||||
pub use ir::instructions::{InstructionData, Opcode, ValueList, ValueListPool, VariableArgs};
|
||||
pub use ir::jumptable::JumpTableData;
|
||||
pub use ir::layout::Layout;
|
||||
pub use ir::libcall::{LibCall, get_libcall_funcref, get_probestack_funcref};
|
||||
pub use ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall};
|
||||
pub use ir::memflags::MemFlags;
|
||||
pub use ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint};
|
||||
pub use ir::sourceloc::SourceLoc;
|
||||
|
||||
@@ -66,12 +66,10 @@ impl<'a> fmt::Display for DisplayValueLoc<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.0 {
|
||||
ValueLoc::Unassigned => write!(f, "-"),
|
||||
ValueLoc::Reg(ru) => {
|
||||
match self.1 {
|
||||
Some(regs) => write!(f, "{}", regs.display_regunit(ru)),
|
||||
None => write!(f, "%{}", ru),
|
||||
}
|
||||
}
|
||||
ValueLoc::Reg(ru) => match self.1 {
|
||||
Some(regs) => write!(f, "{}", regs.display_regunit(ru)),
|
||||
None => write!(f, "%{}", ru),
|
||||
},
|
||||
ValueLoc::Stack(ss) => write!(f, "{}", ss),
|
||||
}
|
||||
}
|
||||
@@ -153,12 +151,10 @@ impl<'a> fmt::Display for DisplayArgumentLoc<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.0 {
|
||||
ArgumentLoc::Unassigned => write!(f, "-"),
|
||||
ArgumentLoc::Reg(ru) => {
|
||||
match self.1 {
|
||||
Some(regs) => write!(f, "{}", regs.display_regunit(ru)),
|
||||
None => write!(f, "%{}", ru),
|
||||
}
|
||||
}
|
||||
ArgumentLoc::Reg(ru) => match self.1 {
|
||||
Some(regs) => write!(f, "{}", regs.display_regunit(ru)),
|
||||
None => write!(f, "%{}", ru),
|
||||
},
|
||||
ArgumentLoc::Stack(offset) => write!(f, "{}", offset),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user