当前位置: 首页>>代码示例>>C++>>正文


C++ TargetPassConfig::addPassesToHandleExceptions方法代码示例

本文整理汇总了C++中TargetPassConfig::addPassesToHandleExceptions方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetPassConfig::addPassesToHandleExceptions方法的具体用法?C++ TargetPassConfig::addPassesToHandleExceptions怎么用?C++ TargetPassConfig::addPassesToHandleExceptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TargetPassConfig的用法示例。


在下文中一共展示了TargetPassConfig::addPassesToHandleExceptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MachineModuleInfo

/// addPassesToX helper drives creation and initialization of TargetPassConfig.
static MCContext *
addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
                        bool DisableVerify, AnalysisID StartBefore,
                        AnalysisID StartAfter, AnalysisID StopAfter,
                        MachineFunctionInitializer *MFInitializer = nullptr) {

    // Add internal analysis passes from the target machine.
    PM.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));

    // Targets may override createPassConfig to provide a target-specific
    // subclass.
    TargetPassConfig *PassConfig = TM->createPassConfig(PM);
    PassConfig->setStartStopPasses(StartBefore, StartAfter, StopAfter);

    // Set PassConfig options provided by TargetMachine.
    PassConfig->setDisableVerify(DisableVerify);

    PM.add(PassConfig);

    PassConfig->addIRPasses();

    PassConfig->addCodeGenPrepare();

    PassConfig->addPassesToHandleExceptions();

    PassConfig->addISelPrepare();

    // Install a MachineModuleInfo class, which is an immutable pass that holds
    // all the per-module stuff we're generating, including MCContext.
    MachineModuleInfo *MMI = new MachineModuleInfo(
        *TM->getMCAsmInfo(), *TM->getMCRegisterInfo(), TM->getObjFileLowering());
    PM.add(MMI);

    // Set up a MachineFunction for the rest of CodeGen to work on.
    PM.add(new MachineFunctionAnalysis(*TM, MFInitializer));

    // Enable FastISel with -fast, but allow that to be overridden.
    TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE);
    if (EnableFastISelOption == cl::BOU_TRUE ||
            (TM->getOptLevel() == CodeGenOpt::None &&
             TM->getO0WantsFastISel()))
        TM->setFastISel(true);

    // Ask the target for an isel.
    if (PassConfig->addInstSelector())
        return nullptr;

    PassConfig->addMachinePasses();

    PassConfig->setInitialized();

    return &MMI->getContext();
}
开发者ID:8l,项目名称:llvm,代码行数:54,代码来源:LLVMTargetMachine.cpp

示例2: MachineModuleInfo

/// addPassesToX helper drives creation and initialization of TargetPassConfig.
static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM,
                                          PassManagerBase &PM,
                                          bool DisableVerify,
                                          AnalysisID StartAfter,
                                          AnalysisID StopAfter) {
  // Targets may override createPassConfig to provide a target-specific sublass.
  TargetPassConfig *PassConfig = TM->createPassConfig(PM);
  PassConfig->setStartStopPasses(StartAfter, StopAfter);

  // Set PassConfig options provided by TargetMachine.
  PassConfig->setDisableVerify(DisableVerify);

  PM.add(PassConfig);

  PassConfig->addIRPasses();

  PassConfig->addPassesToHandleExceptions();

  PassConfig->addISelPrepare();

  // Install a MachineModuleInfo class, which is an immutable pass that holds
  // all the per-module stuff we're generating, including MCContext.
  MachineModuleInfo *MMI =
    new MachineModuleInfo(*TM->getMCAsmInfo(), *TM->getRegisterInfo(),
                          &TM->getTargetLowering()->getObjFileLowering());
  PM.add(MMI);
  MCContext *Context = &MMI->getContext(); // Return the MCContext by-ref.

  // Set up a MachineFunction for the rest of CodeGen to work on.
  PM.add(new MachineFunctionAnalysis(*TM));

  // Enable FastISel with -fast, but allow that to be overridden.
  if (EnableFastISelOption == cl::BOU_TRUE ||
      (TM->getOptLevel() == CodeGenOpt::None &&
       EnableFastISelOption != cl::BOU_FALSE))
    TM->setFastISel(true);

  // Ask the target for an isel.
  if (PassConfig->addInstSelector())
    return NULL;

  PassConfig->addMachinePasses();

  PassConfig->setInitialized();

  return Context;
}
开发者ID:mapu,项目名称:llvm,代码行数:48,代码来源:LLVMTargetMachine.cpp

示例3: MachineModuleInfo

/// addPassesToX helper drives creation and initialization of TargetPassConfig.
static MCContext *
addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
                        bool DisableVerify, AnalysisID StartBefore,
                        AnalysisID StartAfter, AnalysisID StopBefore,
                        AnalysisID StopAfter,
                        MachineFunctionInitializer *MFInitializer = nullptr) {

  // When in emulated TLS mode, add the LowerEmuTLS pass.
  if (TM->Options.EmulatedTLS)
    PM.add(createLowerEmuTLSPass(TM));

  PM.add(createPreISelIntrinsicLoweringPass());

  // Add internal analysis passes from the target machine.
  PM.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));

  // Targets may override createPassConfig to provide a target-specific
  // subclass.
  TargetPassConfig *PassConfig = TM->createPassConfig(PM);
  PassConfig->setStartStopPasses(StartBefore, StartAfter, StopBefore,
                                 StopAfter);

  // Set PassConfig options provided by TargetMachine.
  PassConfig->setDisableVerify(DisableVerify);

  PM.add(PassConfig);

  PassConfig->addIRPasses();

  PassConfig->addCodeGenPrepare();

  PassConfig->addPassesToHandleExceptions();

  PassConfig->addISelPrepare();

  MachineModuleInfo *MMI = new MachineModuleInfo(TM);
  MMI->setMachineFunctionInitializer(MFInitializer);
  PM.add(MMI);

  // Enable FastISel with -fast, but allow that to be overridden.
  TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE);
  if (EnableFastISelOption == cl::BOU_TRUE ||
      (TM->getOptLevel() == CodeGenOpt::None &&
       TM->getO0WantsFastISel()))
    TM->setFastISel(true);

  // Ask the target for an isel.
  if (LLVM_UNLIKELY(EnableGlobalISel)) {
    if (PassConfig->addIRTranslator())
      return nullptr;

    PassConfig->addPreLegalizeMachineIR();

    if (PassConfig->addLegalizeMachineIR())
      return nullptr;

    // Before running the register bank selector, ask the target if it
    // wants to run some passes.
    PassConfig->addPreRegBankSelect();

    if (PassConfig->addRegBankSelect())
      return nullptr;

    PassConfig->addPreGlobalInstructionSelect();

    if (PassConfig->addGlobalInstructionSelect())
      return nullptr;

    // Pass to reset the MachineFunction if the ISel failed.
    PM.add(createResetMachineFunctionPass(
        PassConfig->reportDiagnosticWhenGlobalISelFallback()));

    // Provide a fallback path when we do not want to abort on
    // not-yet-supported input.
    if (LLVM_UNLIKELY(!PassConfig->isGlobalISelAbortEnabled()) &&
        PassConfig->addInstSelector())
      return nullptr;

  } else if (PassConfig->addInstSelector())
    return nullptr;

  PassConfig->addMachinePasses();

  PassConfig->setInitialized();

  return &MMI->getContext();
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:88,代码来源:LLVMTargetMachine.cpp


注:本文中的TargetPassConfig::addPassesToHandleExceptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。