26 if (!Def->getMF()->getFunction().getSubprogram())
32 if (!Def->getOperand(0).isReg())
34 CurrentReg = Def->getOperand(0).getReg();
37 ME = Def->getParent()->end();
40 if (
MI->definesRegister(CurrentReg,
nullptr))
42 if (
MI->isDebugValue() &&
MI->hasDebugOperandForReg(CurrentReg))
43 DbgValues.push_back(&*
MI);
50 if (
A->getOpcode() !=
B->getOpcode() ||
55 if ((OpA.
isImm() && OpB.isImm() && OpA.
getImm() == OpB.getImm()) ||
63WebAssemblyDebugValueManager::getSinkableDebugValues(
65 if (DbgValues.empty())
73 bool DefFirst =
false;
81 if (
MI->isDebugValue())
98 if (
MI->isDebugValue())
102 ME =
Insert->getIterator();
104 if (
MI->isDebugValue())
112 SeenDbgVarToDbgValues;
113 for (
auto *DV : DbgValuesInBetween) {
115 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
116 DV->getDebugLoc()->getInlinedAt());
117 SeenDbgVarToDbgValues[Var].push_back(DV);
132 for (
auto *DV : DbgValues) {
133 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
134 DV->getDebugLoc()->getInlinedAt());
135 auto It = SeenDbgVarToDbgValues.
find(Var);
136 if (It == SeenDbgVarToDbgValues.
end()) {
142 auto &OverlappingDbgValues = It->second;
143 bool Sinkable =
true;
144 for (
auto *OverlappingDV : OverlappingDbgValues) {
146 if (!
DbgOp.isReg()) {
215 return SinkableDbgValues;
220bool WebAssemblyDebugValueManager::isInsertSamePlace(
237 for (
const auto &
MI : *
MBB)
238 if (
MI.getDebugLoc() ==
DL)
268 if (isInsertSamePlace(Insert))
277 getSinkableDebugValues(Insert);
288 if (DbgValues.empty())
339 DV->setDebugValueUndef();
341 DbgValues.swap(NewDbgValues);
356 bool CloneDef)
const {
361 getSinkableDebugValues(Insert);
371 if (NewReg != CurrentReg && NewReg.
isValid())
376 if (DbgValues.empty())
387 if (NewReg != CurrentReg && NewReg.
isValid())
388 for (
auto *DBI : NewDbgValues)
389 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
395 if (Reg != CurrentReg && Reg.isValid()) {
396 for (
auto *DBI : DbgValues)
397 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
405 for (
auto *DBI : DbgValues) {
406 auto IndexType = DBI->isIndirectDebugValue()
409 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
410 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,...