本文整理汇总了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)));
}
示例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)
}
}
示例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);
}