Shrink StatementKind::InlineAsm.
This shrinks StatementKind from 64 bytes to 48 bytes on 64-bit.
This commit is contained in:
parent
a577f900a9
commit
e221b24cb6
6 changed files with 21 additions and 9 deletions
|
|
@ -1633,8 +1633,8 @@ pub enum StatementKind<'tcx> {
|
|||
/// Execute a piece of inline Assembly.
|
||||
InlineAsm {
|
||||
asm: Box<InlineAsm>,
|
||||
outputs: Vec<Place<'tcx>>,
|
||||
inputs: Vec<Operand<'tcx>>,
|
||||
outputs: Box<[Place<'tcx>]>,
|
||||
inputs: Box<[Operand<'tcx>]>,
|
||||
},
|
||||
|
||||
/// Assert the given places to be valid inhabitants of their type. These statements are
|
||||
|
|
|
|||
|
|
@ -720,6 +720,16 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Vec<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<[T]> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
self.iter().map(|t| t.fold_with(folder)).collect::<Vec<_>>().into_boxed_slice()
|
||||
}
|
||||
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
self.iter().any(|t| t.visit_with(visitor))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T:TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder<T> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
self.map_bound_ref(|ty| ty.fold_with(folder))
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
|
|||
ref inputs,
|
||||
} => {
|
||||
let context = ContextKind::InlineAsm.new(location);
|
||||
for (o, output) in asm.outputs.iter().zip(outputs) {
|
||||
for (o, output) in asm.outputs.iter().zip(outputs.iter()) {
|
||||
if o.is_indirect {
|
||||
// FIXME(eddyb) indirect inline asm outputs should
|
||||
// be encoeded through MIR place derefs instead.
|
||||
|
|
@ -555,7 +555,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx
|
|||
);
|
||||
}
|
||||
}
|
||||
for input in inputs {
|
||||
for input in inputs.iter() {
|
||||
self.consume_operand(context, (input, span), flow_state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cg, 'cx, 'tc
|
|||
ref inputs,
|
||||
} => {
|
||||
let context = ContextKind::InlineAsm.new(location);
|
||||
for (o, output) in asm.outputs.iter().zip(outputs) {
|
||||
for (o, output) in asm.outputs.iter().zip(outputs.iter()) {
|
||||
if o.is_indirect {
|
||||
// FIXME(eddyb) indirect inline asm outputs should
|
||||
// be encoeded through MIR place derefs instead.
|
||||
|
|
@ -137,7 +137,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cg, 'cx, 'tc
|
|||
);
|
||||
}
|
||||
}
|
||||
for input in inputs {
|
||||
for input in inputs.iter() {
|
||||
self.consume_operand(context, input);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,11 +143,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
|||
let outputs = outputs
|
||||
.into_iter()
|
||||
.map(|output| unpack!(block = this.as_place(block, output)))
|
||||
.collect();
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let inputs = inputs
|
||||
.into_iter()
|
||||
.map(|input| unpack!(block = this.as_local_operand(block, input)))
|
||||
.collect();
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
this.cfg.push(
|
||||
block,
|
||||
Statement {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
|
|||
self.gather_init(output, InitKind::Deep);
|
||||
}
|
||||
}
|
||||
for input in inputs {
|
||||
for input in inputs.iter() {
|
||||
self.gather_operand(input);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue