Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | if (MMI.getMachineFunction(*F) != nullptr) | ||||
return error(Twine("redefinition of machine function '") + FunctionName + | return error(Twine("redefinition of machine function '") + FunctionName + | ||||
"'"); | "'"); | ||||
// Create the MachineFunction. | // Create the MachineFunction. | ||||
MachineFunction &MF = MMI.getOrCreateMachineFunction(*F); | MachineFunction &MF = MMI.getOrCreateMachineFunction(*F); | ||||
if (initializeMachineFunction(YamlMF, MF)) | if (initializeMachineFunction(YamlMF, MF)) | ||||
return true; | return true; | ||||
// A block with INLINEASM_BR has extra information associated with it. The | |||||
// indirect targets need to be identified as does the default target. | |||||
DenseMap<const BasicBlock *, MachineBasicBlock *> BBToMBB; | |||||
for (auto &mbb : MF) | |||||
if (const auto *bb = mbb.getBasicBlock()) | |||||
BBToMBB[bb] = &mbb; | |||||
for (auto &mbb : MF) { | |||||
SmallPtrSet<MachineBasicBlock *, 2> Succs(mbb.succ_begin(), mbb.succ_end()); | |||||
for (const auto &term : mbb.terminators()) { | |||||
if (term.getOpcode() != TargetOpcode::INLINEASM_BR) | |||||
continue; | |||||
for (const auto &mo : term.operands()) { | |||||
if (!mo.isBlockAddress()) | |||||
continue; | |||||
auto *succ = mo.getBlockAddress()->getBasicBlock(); | |||||
auto *msucc = BBToMBB[succ]; | |||||
Succs.erase(msucc); | |||||
mbb.addInlineAsmBrIndirectTarget(msucc); | |||||
} | |||||
if (Succs.size() == 1) | |||||
(*Succs.begin())->setInlineAsmBrDefaultTarget(); | |||||
} | |||||
} | |||||
arsenm: This is an unrelated change | |||||
return false; | return false; | ||||
} | } | ||||
static bool isSSA(const MachineFunction &MF) { | static bool isSSA(const MachineFunction &MF) { | ||||
const MachineRegisterInfo &MRI = MF.getRegInfo(); | const MachineRegisterInfo &MRI = MF.getRegInfo(); | ||||
for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) { | for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) { | ||||
unsigned Reg = Register::index2VirtReg(I); | unsigned Reg = Register::index2VirtReg(I); | ||||
if (!MRI.hasOneDef(Reg) && !MRI.def_empty(Reg)) | if (!MRI.hasOneDef(Reg) && !MRI.def_empty(Reg)) | ||||
▲ Show 20 Lines • Show All 654 Lines • Show Last 20 Lines |
This is an unrelated change