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


C++ StatementList::append方法代码示例

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


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

示例1: getLibraryDefines

void SPARCSignature::getLibraryDefines(StatementList &defs)
{
    if (defs.size() > 0) {
        return; // Do only once
    }

    // o0-o7 (r8-r15) modified
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O0)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O1)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O2)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O3)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O4)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O5)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O6)));
    defs.append(new ImplicitAssign(Location::regOf(REG_SPARC_O7)));
}
开发者ID:nemerle,项目名称:boomerang,代码行数:16,代码来源:SPARCSignature.cpp

示例2: getLibraryDefines

// Return a list of locations defined by library calls
void PPCSignature::getLibraryDefines(StatementList &defs)
{
    if (defs.size() > 0) {
        return; // Do only once
    }

    for (int r = REG_PPC_G3; r <= REG_PPC_G12; ++r) {
        defs.append(
            new ImplicitAssign(Location::regOf(r))); // Registers 3-12 are volatile (caller save)
    }
}
开发者ID:nemerle,项目名称:boomerang,代码行数:12,代码来源:PPCSignature.cpp

示例3: testSetConscripts

void RtlTest::testSetConscripts()
{
  // m[1000] = m[1000] + 1000
  Statement* s1 = new Assign(
                    Location::memOf(
                      new Const(1000), 0),
                    new Binary(opPlus,
                               Location::memOf(
                                 new Const(1000), NULL),
                               new Const(1000)));

  // "printf("max is %d", (local0 > 0) ? local0 : global1)
  CallStatement* s2 = new CallStatement();
  std::string name("printf");
  Proc* proc = new UserProc(new Prog(), name, 0x2000);	// Making a true LibProc is problematic
  s2->setDestProc(proc);
  s2->setCalleeReturn(new ReturnStatement);		// So it's not a childless call
  Exp* e1 = new Const("max is %d");
  Exp* e2 = new Ternary(opTern,
                        new Binary(opGtr,
                                   Location::local("local0", NULL),
                                   new Const(0)),
                        Location::local("local0", NULL),
                        Location::global("global1", NULL));
  StatementList args;
  args.append(new Assign(Location::regOf(8), e1));
  args.append(new Assign(Location::regOf(9), e2));
  s2->setArguments(args);

  std::list<Statement*> list;
  list.push_back(s1);
  list.push_back(s2);
  RTL* rtl = new RTL(0x1000, &list);
  rtl->setConscripts(0, false);
  std::string expected(
    "00001000    0 *v* m[1000\\1\\] := m[1000\\2\\] + 1000\\3\\\n"
    "            0 CALL printf(\n"
    "                *v* r8 := \"max is %d\"\\4\\\n"
    "                *v* r9 := (local0 > 0\\5\\) ? local0 : global1\n"
    "              )\n"
    "              Reaching definitions: \n"
    "              Live variables: \n");

  std::ostringstream ost;
  rtl->print(ost);
  std::string actual = ost.str();
  CPPUNIT_ASSERT_EQUAL(expected, actual);
}
开发者ID:zecke,项目名称:boomerang,代码行数:48,代码来源:RtlTest.cpp


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