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


C++ codeGen::codeEmitter方法代码示例

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


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

示例1: handleTOCUpdate

bool CFPatch::handleTOCUpdate(codeGen &gen) {
  // Annoying, pain in the butt case...

  assert(target->type() == TargetInt::BlockTarget);
  Target<block_instance *> *t = static_cast<Target<block_instance *> *>(target);


  if (type == Jump)
    return gen.codeEmitter()->emitTOCJump(t->t(), gen);
  else if (type == Call)
    return gen.codeEmitter()->emitTOCCall(t->t(), gen);
  else {
    assert(0);
    return false;
  }
}
开发者ID:dyninst,项目名称:dyninst,代码行数:16,代码来源:CFWidget-ppc.C

示例2: applyPLT

bool CFPatch::applyPLT(codeGen &gen, CodeBuffer *) {
   // We should try and keep any prefixes that were on the instruction. 
   // However... yeah, right. I'm not that good with x86. So instead
   // I'm copying the code from emitCallInstruction...
      
   if (target->type() != TargetInt::BlockTarget) {
      return false;
   }
   // And can only handle calls right now. That's a TODO...
   if (type != Call &&
       type != Jump) {
      return false;
   }

   relocation_cerr << "\t\t\t ApplyPLT..." << endl;

   Target<block_instance *> *t = static_cast<Target<block_instance *> *>(target);
   block_instance *tb = t->t();

   // Set caller in codegen structure
   gen.setFunction(const_cast<func_instance *>(func));

   // We can (for now) only jump to functions
   func_instance *callee = tb->entryOfFunc();
   if (!callee) {
      return false;
   }

   // We need a RegisterSpace for this. Amusingly,
   // we want to use the RegisterSpace corresponding to the
   // entry of the callee, as it doesn't matter what's live
   // here. 
   instPoint *calleeEntry = instPoint::funcEntry(callee);
   gen.setRegisterSpace(registerSpace::actualRegSpace(calleeEntry));

   if (type == Call) 
      gen.codeEmitter()->emitPLTCall(callee, gen);
   else if (type == Jump)
      gen.codeEmitter()->emitPLTJump(callee, gen);
   else
      assert(0);

   return true;
}
开发者ID:dyninst,项目名称:dyninst,代码行数:44,代码来源:CFWidget-ppc.C


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