1
Fork 0

Retain assembly operands span when lowering AST to HIR

This commit is contained in:
Tomasz Miąsko 2020-11-27 00:00:00 +00:00
parent 0f6f2d681b
commit 91fe548825
13 changed files with 18 additions and 20 deletions

View file

@ -1307,7 +1307,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::InlineAsmOperand::Sym { expr: self.lower_expr_mut(expr) }
}
};
Some(op)
Some((op, *op_sp))
})
.collect();
@ -1326,7 +1326,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
} = *p
{
let op_sp = asm.operands[operand_idx].1;
match &operands[operand_idx] {
match &operands[operand_idx].0 {
hir::InlineAsmOperand::In { reg, .. }
| hir::InlineAsmOperand::Out { reg, .. }
| hir::InlineAsmOperand::InOut { reg, .. }
@ -1385,8 +1385,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut used_input_regs = FxHashMap::default();
let mut used_output_regs = FxHashMap::default();
let mut required_features: Vec<&str> = vec![];
for (idx, op) in operands.iter().enumerate() {
let op_sp = asm.operands[idx].1;
for (idx, &(ref op, op_sp)) in operands.iter().enumerate() {
if let Some(reg) = op.reg() {
// Make sure we don't accidentally carry features from the
// previous iteration.
@ -1458,8 +1457,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
skip = true;
let idx2 = *o.get();
let op2 = &operands[idx2];
let op_sp2 = asm.operands[idx2].1;
let &(ref op2, op_sp2) = &operands[idx2];
let reg2 = match op2.reg() {
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
_ => unreachable!(),