当前位置: 首页>>代码示例>>C++>>正文


C++ AsmPrinter::GetTempSymbol方法代码示例

本文整理汇总了C++中AsmPrinter::GetTempSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ AsmPrinter::GetTempSymbol方法的具体用法?C++ AsmPrinter::GetTempSymbol怎么用?C++ AsmPrinter::GetTempSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AsmPrinter的用法示例。


在下文中一共展示了AsmPrinter::GetTempSymbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: finishAssembly


//.........这里部分代码省略.........
                                // safe point.
                                const ConstantArray * fieldOffsetArray = cast<ConstantArray>(
                                            fieldOffsetsVar->getInitializer());
                                for (ConstantArray::const_op_iterator el = fieldOffsetArray->op_begin();
                                        el != fieldOffsetArray->op_end(); ++el) {
                                    fieldOffsets.push_back(
                                        offset + dscOffset + toInt(cast<llvm::Constant>(*el), AP.TM));
                                }
                            }
                        }
                    }
                } 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);
开发者ID:catb0t,项目名称:tart,代码行数:67,代码来源:GCStrategy.cpp


注:本文中的AsmPrinter::GetTempSymbol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。