コード例 #1
0
ファイル: MIRParser.cpp プロジェクト: hoangt/NyuziToolchain
bool MIRParserImpl::initializeJumpTableInfo(
    MachineFunction &MF, const yaml::MachineJumpTable &YamlJTI,
    PerFunctionMIParsingState &PFS) {
  MachineJumpTableInfo *JTI = MF.getOrCreateJumpTableInfo(YamlJTI.Kind);
  SMDiagnostic Error;
  for (const auto &Entry : YamlJTI.Entries) {
    std::vector<MachineBasicBlock *> Blocks;
    for (const auto &MBBSource : Entry.Blocks) {
      MachineBasicBlock *MBB = nullptr;
      if (parseMBBReference(MBB, MBBSource.Value, MF, PFS))
        return true;
      Blocks.push_back(MBB);
    }
    unsigned Index = JTI->createJumpTableIndex(Blocks);
    // TODO: Report an error when the same jump table slot ID is redefined.
    PFS.JumpTableSlots.insert(std::make_pair(Entry.ID, Index));
  }
  return false;
}
コード例 #2
0
ファイル: MIRParser.cpp プロジェクト: AnachroNia/llvm
bool MIRParserImpl::initializeJumpTableInfo(
    MachineFunction &MF, const yaml::MachineJumpTable &YamlJTI,
    PerFunctionMIParsingState &PFS) {
  MachineJumpTableInfo *JTI = MF.getOrCreateJumpTableInfo(YamlJTI.Kind);
  for (const auto &Entry : YamlJTI.Entries) {
    std::vector<MachineBasicBlock *> Blocks;
    for (const auto &MBBSource : Entry.Blocks) {
      MachineBasicBlock *MBB = nullptr;
      if (parseMBBReference(MBB, MBBSource.Value, MF, PFS))
        return true;
      Blocks.push_back(MBB);
    }
    unsigned Index = JTI->createJumpTableIndex(Blocks);
    if (!PFS.JumpTableSlots.insert(std::make_pair(Entry.ID.Value, Index))
             .second)
      return error(Entry.ID.SourceRange.Start,
                   Twine("redefinition of jump table entry '%jump-table.") +
                       Twine(Entry.ID.Value) + "'");
  }
  return false;
}