27 if (!Def->getOperand(0).isReg())
29 CurrentReg = Def->getOperand(0).getReg();
32 ME = Def->getParent()->end();
35 if (
MI->definesRegister(CurrentReg))
37 if (
MI->isDebugValue() &&
MI->hasDebugOperandForReg(CurrentReg))
38 DbgValues.push_back(&*
MI);
45 if (
A->getOpcode() !=
B->getOpcode() ||
50 if ((OpA.
isImm() && OpB.isImm() && OpA.
getImm() == OpB.getImm()) ||
58WebAssemblyDebugValueManager::getSinkableDebugValues(
60 if (DbgValues.empty())
68 bool DefFirst =
false;
76 if (
MI->isDebugValue())
93 if (
MI->isDebugValue())
97 ME =
Insert->getIterator();
99 if (
MI->isDebugValue())
107 SeenDbgVarToDbgValues;
108 for (
auto *DV : DbgValuesInBetween) {
109 if (std::find(DbgValues.begin(), DbgValues.end(), DV) == DbgValues.end()) {
110 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
111 DV->getDebugLoc()->getInlinedAt());
112 SeenDbgVarToDbgValues[Var].push_back(DV);
127 for (
auto *DV : DbgValues) {
128 DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
129 DV->getDebugLoc()->getInlinedAt());
130 auto It = SeenDbgVarToDbgValues.
find(Var);
131 if (It == SeenDbgVarToDbgValues.
end()) {
137 auto &OverlappingDbgValues = It->second;
138 bool Sinkable =
true;
139 for (
auto *OverlappingDV : OverlappingDbgValues) {
141 if (!
DbgOp.isReg()) {
210 return SinkableDbgValues;
215bool WebAssemblyDebugValueManager::isInsertSamePlace(
222 if (std::find(DbgValues.begin(), DbgValues.end(),
MI) == DbgValues.end()) {
254 if (isInsertSamePlace(Insert))
263 getSinkableDebugValues(Insert);
268 if (DbgValues.empty())
319 DV->setDebugValueUndef();
321 DbgValues.swap(NewDbgValues);
337 bool CloneDef)
const {
342 getSinkableDebugValues(Insert);
347 if (NewReg != CurrentReg && NewReg.
isValid())
352 if (DbgValues.empty())
363 if (NewReg != CurrentReg && NewReg.
isValid())
364 for (
auto *DBI : NewDbgValues)
365 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
371 if (Reg != CurrentReg && Reg.isValid()) {
372 for (
auto *DBI : DbgValues)
373 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
381 for (
auto *DBI : DbgValues) {
382 auto IndexType = DBI->isIndirectDebugValue()
385 for (
auto &MO : DBI->getDebugOperandsForReg(CurrentReg))
386 MO.ChangeToTargetIndex(IndexType, LocalId);
unsigned const MachineRegisterInfo * MRI
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)
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 MachineOperand & getOperand(unsigned i) const
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.
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.
TODO: Might pack better if we changed this to a Struct of Arrays, since MachineOperand is width 32,...