本文整理汇总了C++中MCSymbol::isDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ MCSymbol::isDefined方法的具体用法?C++ MCSymbol::isDefined怎么用?C++ MCSymbol::isDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCSymbol
的用法示例。
在下文中一共展示了MCSymbol::isDefined方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tidyLandingPads
void MachineFunction::tidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {
for (unsigned i = 0; i != LandingPads.size(); ) {
LandingPadInfo &LandingPad = LandingPads[i];
if (LandingPad.LandingPadLabel &&
!LandingPad.LandingPadLabel->isDefined() &&
(!LPMap || (*LPMap)[LandingPad.LandingPadLabel] == 0))
LandingPad.LandingPadLabel = nullptr;
// Special case: we *should* emit LPs with null LP MBB. This indicates
// "nounwind" case.
if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {
LandingPads.erase(LandingPads.begin() + i);
continue;
}
for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
MCSymbol *BeginLabel = LandingPad.BeginLabels[j];
MCSymbol *EndLabel = LandingPad.EndLabels[j];
if ((BeginLabel->isDefined() ||
(LPMap && (*LPMap)[BeginLabel] != 0)) &&
(EndLabel->isDefined() ||
(LPMap && (*LPMap)[EndLabel] != 0))) continue;
LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
--j;
--e;
}
// Remove landing pads with no try-ranges.
if (LandingPads[i].BeginLabels.empty()) {
LandingPads.erase(LandingPads.begin() + i);
continue;
}
// If there is no landing pad, ensure that the list of typeids is empty.
// If the only typeid is a cleanup, this is the same as having no typeids.
if (!LandingPad.LandingPadBlock ||
(LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0]))
LandingPad.TypeIds.clear();
++i;
}
}
示例2: getEntryAddress
uint32_t SVMMemoryLayout::getEntryAddress(const MCAssembler &Asm,
const MCAsmLayout &Layout) const
{
MCSymbol *S = Asm.getContext().LookupSymbol("main");
if (!S || !S->isDefined())
report_fatal_error("No entry point exists. Is main() defined?");
SVMSymbolInfo SI = getSymbol(Asm, Layout, S);
assert(SI.Kind == SVMSymbolInfo::LOCAL);
return SI.Value;
}
示例3: parseDirectiveAltEntry
/// parseDirectiveAltEntry
/// ::= .alt_entry identifier
bool DarwinAsmParser::parseDirectiveAltEntry(StringRef, SMLoc) {
StringRef Name;
if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive");
// Look up symbol.
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
if (Sym->isDefined())
return TokError(".alt_entry must preceed symbol definition");
if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_AltEntry))
return TokError("unable to emit symbol attribute");
Lex();
return false;
}
示例4: UpdateForDeletedBlock
void MMIAddrLabelMap::UpdateForDeletedBlock(BasicBlock *BB) {
// If the block got deleted, there is no need for the symbol. If the symbol
// was already emitted, we can just forget about it, otherwise we need to
// queue it up for later emission when the function is output.
AddrLabelSymEntry Entry = AddrLabelSymbols[BB];
AddrLabelSymbols.erase(BB);
assert(!Entry.Symbols.isNull() && "Didn't have a symbol, why a callback?");
BBCallbacks[Entry.Index] = nullptr; // Clear the callback.
assert((BB->getParent() == nullptr || BB->getParent() == Entry.Fn) &&
"Block/parent mismatch");
// Handle both the single and the multiple symbols cases.
if (MCSymbol *Sym = Entry.Symbols.dyn_cast<MCSymbol*>()) {
if (Sym->isDefined())
return;
// If the block is not yet defined, we need to emit it at the end of the
// function. Add the symbol to the DeletedAddrLabelsNeedingEmission list
// for the containing Function. Since the block is being deleted, its
// parent may already be removed, we have to get the function from 'Entry'.
DeletedAddrLabelsNeedingEmission[Entry.Fn].push_back(Sym);
} else {
std::vector<MCSymbol*> *Syms = Entry.Symbols.get<std::vector<MCSymbol*>*>();
for (unsigned i = 0, e = Syms->size(); i != e; ++i) {
MCSymbol *Sym = (*Syms)[i];
if (Sym->isDefined()) continue; // Ignore already emitted labels.
// If the block is not yet defined, we need to emit it at the end of the
// function. Add the symbol to the DeletedAddrLabelsNeedingEmission list
// for the containing Function. Since the block is being deleted, its
// parent may already be removed, we have to get the function from
// 'Entry'.
DeletedAddrLabelsNeedingEmission[Entry.Fn].push_back(Sym);
}
// The entry is deleted, free the memory associated with the symbol list.
delete Syms;
}
}
示例5: EmitFrameMoves
/// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame.
void AsmPrinter::EmitFrameMoves(const std::vector<MachineMove> &Moves,
MCSymbol *BaseLabel, bool isEH) const {
const TargetRegisterInfo *RI = TM.getRegisterInfo();
int stackGrowth = TM.getTargetData()->getPointerSize();
if (TM.getFrameInfo()->getStackGrowthDirection() !=
TargetFrameInfo::StackGrowsUp)
stackGrowth *= -1;
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
const MachineMove &Move = Moves[i];
MCSymbol *Label = Move.getLabel();
// Throw out move if the label is invalid.
if (Label && !Label->isDefined()) continue; // Not emitted, in dead code.
const MachineLocation &Dst = Move.getDestination();
const MachineLocation &Src = Move.getSource();
// Advance row if new location.
if (BaseLabel && Label) {
MCSymbol *ThisSym = Label;
if (ThisSym != BaseLabel) {
EmitCFAByte(dwarf::DW_CFA_advance_loc4);
EmitLabelDifference(ThisSym, BaseLabel, 4);
BaseLabel = ThisSym;
}
}
// If advancing cfa.
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
assert(!Src.isReg() && "Machine move not supported yet.");
if (Src.getReg() == MachineLocation::VirtualFP) {
EmitCFAByte(dwarf::DW_CFA_def_cfa_offset);
} else {
EmitCFAByte(dwarf::DW_CFA_def_cfa);
EmitULEB128(RI->getDwarfRegNum(Src.getReg(), isEH), "Register");
}
EmitULEB128(-Src.getOffset(), "Offset");
continue;
}
if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
assert(Dst.isReg() && "Machine move not supported yet.");
EmitCFAByte(dwarf::DW_CFA_def_cfa_register);
EmitULEB128(RI->getDwarfRegNum(Dst.getReg(), isEH), "Register");
continue;
}
unsigned Reg = RI->getDwarfRegNum(Src.getReg(), isEH);
int Offset = Dst.getOffset() / stackGrowth;
if (Offset < 0) {
EmitCFAByte(dwarf::DW_CFA_offset_extended_sf);
EmitULEB128(Reg, "Reg");
EmitSLEB128(Offset, "Offset");
} else if (Reg < 64) {
EmitCFAByte(dwarf::DW_CFA_offset + Reg);
EmitULEB128(Offset, "Offset");
} else {
EmitCFAByte(dwarf::DW_CFA_offset_extended);
EmitULEB128(Reg, "Reg");
EmitULEB128(Offset, "Offset");
}
}
}