本文整理汇总了C++中AsmPrinter::GetExternalSymbolSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ AsmPrinter::GetExternalSymbolSymbol方法的具体用法?C++ AsmPrinter::GetExternalSymbolSymbol怎么用?C++ AsmPrinter::GetExternalSymbolSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsmPrinter
的用法示例。
在下文中一共展示了AsmPrinter::GetExternalSymbolSymbol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LowerRISCVMachineOperandToMCOperand
bool llvm::LowerRISCVMachineOperandToMCOperand(const MachineOperand &MO,
MCOperand &MCOp,
const AsmPrinter &AP) {
switch (MO.getType()) {
default:
report_fatal_error("LowerRISCVMachineInstrToMCInst: unknown operand type");
case MachineOperand::MO_Register:
// Ignore all implicit register operands.
if (MO.isImplicit())
return false;
MCOp = MCOperand::createReg(MO.getReg());
break;
case MachineOperand::MO_RegisterMask:
// Regmasks are like implicit defs.
return false;
case MachineOperand::MO_Immediate:
MCOp = MCOperand::createImm(MO.getImm());
break;
case MachineOperand::MO_MachineBasicBlock:
MCOp = lowerSymbolOperand(MO, MO.getMBB()->getSymbol(), AP);
break;
case MachineOperand::MO_GlobalAddress:
MCOp = lowerSymbolOperand(MO, AP.getSymbol(MO.getGlobal()), AP);
break;
case MachineOperand::MO_BlockAddress:
MCOp = lowerSymbolOperand(
MO, AP.GetBlockAddressSymbol(MO.getBlockAddress()), AP);
break;
case MachineOperand::MO_ExternalSymbol:
MCOp = lowerSymbolOperand(
MO, AP.GetExternalSymbolSymbol(MO.getSymbolName()), AP);
break;
case MachineOperand::MO_ConstantPoolIndex:
MCOp = lowerSymbolOperand(MO, AP.GetCPISymbol(MO.getIndex()), AP);
break;
}
return true;
}
示例2: LowerSymbolOperand
static MCOperand LowerSymbolOperand(const MachineInstr *MI,
const MachineOperand &MO,
AsmPrinter &AP) {
SparcMCExpr::VariantKind Kind =
(SparcMCExpr::VariantKind)MO.getTargetFlags();
const MCSymbol *Symbol = nullptr;
switch(MO.getType()) {
default: llvm_unreachable("Unknown type in LowerSymbolOperand");
case MachineOperand::MO_MachineBasicBlock:
Symbol = MO.getMBB()->getSymbol();
break;
case MachineOperand::MO_GlobalAddress:
Symbol = AP.getSymbol(MO.getGlobal());
break;
case MachineOperand::MO_BlockAddress:
Symbol = AP.GetBlockAddressSymbol(MO.getBlockAddress());
break;
case MachineOperand::MO_ExternalSymbol:
Symbol = AP.GetExternalSymbolSymbol(MO.getSymbolName());
break;
case MachineOperand::MO_ConstantPoolIndex:
Symbol = AP.GetCPISymbol(MO.getIndex());
break;
}
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::Create(Symbol,
AP.OutContext);
const SparcMCExpr *expr = SparcMCExpr::Create(Kind, MCSym,
AP.OutContext);
return MCOperand::createExpr(expr);
}
示例3: finishAssembly
//.........这里部分代码省略.........
}
}
}
} else {
// No metadata, so it's an object reference - just add the field offset.
fieldOffsets.push_back(offset);
}
}
// Nothing to trace? Then we're done.
if (fieldOffsets.empty() && traceMethods.empty()) {
continue;
}
// Create a folding set node and merge with any identical trace tables.
std::sort(fieldOffsets.begin(), fieldOffsets.end());
llvm::FoldingSetNodeID id;
StackTraceTable::ProfileEntries(id, fieldOffsets, traceMethods);
void * insertPos;
StackTraceTable * sTable = traceTables.FindNodeOrInsertPos(id, insertPos);
if (sTable == NULL) {
sTable = new StackTraceTable(fieldOffsets, traceMethods);
// Generate the labels for the trace table and field offset table.
sTable->fieldOffsetsLabel = AP.GetTempSymbol("gc_stack_offsets", nextLabel);
sTable->traceTableLabel = AP.GetTempSymbol("gc_stack", nextLabel++);
// Add to folding set
traceTables.InsertNode(sTable, insertPos);
// Generate the trace table
outStream.AddBlankLine();
AP.EmitAlignment(addressAlignLog);
// First the field offset descriptor
outStream.EmitLabel(sTable->traceTableLabel);
size_t traceMethodCount = sTable->traceMethods.size();
if (!sTable->fieldOffsets.empty()) {
outStream.EmitIntValue(traceMethodCount == 0 ? 1 : 0, 2, 0);
outStream.EmitIntValue(sTable->fieldOffsets.size(), 2, 0);
outStream.EmitIntValue(0, 4, 0);
outStream.EmitSymbolValue(sTable->fieldOffsetsLabel, pointerSize, 0);
}
// Next the trace method descriptors
for (size_t i = 0; i < traceMethodCount; ++i) {
const TraceMethodEntry * tm = &sTable->traceMethods[i];
const Function * method = dyn_cast<Function>(tm->method());
if (method == NULL) {
method = cast<Function>(tm->method()->getOperand(0));
}
outStream.EmitIntValue((i + 1 == traceMethodCount ? 1 : 0), 2, 0);
outStream.EmitIntValue(0, 2, 0);
outStream.EmitIntValue(tm->offset(), 4, 0);
MCSymbol * methodSym = AP.Mang->getSymbol(method);
outStream.EmitSymbolValue(methodSym, pointerSize, 0);
}
// Now emit the field offset array
outStream.AddBlankLine();
AP.EmitAlignment(addressAlignLog);
outStream.EmitLabel(sTable->fieldOffsetsLabel);
for (StackTraceTable::FieldOffsetList::const_iterator it = fieldOffsets.begin();
it != fieldOffsets.end(); ++it) {
outStream.EmitIntValue(*it, pointerSize, 0);
}
}
safePoints.push_back(std::pair<MCSymbol *, MCSymbol *>(sp->Label, sTable->traceTableLabel));
// if (optShowGC) {
// if (!sTable->fieldOffsets.empty()) {
// errs() << "GCStrategy: Field offset descriptor:";
// for (StackTraceTable::FieldOffsetList::const_iterator it = sTable->fieldOffsets.begin();
// it != sTable->fieldOffsets.end(); ++it) {
// errs() << " " << *it;
// }
// errs() << "\n";
// }
// if (!sTable->traceMethods.empty()) {
// errs() << "GCStrategy: Trace method descriptor: " << "\n";
// }
// }
}
}
// Finally, generate the safe point map.
outStream.AddBlankLine();
MCSymbol * gcSafepointSymbol = AP.GetExternalSymbolSymbol("GC_safepoint_map");
outStream.EmitSymbolAttribute(gcSafepointSymbol, MCSA_Global);
outStream.EmitLabel(gcSafepointSymbol);
outStream.EmitIntValue(safePoints.size(), pointerSize, 0);
for (SafePointList::const_iterator it = safePoints.begin(); it != safePoints.end(); ++it) {
outStream.EmitSymbolValue(it->first, pointerSize, 0);
outStream.EmitSymbolValue(it->second, pointerSize, 0);
}
}