28 if (!Def->getOperand(0).isReg())
30 CurrentReg = Def->getOperand(0).getReg();
33 ME = Def->getParent()->end();
36 if (
MI->definesRegister(CurrentReg))
38 if (
MI->isDebugValue() &&
MI->hasDebugOperandForReg(CurrentReg))
39 DbgValues.push_back(&*
MI);
46 if (
A->getOpcode() !=
B->getOpcode() ||
51 if ((OpA.
isImm() && OpB.isImm() && OpA.
getImm() == OpB.getImm()) ||
59WebAssemblyDebugValueManager::getSinkableDebugValues(
61 if (DbgValues.empty())
69 bool DefFirst =
false;
77 if (
MI->isDebugValue())
94 if (
MI->isDebugValue())
98 ME =
Insert->getIterator();
100 if (
MI->isDebugValue())
108 SeenDbgVarToDbgValues;
109 for (
auto *DV : DbgValuesInBetween) {
111 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
112 DV->getDebugLoc()->getInlinedAt());
113 SeenDbgVarToDbgValues[Var].push_back(DV);
128 for (
auto *DV : DbgValues) {
129 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
130 DV->getDebugLoc()->getInlinedAt());
131 auto It = SeenDbgVarToDbgValues.
find(Var);
132 if (It == SeenDbgVarToDbgValues.
end()) {
138 auto &OverlappingDbgValues = It->second;
139 bool Sinkable =
true;
140 for (
auto *OverlappingDV : OverlappingDbgValues) {
142 if (!
DbgOp.isReg()) {
211 return SinkableDbgValues;
216bool WebAssemblyDebugValueManager::isInsertSamePlace(
233 for (
const auto &
MI : *
MBB)
234 if (
MI.getDebugLoc() ==
DL)
264 if (isInsertSamePlace(Insert))
273 getSinkableDebugValues(Insert);
284 if (DbgValues.empty())
335 DV->setDebugValueUndef();
337 DbgValues.swap(NewDbgValues);
352 bool CloneDef)
const {
357 getSinkableDebugValues(Insert);
367 if (NewReg != CurrentReg && NewReg.
isValid())
372 if (DbgValues.empty())
383 if (NewReg != CurrentReg && NewReg.
isValid())
384 for (
auto *DBI : NewDbgValues)
385 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
391 if (Reg != CurrentReg && Reg.isValid()) {
392 for (
auto *DBI : DbgValues)
393 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
401 for (
auto *DBI : DbgValues) {
402 auto IndexType = DBI->isIndirectDebugValue()
405 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
406 MO.ChangeToTargetIndex(IndexType, LocalId);
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static bool isSameScalarConst(const MachineInstr *A, const MachineInstr *B)
static bool hasSameDebugLoc(const MachineBasicBlock *MBB, DebugLoc DL)
This file contains the declaration of the WebAssembly-specific manager for DebugValues associated wit...
This file provides WebAssembly-specific target descriptions.
This file declares WebAssembly-specific per-machine-function information.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Identifies a unique instance of a variable.
iterator find(const_arg_type_t< KeyT > Val)
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void setDebugValueUndef()
Sets all register debug operands in this debug value instruction to be undef.
MachineInstr * removeFromParent()
Unlink 'this' from the containing basic block, and return it without deleting it.
const MachineBasicBlock * getParent() const
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
void setDebugLoc(DebugLoc DL)
Replace current source information with new such.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
const ConstantFP * getFPImm() const
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
constexpr bool isValid() const
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
WebAssemblyDebugValueManager(MachineInstr *Def)
void updateReg(Register Reg)
void cloneSink(MachineInstr *Insert, Register NewReg=Register(), bool CloneDef=true) const
void replaceWithLocal(unsigned LocalId)
void sink(MachineInstr *Insert)
self_iterator getIterator()
bool isScalarConst(unsigned Opc)
This is an optimization pass for GlobalISel generic memory operations.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
TODO: Might pack better if we changed this to a Struct of Arrays, since MachineOperand is width 32,...