本文整理汇总了C++中Label::add_patch_at方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::add_patch_at方法的具体用法?C++ Label::add_patch_at怎么用?C++ Label::add_patch_at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::add_patch_at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: target
// Helper function for managing labels and their target addresses.
// Returns a sensible address, and if it is not the label's final
// address, notes the dependency (at 'branch_pc') on the label.
address CodeSection::target(Label& L, address branch_pc) {
if (L.is_bound()) {
int loc = L.loc();
if (index() == CodeBuffer::locator_sect(loc)) {
return start() + CodeBuffer::locator_pos(loc);
} else {
return outer()->locator_address(loc);
}
} else {
assert(allocates2(branch_pc), "sanity");
address base = start();
int patch_loc = CodeBuffer::locator(branch_pc - base, index());
L.add_patch_at(outer(), patch_loc);
// Need to return a pc, doesn't matter what it is since it will be
// replaced during resolution later.
// Don't return NULL or badAddress, since branches shouldn't overflow.
// Don't return base either because that could overflow displacements
// for shorter branches. It will get checked when bound.
return branch_pc;
}
}