Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | for (MachineInstr &MI : llvm::make_early_inc_range(MBB)) { | ||||
// Inline asm may have a def in the middle of the operands. Our contract | // Inline asm may have a def in the middle of the operands. Our contract | ||||
// with inline asm register operands is to provide local indices as | // with inline asm register operands is to provide local indices as | ||||
// immediates. | // immediates. | ||||
if (MO.isDef()) { | if (MO.isDef()) { | ||||
assert(MI.isInlineAsm()); | assert(MI.isInlineAsm()); | ||||
unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | ||||
// If this register operand is tied to another operand, we can't | // If this register operand is tied to another operand, we can't | ||||
// change it to an immediate. Untie it first. | // change it to an immediate. Untie it first. | ||||
MI.untieRegOperand(MI.getOperandNo(&MO)); | MI.untieRegOperand(MO.getOperandNo()); | ||||
MO.ChangeToImmediate(LocalId); | MO.ChangeToImmediate(LocalId); | ||||
continue; | continue; | ||||
} | } | ||||
// If we see a stackified register, prepare to insert subsequent | // If we see a stackified register, prepare to insert subsequent | ||||
// local.gets before the start of its tree. | // local.gets before the start of its tree. | ||||
if (MFI.isVRegStackified(OldReg)) { | if (MFI.isVRegStackified(OldReg)) { | ||||
InsertPt = findStartOfTree(MO, MRI, MFI); | InsertPt = findStartOfTree(MO, MRI, MFI); | ||||
continue; | continue; | ||||
} | } | ||||
// Our contract with inline asm register operands is to provide local | // Our contract with inline asm register operands is to provide local | ||||
// indices as immediates. | // indices as immediates. | ||||
if (MI.isInlineAsm()) { | if (MI.isInlineAsm()) { | ||||
unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | ||||
// Untie it first if this reg operand is tied to another operand. | // Untie it first if this reg operand is tied to another operand. | ||||
MI.untieRegOperand(MI.getOperandNo(&MO)); | MI.untieRegOperand(MO.getOperandNo()); | ||||
MO.ChangeToImmediate(LocalId); | MO.ChangeToImmediate(LocalId); | ||||
continue; | continue; | ||||
} | } | ||||
// Insert a local.get. | // Insert a local.get. | ||||
unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg); | ||||
const TargetRegisterClass *RC = MRI.getRegClass(OldReg); | const TargetRegisterClass *RC = MRI.getRegClass(OldReg); | ||||
Register NewReg = MRI.createVirtualRegister(RC); | Register NewReg = MRI.createVirtualRegister(RC); | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |