本文整理汇总了C++中Iter类的典型用法代码示例。如果您正苦于以下问题:C++ Iter类的具体用法?C++ Iter怎么用?C++ Iter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Iter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: audit_opnds
void
audit_opnds(FILE *fp, const char *heading)
{
int size_reg = 0;
int size_var = 0;
int size_immed_integer = 0;
int size_immed_string = 0;
int size_addr_sym = 0;
int size_addr_exp = 0;
for (Iter<SymbolTableObject*> i =
the_local_scope->get_symbol_table_object_iterator();
i.is_valid(); i.next())
{
SymbolTableObject *sto = i.current();
if (is_kind_of<IrOpnd>(sto))
switch (static_cast<IrOpnd*>(sto)->get_kind())
{
case opnd::NONE:
claim(false, "Unexpected operand kind: opnd::NONE");
case opnd::REG_HARD:
case opnd::REG_VIRTUAL:
size_reg += sizeof(OpndReg);
break;
case opnd::VAR:
size_var += sizeof(OpndVar);
break;
case opnd::IMMED_INTEGER:
size_immed_integer += sizeof(OpndImmedInteger);
break;
case opnd::IMMED_STRING:
size_immed_string += sizeof(OpndImmedString);
break;
case opnd::ADDR_SYM:
size_addr_sym += sizeof(OpndAddrSym);
break;
case opnd::SYM_DISP:
case opnd::INDEX_SYM_DISP:
case opnd::BASE_DISP:
case opnd::BASE_INDEX:
case opnd::BASE_INDEX_DISP:
case opnd::INDEX_SCALE_DISP:
case opnd::BASE_INDEX_SCALE_DISP:
size_addr_sym +=
sizeof(OpndAddrExp) +
sizeof(IrOpnd*) *
static_cast<OpndAddrExp*>(sto)->get_src_count();
break;
default:
claim(false, "Unknown operand kind");
}
}
fprintf(fp, "%s operand storage (bytes):\n", heading);
fprintf(fp, " Register: %8d\n", size_reg);
fprintf(fp, " Variable symbol: %8d\n", size_var);
fprintf(fp, " String immediate: %8d\n", size_immed_string);
fprintf(fp, " Integer immediate: %8d\n", size_immed_integer);
fprintf(fp, " Address symbol: %8d\n", size_addr_sym);
fprintf(fp, " Address expression:%8d\n", size_addr_exp);
fprintf(fp, " %8d (total)\n",
size_reg + size_var + size_immed_string + size_immed_integer +
size_addr_sym + size_addr_exp);
}
示例2: TestTInternalLList
static void TestTInternalLList(skiatest::Reporter* reporter) {
SkTInternalLList<ListElement> list;
ListElement elements[4] = {
ListElement(0),
ListElement(1),
ListElement(2),
ListElement(3),
};
// list should be empty to start with
check_list(list, reporter, true, 0, false, false, false, false, elements);
list.addToHead(&elements[0]);
check_list(list, reporter, false, 1, true, false, false, false, elements);
list.addToHead(&elements[1]);
list.addToHead(&elements[2]);
list.addToHead(&elements[3]);
check_list(list, reporter, false, 4, true, true, true, true, elements);
// test out iterators
typedef SkTInternalLList<ListElement>::Iter Iter;
Iter iter;
ListElement* cur = iter.init(list, Iter::kHead_IterStart);
for (int i = 0; NULL != cur; ++i, cur = iter.next()) {
REPORTER_ASSERT(reporter, cur->fID == 3-i);
}
cur = iter.init(list, Iter::kTail_IterStart);
for (int i = 0; NULL != cur; ++i, cur = iter.prev()) {
REPORTER_ASSERT(reporter, cur->fID == i);
}
// remove middle, frontmost then backmost
list.remove(&elements[1]);
list.remove(&elements[3]);
list.remove(&elements[0]);
check_list(list, reporter, false, 1, false, false, true, false, elements);
// remove last element
list.remove(&elements[2]);
// list should be empty again
check_list(list, reporter, true, 0, false, false, false, false, elements);
// test out methods that add to the middle of the list.
list.addAfter(&elements[1], NULL);
check_list(list, reporter, false, 1, false, true, false, false, elements);
list.remove(&elements[1]);
list.addBefore(&elements[1], NULL);
check_list(list, reporter, false, 1, false, true, false, false, elements);
list.addBefore(&elements[0], &elements[1]);
check_list(list, reporter, false, 2, true, true, false, false, elements);
list.addAfter(&elements[3], &elements[1]);
check_list(list, reporter, false, 3, true, true, false, true, elements);
list.addBefore(&elements[2], &elements[3]);
check_list(list, reporter, false, 4, true, true, true, true, elements);
cur = iter.init(list, Iter::kHead_IterStart);
for (int i = 0; NULL != cur; ++i, cur = iter.next()) {
REPORTER_ASSERT(reporter, cur->fID == i);
}
}
示例3: equal
bool equal(const Iter& p1, const Iter& p2) const {
return p1.base().first == p2.base().first;
}
示例4: runOnMachineBasicBlock
/// runOnMachineBasicBlock - Fill in delay slots for the given basic block.
/// We assume there is only one delay slot per delayed instruction.
bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
bool Changed = false;
const MipsSubtarget &STI = MBB.getParent()->getSubtarget<MipsSubtarget>();
bool InMicroMipsMode = STI.inMicroMipsMode();
const MipsInstrInfo *TII = STI.getInstrInfo();
if (InMicroMipsMode && STI.hasMips32r6()) {
// This is microMIPS32r6 or microMIPS64r6 processor. Delay slot for
// branching instructions is not needed.
return Changed;
}
for (Iter I = MBB.begin(); I != MBB.end(); ++I) {
if (!hasUnoccupiedSlot(&*I))
continue;
++FilledSlots;
Changed = true;
// Delay slot filling is disabled at -O0.
if (!DisableDelaySlotFiller && (TM.getOptLevel() != CodeGenOpt::None)) {
bool Filled = false;
if (searchBackward(MBB, I)) {
Filled = true;
} else if (I->isTerminator()) {
if (searchSuccBBs(MBB, I)) {
Filled = true;
}
} else if (searchForward(MBB, I)) {
Filled = true;
}
if (Filled) {
// Get instruction with delay slot.
MachineBasicBlock::instr_iterator DSI(I);
if (InMicroMipsMode && TII->GetInstSizeInBytes(&*std::next(DSI)) == 2 &&
DSI->isCall()) {
// If instruction in delay slot is 16b change opcode to
// corresponding instruction with short delay slot.
DSI->setDesc(TII->get(getEquivalentCallShort(DSI->getOpcode())));
}
continue;
}
}
// For microMIPS if instruction is BEQ or BNE with one ZERO register, then
// instead of adding NOP replace this instruction with the corresponding
// compact branch instruction, i.e. BEQZC or BNEZC. Additionally
// PseudoReturn and PseudoIndirectBranch are expanded to JR_MM, so they can
// be replaced with JRC16_MM.
// For MIPSR6 attempt to produce the corresponding compact (no delay slot)
// form of the CTI. For indirect jumps this will not require inserting a
// NOP and for branches will hopefully avoid requiring a NOP.
if ((InMicroMipsMode || STI.hasMips32r6()) &&
TII->getEquivalentCompactForm(I)) {
I = replaceWithCompactBranch(MBB, I, I->getDebugLoc());
continue;
}
// Bundle the NOP to the instruction with the delay slot.
BuildMI(MBB, std::next(I), I->getDebugLoc(), TII->get(Mips::NOP));
MIBundleBuilder(MBB, I, std::next(I, 2));
}
return Changed;
}
示例5: runOnMachineBasicBlock
/// runOnMachineBasicBlock - Fill in delay slots for the given basic block.
/// We assume there is only one delay slot per delayed instruction.
bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
bool Changed = false;
const MipsSubtarget &STI = MBB.getParent()->getSubtarget<MipsSubtarget>();
bool InMicroMipsMode = STI.inMicroMipsMode();
const MipsInstrInfo *TII = STI.getInstrInfo();
for (Iter I = MBB.begin(); I != MBB.end(); ++I) {
if (!hasUnoccupiedSlot(&*I))
continue;
++FilledSlots;
Changed = true;
// Delay slot filling is disabled at -O0.
if (!DisableDelaySlotFiller && (TM.getOptLevel() != CodeGenOpt::None)) {
bool Filled = false;
if (searchBackward(MBB, I)) {
Filled = true;
} else if (I->isTerminator()) {
if (searchSuccBBs(MBB, I)) {
Filled = true;
}
} else if (searchForward(MBB, I)) {
Filled = true;
}
if (Filled) {
// Get instruction with delay slot.
MachineBasicBlock::instr_iterator DSI(I);
if (InMicroMipsMode && TII->GetInstSizeInBytes(std::next(DSI)) == 2 &&
DSI->isCall()) {
// If instruction in delay slot is 16b change opcode to
// corresponding instruction with short delay slot.
DSI->setDesc(TII->get(getEquivalentCallShort(DSI->getOpcode())));
}
continue;
}
}
// If instruction is BEQ or BNE with one ZERO register, then instead of
// adding NOP replace this instruction with the corresponding compact
// branch instruction, i.e. BEQZC or BNEZC.
unsigned Opcode = I->getOpcode();
if (InMicroMipsMode) {
switch (Opcode) {
case Mips::BEQ:
case Mips::BNE:
if (((unsigned) I->getOperand(1).getReg()) == Mips::ZERO) {
I = replaceWithCompactBranch(MBB, I, I->getDebugLoc());
continue;
}
break;
case Mips::JR:
case Mips::PseudoReturn:
case Mips::PseudoIndirectBranch:
// For microMIPS the PseudoReturn and PseudoIndirectBranch are allways
// expanded to JR_MM, so they can be replaced with JRC16_MM.
I = replaceWithCompactJump(MBB, I, I->getDebugLoc());
continue;
default:
break;
}
}
// Bundle the NOP to the instruction with the delay slot.
BuildMI(MBB, std::next(I), I->getDebugLoc(), TII->get(Mips::NOP));
MIBundleBuilder(MBB, I, std::next(I, 2));
}
return Changed;
}
示例6: process_static_type_above_dst
// Call this function when searching above a dst_type node. This function searches
// for a public path to (static_ptr, static_type).
// This function is guaranteed not to find a node of type dst_type.
// Theoretically this is a very simple function which just stops if it finds a
// static_type node: All the hoopla surrounding the search code is doing
// nothing but looking for excuses to stop the search prematurely (break out of
// the for-loop). That is, the algorithm below is simply an optimization of this:
// void
// __vmi_class_type_info::search_above_dst(__dynamic_cast_info* info,
// const void* dst_ptr,
// const void* current_ptr,
// int path_below) const
// {
// if (this == info->static_type)
// process_static_type_above_dst(info, dst_ptr, current_ptr, path_below);
// else
// {
// typedef const __base_class_type_info* Iter;
// // This is not a static_type and not a dst_type
// for (Iter p = __base_info, e = __base_info + __base_count; p < e; ++p)
// {
// p->search_above_dst(info, dst_ptr, current_ptr, public_path);
// // break out early here if you can detect it doesn't matter if you do
// }
// }
// }
void
__vmi_class_type_info::search_above_dst(__dynamic_cast_info* info,
const void* dst_ptr,
const void* current_ptr,
int path_below,
bool use_strcmp) const
{
if (is_equal(this, info->static_type, use_strcmp))
process_static_type_above_dst(info, dst_ptr, current_ptr, path_below);
else
{
typedef const __base_class_type_info* Iter;
// This is not a static_type and not a dst_type
// Save flags so they can be restored when returning to nodes below.
bool found_our_static_ptr = info->found_our_static_ptr;
bool found_any_static_type = info->found_any_static_type;
// We've found a dst_type below with a path to here. If the path
// to here is not public, there may be another path to here that
// is public. So we have to assume that the path to here is public.
// We can stop looking above if:
// 1. We've found a public path to (static_ptr, static_type).
// 2. We've found an ambiguous cast from (static_ptr, static_type) to a dst_type.
// This is detected at the (static_ptr, static_type).
// 3. We can prove that there is no public path to (static_ptr, static_type)
// above here.
const Iter e = __base_info + __base_count;
Iter p = __base_info;
// Zero out found flags
info->found_our_static_ptr = false;
info->found_any_static_type = false;
p->search_above_dst(info, dst_ptr, current_ptr, path_below, use_strcmp);
if (++p < e)
{
do
{
if (info->search_done)
break;
if (info->found_our_static_ptr)
{
// If we found what we're looking for, stop looking above.
if (info->path_dst_ptr_to_static_ptr == public_path)
break;
// We found a private path to (static_ptr, static_type)
// If there is no diamond then there is only one path
// to (static_ptr, static_type) from here and we just found it.
if (!(__flags & __diamond_shaped_mask))
break;
}
else if (info->found_any_static_type)
{
// If we found a static_type that isn't the one we're looking
// for, and if there are no repeated types above here,
// then stop looking.
if (!(__flags & __non_diamond_repeat_mask))
break;
}
// Zero out found flags
info->found_our_static_ptr = false;
info->found_any_static_type = false;
p->search_above_dst(info, dst_ptr, current_ptr, path_below, use_strcmp);
} while (++p < e);
}
// Restore flags
info->found_our_static_ptr = found_our_static_ptr;
info->found_any_static_type = found_any_static_type;
}
}
示例7: tool_main
//.........这里部分代码省略.........
#if defined(SK_DEBUG)
writer.option("build", "DEBUG");
#else
writer.option("build", "RELEASE");
#endif
// Set texture cache limits if non-default.
for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) {
#if SK_SUPPORT_GPU
const Config& config = gConfigs[i];
if (Benchmark::kGPU_Backend != config.backend) {
continue;
}
GrContext* context = gContextFactory.get(config.contextType);
if (NULL == context) {
continue;
}
size_t bytes;
int count;
context->getResourceCacheLimits(&count, &bytes);
if (-1 != FLAGS_gpuCacheBytes) {
bytes = static_cast<size_t>(FLAGS_gpuCacheBytes);
}
if (-1 != FLAGS_gpuCacheCount) {
count = FLAGS_gpuCacheCount;
}
context->setResourceCacheLimits(count, bytes);
#endif
}
// Run each bench in each configuration it supports and we asked for.
Iter iter;
Benchmark* bench;
while ((bench = iter.next()) != NULL) {
SkAutoTUnref<Benchmark> benchUnref(bench);
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) {
continue;
}
bench->setForceAlpha(alpha);
bench->setForceAA(FLAGS_forceAA);
bench->setForceFilter(FLAGS_forceFilter);
bench->setDither(dither);
bench->preDraw();
bool loggedBenchName = false;
for (int i = 0; i < configs.count(); ++i) {
const int configIndex = configs[i];
const Config& config = gConfigs[configIndex];
if (!bench->isSuitableFor(config.backend)) {
continue;
}
GrContext* context = NULL;
#if SK_SUPPORT_GPU
SkGLContextHelper* glContext = NULL;
if (Benchmark::kGPU_Backend == config.backend) {
context = gContextFactory.get(config.contextType);
if (NULL == context) {
continue;
}
glContext = gContextFactory.getGLContext(config.contextType);
}
示例8: getHighest
Score getHighest(Idx& i, Idx& j) // could be const if we had const Iters
{
const bool trace = false;
Iter iter = begin();
Score bestScore = *iter;
Idx bestRow = iter.row();
Idx bestCol = iter.col();
if (trace)
cout << iter.row() << " " << iter.col() << " " << *iter << endl;
++iter;
for (Iter iterEnd = end(); iter != iterEnd; ++iter)
{
if (trace)
cout << iter.row() << " " << iter.col() << " " << *iter << endl;
if (scoreGreater(*iter, bestScore))
// if (ScoreComparer::_scoreGreater(*iter, bestScore, scoreComparer_TOLERANCE))
{
if (false && gTraceInfo.iteration == 2441) {
cout << iter.row() << " " << iter.col() << " ";
printf("%20.20g", *iter);
cout << endl;
}
bestScore = *iter;
bestRow = iter.row();
bestCol = iter.col();
}
}
i = bestRow;
j = bestCol;
return bestScore;
}
示例9: while
//---------------------------------------------------------------------------
bool __fastcall Parser::Execute(bool paint)
{
//parse lists
tasklist.sort();
tasklistprior.sort();
upperbound = parent->GetActLine() + PARSEINADVANCE;
bool painted = false;
int parsed = 0;
bool endValid = false;
while(tasklistprior.size() > 0 || (tasklist.size() > 0 && (tasklist.front().linenum < upperbound || tasklist.front().line->parserState.parseid != currentparseid)) )
{
ParseTask pt;
if(tasklistprior.size() > 0)
{
pt = tasklistprior.front();
}
else
{
pt = tasklist.front();
}
linenum = parent->GetLineNum(pt.line);
bool first = true;
painted = linenum >= 0 | painted;
Iter * itr = new Iter(pt.line, linenum >= 0 ? parent->itrLine.linenum+linenum : pt.linenum, 0, parent->buffer);
state = itr->line->parserState;
if(itr->linenum == 1)
state.parseid = currentparseid;
else if(itr->line != NULL && itr->line->prevline != NULL)
state.parseid = itr->line->prevline->parserState.parseid;
if(linenum >= 0)
{
ReconstructMarkup();
actIMarkup = itr->ReconstructIMarkFontStyle();
actMarkupCombined = actMarkup;
actMarkupCombined += actIMarkup;
itr->UpdateNextImark();
}
if(state.searchStateStack.top == NULL)
state.searchStateStack.Push(langdef->GetDefSC(0));
//LanguageDefinition::SearchIter * searchiter = &state.searchStateStack.top->data; //now passed directly - no need to keep it
actFormat = *state.searchStateStack.top->data.base->format;
tasklistprior.remove(pt);
tasklist.remove(pt);
while(itr->word->next && (first || itr->line->parserState != this->state || tasklistprior.front().line == itr->line))
{
//take care of record from list
newline = true;
first = false;
//take care of line
if(itr->line->prevline != NULL) //otherwise sets a format to the first line -> changing langdef will never iterate change in buffer
itr->line->parserState = this->state;
tasklistprior.remove(pt);
tasklist.remove(pt);
// parent->Log(String("parsing line ")+String(itr->linenum));
ParseLine(itr, &state.searchStateStack.top->data, linenum >= 0);
endValid = itr->GoChar();
if(linenum >= 0)
{
//FlushAll();
painted = true;
linenum = parent->GetLineNum(itr->line);
}
else if(parent->IsLineFirstVisible(itr->line))
{
itr->linenum = parent->GetActLine();
ReconstructMarkup();
actIMarkup = itr->ReconstructIMarkFontStyle();
actMarkupCombined = actMarkup;
actMarkupCombined += actIMarkup;
itr->UpdateNextImark();
linenum = 0;
}
pt.linenum++;
pt.line = itr->line;
parsed++;
//if(!(linenum >= 0 && linenum <= parent->GetVisLineCount() && itr->line->parserState != this->state) && tasklistprior.size() > 0 )
if(linenum < 0 && (tasklistprior.size() > 0 || itr->linenum > upperbound || parsed > PARSEINONEGO))
{
if(itr->word->next != NULL && itr->line->parserState != this->state)
{
this->tasklist.push_front(ParseTask(itr->line, itr->linenum));
}
itr->line->parserState = this->state;
break;
}
//.........这里部分代码省略.........
示例10: log_probability
double log_probability(Iter const & iter) const {
if (iter.is_missing(_slotID))
return 0.0; /* log(1) */
return _func->log_probability(iter);
}
示例11: get_procedure_definition
Statement* scope_statement_walker::dismantle_scope_statement(ScopeStatement *the_scope_stat){
ProcedureDefinition* proc_def = get_procedure_definition(the_scope_stat);
Statement *body = the_scope_stat->get_body();
if(body==NULL){
the_scope_stat->print_to_default();
}
body->set_parent(0);
the_scope_stat->set_body(0);
// This is a bug?
// remove_suif_object(body);
SymbolTable * symbol_table = the_scope_stat->get_symbol_table();
DefinitionBlock * definition_block = the_scope_stat->get_definition_block();
SymbolTable *new_symbol_table = proc_def->get_symbol_table();
DefinitionBlock *new_definition_block = proc_def->get_definition_block();
if (symbol_table != 0) {
// start by creating a name for the symbol in the new symbol table
Iter<SymbolTable::lookup_table_pair> piter = symbol_table->get_lookup_table_iterator();
while (piter.is_valid()) {
indexed_list<LString,SymbolTableObject*>::pair p = piter.current();
SymbolTableObject * obj = p.second;
const LString &name = p.first;
new_symbol_table->add_lookup_table(name,obj);
piter.next();
}
// now move all symbols into the symbol table for the procedure scope
// at the same time, we delete them from the current symbol table and
// remove all references to this symbol table from the name list attached
// to the symbol
// DLH
// I modifed this to build a list so we aren't iterating over
// a changing object (which didn't work. and I don't expect it to)
list<SymbolTableObject*> l;
{for (Iter<SymbolTableObject*> iter =
symbol_table->get_symbol_table_object_iterator();
iter.is_valid(); iter.next()) {
l.push_back(iter.current());
}}
for (list<SymbolTableObject*>::iterator iter =
l.begin(); iter != l.end(); iter++)
{
SymbolTableObject *object = *iter;
symbol_table->remove_symbol_table_object(object);
rename_if_collision(object, new_symbol_table);
new_symbol_table->add_symbol(object);
// symbol_table->remove_all_from_lookup_table(object);
// object->remove_all_from_name(symbol_table);
}
}
if (definition_block != 0) {
// move all definition block entries
int i = definition_block->get_variable_definition_count();
while (i > 0){
i--;
VariableDefinition *next = definition_block->remove_variable_definition(i);
new_definition_block->append_variable_definition(next);
}
i = definition_block->get_procedure_definition_count();
while (i > 0){
i--;
ProcedureDefinition *next = definition_block->remove_procedure_definition(i);
new_definition_block->append_procedure_definition(next);
}
}
the_scope_stat->get_parent()->replace(the_scope_stat, body);
return body;
}
示例12: create_parameter_symbol
void DismantleStructuredReturns::do_file_set_block( FileSetBlock* file_set_block ) {
suif_map<CProcedureType *,QualifiedType *> type_map;
list<ArrayReferenceExpression*> ref_exprs;
SuifEnv *env = 0;
TypeBuilder *tb = 0;
VoidType *vt = 0;
for (Iter<ProcedureSymbol> iter =
object_iterator<ProcedureSymbol>(file_set_block);
iter.is_valid();
iter.next()) {
ProcedureSymbol *sym = &iter.current();
Type *type = sym->get_type();
if (!is_kind_of<CProcedureType>(type))
continue;
CProcedureType *cp_type = to<CProcedureType>(type);
type = cp_type->get_result_type();
if (!env) {
env = type->get_suif_env();
tb = (TypeBuilder*)
env->get_object_factory(TypeBuilder::get_class_name());
vt = tb->get_void_type();
}
suif_map<CProcedureType *,QualifiedType *>::iterator t_iter = type_map.find(cp_type);
QualifiedType *qtype;
if (t_iter == type_map.end()) {
if (!is_kind_of<GroupType>(type) && !is_kind_of<ArrayType>(type))
continue;
qtype = tb->get_qualified_type(
tb->get_pointer_type(to<DataType>(type)));
cp_type->set_result_type(vt);
cp_type->insert_argument(0,qtype);
type_map.enter_value(cp_type,qtype);
}
else {
qtype = (*t_iter).second;
}
ProcedureDefinition *def = sym->get_definition();
if (!def)
continue;
ParameterSymbol *par = create_parameter_symbol(env,qtype);
def->get_symbol_table()->append_symbol_table_object(par);
def->insert_formal_parameter(0,par);
// Convert all returns into assigned and returns
for (Iter<ReturnStatement> ret_iter = object_iterator<ReturnStatement>(def->get_body());
ret_iter.is_valid();
ret_iter.next()) {
ReturnStatement *ret = &ret_iter.current();
Expression *retval = ret->get_return_value();
ret->set_return_value(0);
retval->set_parent(0);
insert_statement_before(ret,
create_store_statement(env,retval,create_var_use(par)));
}
}
// Change all calls to the new form
for (Iter<CallStatement> cs_iter =
object_iterator<CallStatement>(file_set_block);
cs_iter.is_valid();
cs_iter.next()) {
CallStatement *call = &cs_iter.current();
Type *type = call->get_callee_address()->get_result_type();
Type *p_type = tb->unqualify_type(to<PointerType>(type)->get_reference_type());
if (!is_kind_of<PointerType>(p_type))
continue;
p_type = tb->unqualify_type(to<PointerType>(p_type)->get_reference_type());
if (!is_kind_of<CProcedureType>(p_type))
continue;
CProcedureType *cp_type = to<CProcedureType>(p_type);
suif_map<CProcedureType *,QualifiedType *>::iterator t_iter = type_map.find(cp_type);
if (t_iter == type_map.end())
continue;
QualifiedType *qtype = (*t_iter).second;
DataType *var_type = to<DataType>(tb->unqualify_type(to<PointerType>(qtype->get_base_type())
->get_reference_type()));
VariableSymbol *var =
new_anonymous_variable(env,call,tb->get_qualified_type(var_type));
Expression *exp = create_symbol_address_expression(
env,
tb->get_pointer_type(var_type),
var);
call->insert_argument(0,exp);
call->set_destination(0);
}
for (Iter<CallExpression> ce_iter =
object_iterator<CallExpression>(file_set_block);
ce_iter.is_valid();
ce_iter.next()) {
CallExpression *call = &ce_iter.current();
Type *type = call->get_callee_address()->get_result_type();
Type *p_type = tb->unqualify_type(to<PointerType>(type)->get_reference_type());
if (!is_kind_of<PointerType>(p_type))
continue;
p_type = tb->unqualify_type(to<PointerType>(p_type)->get_reference_type());
//.........这里部分代码省略.........
示例13: getNextMachineInstr
// Find the next real instruction from the current position.
static Iter getNextMachineInstr(Iter Position) {
Iter I = Position, E = Position->getParent()->end();
I = std::find_if_not(I, E, [](const Iter &Insn) { return Insn->isTransient(); });
assert(I != E);
return I;
}
示例14: get_env
Walker::ApplyStatus mdbm_c_for_statement_walker::operator () (SuifObject *x) {
SuifEnv *env = get_env();
CForStatement *c_for_stmt = to<CForStatement>(x);
// if(!is_stmt_within_begin_end_hw_marks(c_for_stmt))
// return Walker::Continue;
Statement *body = c_for_stmt->get_body();
if (body){
Iter<CForStatement> iter_c_for = object_iterator<CForStatement>(body);
if(iter_c_for.is_valid())
return Walker::Continue;
StatementList *stmt_list_body = NULL;
if(is_a<StatementList>(body))
stmt_list_body = to<StatementList>(body);
else{
stmt_list_body = create_statement_list(env);
c_for_stmt->set_body(0);
stmt_list_body->append_statement(body);
c_for_stmt->set_body(stmt_list_body);
}
Iter<Statement*> iter = stmt_list_body->get_statement_iterator();
for( ; iter.is_valid(); iter.next()){
Statement *child_stmt = iter.current();
if(is_a<StoreVariableStatement>(child_stmt)){
Iter<LoadExpression> iter2 = object_iterator<LoadExpression>(child_stmt);
if(!iter2.is_valid())
break;
}else break;
}
MarkStatement *end_of_mem_reads_mark = create_mark_statement(env);
if(iter.is_valid())
insert_statement_before(iter.current(), end_of_mem_reads_mark);
else
stmt_list_body->insert_statement(0, end_of_mem_reads_mark);
BrickAnnote *ba = create_brick_annote(env, "end_of_mem_reads");
ba->append_brick(create_suif_object_brick(env, end_of_mem_reads_mark));
c_for_stmt->append_annote(ba);
for( ; iter.is_valid(); iter.next()){
Statement *child_stmt = iter.current();
if(is_a<StoreStatement>(child_stmt))
break;
}
MarkStatement *beg_of_mem_writes_mark = create_mark_statement(env);
if(iter.is_valid())
insert_statement_before(iter.current(), beg_of_mem_writes_mark);
else
stmt_list_body->append_statement(beg_of_mem_writes_mark);
ba = create_brick_annote(env, "beg_of_mem_writes");
ba->append_brick(create_suif_object_brick(env, beg_of_mem_writes_mark));
c_for_stmt->append_annote(ba);
}
return Walker::Continue;
}
示例15: swap_elements
void swap_elements( Iter first, Iter second, boost::ptr_vector<T,C,A>& vec)
{
std::swap( *first.base(), *second.base());
}