本文整理汇总了C++中BlockList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockList::clear方法的具体用法?C++ BlockList::clear怎么用?C++ BlockList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockList
的用法示例。
在下文中一共展示了BlockList::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool ShortLoopOptimizer::process(BlockBegin* loop_header) {
TRACE_VALUE_NUMBERING(tty->print_cr("** loop header block"));
_too_complicated_loop = false;
_loop_blocks.clear();
_loop_blocks.append(loop_header);
for (int i = 0; i < _loop_blocks.length(); i++) {
BlockBegin* block = _loop_blocks.at(i);
TRACE_VALUE_NUMBERING(tty->print_cr("processing loop block B%d", block->block_id()));
if (block->is_set(BlockBegin::exception_entry_flag)) {
// this would be too complicated
return false;
}
// add predecessors to worklist
for (int j = block->number_of_preds() - 1; j >= 0; j--) {
BlockBegin* pred = block->pred_at(j);
if (pred->is_set(BlockBegin::osr_entry_flag)) {
return false;
}
ValueMap* pred_map = value_map_of(pred);
if (pred_map != NULL) {
current_map()->kill_map(pred_map);
} else if (!_loop_blocks.contains(pred)) {
if (_loop_blocks.length() >= ValueMapMaxLoopSize) {
return false;
}
_loop_blocks.append(pred);
}
}
// use the instruction visitor for killing values
for (Value instr = block->next(); instr != NULL; instr = instr->next()) {
instr->visit(this);
if (_too_complicated_loop) {
return false;
}
}
}
bool optimistic = this->_gvn->compilation()->is_optimistic();
if (UseLoopInvariantCodeMotion && optimistic) {
LoopInvariantCodeMotion code_motion(this, _gvn, loop_header, &_loop_blocks);
}
TRACE_VALUE_NUMBERING(tty->print_cr("** loop successfully optimized"));
return true;
}
示例2: process_bin_file
void process_bin_file(char *file_name) {
int seq = 0;
FILE *fp = fopen(file_name, "rb");
if (!fp) {
abort_("[read_bin_file] File %s cound not be opened for reading", file_name);
}
fseek(fp, 0, SEEK_END);
long file_size = ftell(fp);
if (file_size % BLOCK_SIZE) {
abort_("[read_bin_file] File %s bad size", file_name);
}
fseek(fp, 0, SEEK_SET);
Block block;
block.resize(BLOCK_SIZE);
BlockList blockList;
for (int i=0; i<file_size/BLOCK_SIZE; ++i) {
if (BLOCK_SIZE != fread(&(block.front()), 1, BLOCK_SIZE, fp)) {
abort_("[read_bin_file] Fild %s read error", file_name);
}
if (0 == memcmp(&block.front(), FCC_TEX1, 4)) {
if (!blockList.empty()) {
ostringstream bc_file_name;
bc_file_name << file_name << "-" << seq << ".bc";
write_bc_file(blockList, bc_file_name.str());
seq ++;
blockList.clear();
}
blockList.push_back(block);
}
else {
blockList.push_back(block);
}
}
fclose(fp);
cout << "Done" << endl;
}