mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
MIR Serialization: Serialize the unnamed basic block references.
This commit serializes the references from the machine basic blocks to the unnamed basic blocks. This commit adds a new attribute to the machine basic block's YAML mapping called 'ir-block'. This attribute contains the actual reference to the basic block. Reviewers: Duncan P. N. Exon Smith git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -163,6 +163,7 @@ void MIRPrinter::print(const MachineFunction &MF) {
|
||||
convert(YamlMF, *ConstantPool);
|
||||
|
||||
ModuleSlotTracker MST(MF.getFunction()->getParent());
|
||||
MST.incorporateFunction(*MF.getFunction());
|
||||
if (const auto *JumpTableInfo = MF.getJumpTableInfo())
|
||||
convert(MST, YamlMF.JumpTableInfo, *JumpTableInfo);
|
||||
int I = 0;
|
||||
@@ -336,11 +337,17 @@ void MIRPrinter::convert(ModuleSlotTracker &MST,
|
||||
const MachineBasicBlock &MBB) {
|
||||
assert(MBB.getNumber() >= 0 && "Invalid MBB number");
|
||||
YamlMBB.ID = (unsigned)MBB.getNumber();
|
||||
// TODO: Serialize unnamed BB references.
|
||||
if (const auto *BB = MBB.getBasicBlock())
|
||||
YamlMBB.Name.Value = BB->hasName() ? BB->getName() : "<unnamed bb>";
|
||||
else
|
||||
YamlMBB.Name.Value = "";
|
||||
if (const auto *BB = MBB.getBasicBlock()) {
|
||||
if (BB->hasName()) {
|
||||
YamlMBB.Name.Value = BB->getName();
|
||||
} else {
|
||||
int Slot = MST.getLocalSlot(BB);
|
||||
if (Slot == -1)
|
||||
YamlMBB.IRBlock.Value = "<badref>";
|
||||
else
|
||||
YamlMBB.IRBlock.Value = (Twine("%ir-block.") + Twine(Slot)).str();
|
||||
}
|
||||
}
|
||||
YamlMBB.Alignment = MBB.getAlignment();
|
||||
YamlMBB.AddressTaken = MBB.hasAddressTaken();
|
||||
YamlMBB.IsLandingPad = MBB.isLandingPad();
|
||||
|
Reference in New Issue
Block a user