17330f729Sjoerg //===-- lib/MC/Disassembler.cpp - Disassembler Public C Interface ---------===//
27330f729Sjoerg //
37330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
47330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
57330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67330f729Sjoerg //
77330f729Sjoerg //===----------------------------------------------------------------------===//
87330f729Sjoerg
97330f729Sjoerg #include "Disassembler.h"
107330f729Sjoerg #include "llvm-c/Disassembler.h"
117330f729Sjoerg #include "llvm/ADT/ArrayRef.h"
127330f729Sjoerg #include "llvm/ADT/SmallVector.h"
137330f729Sjoerg #include "llvm/ADT/Triple.h"
147330f729Sjoerg #include "llvm/MC/MCAsmInfo.h"
157330f729Sjoerg #include "llvm/MC/MCContext.h"
167330f729Sjoerg #include "llvm/MC/MCDisassembler/MCDisassembler.h"
177330f729Sjoerg #include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
187330f729Sjoerg #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
197330f729Sjoerg #include "llvm/MC/MCInst.h"
207330f729Sjoerg #include "llvm/MC/MCInstPrinter.h"
217330f729Sjoerg #include "llvm/MC/MCInstrDesc.h"
227330f729Sjoerg #include "llvm/MC/MCInstrInfo.h"
237330f729Sjoerg #include "llvm/MC/MCInstrItineraries.h"
247330f729Sjoerg #include "llvm/MC/MCRegisterInfo.h"
257330f729Sjoerg #include "llvm/MC/MCSchedule.h"
267330f729Sjoerg #include "llvm/MC/MCSubtargetInfo.h"
277330f729Sjoerg #include "llvm/MC/MCTargetOptions.h"
287330f729Sjoerg #include "llvm/Support/ErrorHandling.h"
297330f729Sjoerg #include "llvm/Support/FormattedStream.h"
307330f729Sjoerg #include "llvm/Support/TargetRegistry.h"
317330f729Sjoerg #include "llvm/Support/raw_ostream.h"
327330f729Sjoerg #include <cassert>
337330f729Sjoerg #include <cstddef>
347330f729Sjoerg #include <cstring>
357330f729Sjoerg
367330f729Sjoerg using namespace llvm;
377330f729Sjoerg
387330f729Sjoerg // LLVMCreateDisasm() creates a disassembler for the TripleName. Symbolic
397330f729Sjoerg // disassembly is supported by passing a block of information in the DisInfo
407330f729Sjoerg // parameter and specifying the TagType and callback functions as described in
417330f729Sjoerg // the header llvm-c/Disassembler.h . The pointer to the block and the
427330f729Sjoerg // functions can all be passed as NULL. If successful, this returns a
437330f729Sjoerg // disassembler context. If not, it returns NULL.
447330f729Sjoerg //
457330f729Sjoerg LLVMDisasmContextRef
LLVMCreateDisasmCPUFeatures(const char * TT,const char * CPU,const char * Features,void * DisInfo,int TagType,LLVMOpInfoCallback GetOpInfo,LLVMSymbolLookupCallback SymbolLookUp)467330f729Sjoerg LLVMCreateDisasmCPUFeatures(const char *TT, const char *CPU,
477330f729Sjoerg const char *Features, void *DisInfo, int TagType,
487330f729Sjoerg LLVMOpInfoCallback GetOpInfo,
497330f729Sjoerg LLVMSymbolLookupCallback SymbolLookUp) {
507330f729Sjoerg // Get the target.
517330f729Sjoerg std::string Error;
527330f729Sjoerg const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
537330f729Sjoerg if (!TheTarget)
547330f729Sjoerg return nullptr;
557330f729Sjoerg
567330f729Sjoerg std::unique_ptr<const MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TT));
577330f729Sjoerg if (!MRI)
587330f729Sjoerg return nullptr;
597330f729Sjoerg
607330f729Sjoerg MCTargetOptions MCOptions;
617330f729Sjoerg // Get the assembler info needed to setup the MCContext.
627330f729Sjoerg std::unique_ptr<const MCAsmInfo> MAI(
637330f729Sjoerg TheTarget->createMCAsmInfo(*MRI, TT, MCOptions));
647330f729Sjoerg if (!MAI)
657330f729Sjoerg return nullptr;
667330f729Sjoerg
677330f729Sjoerg std::unique_ptr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo());
687330f729Sjoerg if (!MII)
697330f729Sjoerg return nullptr;
707330f729Sjoerg
717330f729Sjoerg std::unique_ptr<const MCSubtargetInfo> STI(
727330f729Sjoerg TheTarget->createMCSubtargetInfo(TT, CPU, Features));
737330f729Sjoerg if (!STI)
747330f729Sjoerg return nullptr;
757330f729Sjoerg
767330f729Sjoerg // Set up the MCContext for creating symbols and MCExpr's.
77*82d56013Sjoerg std::unique_ptr<MCContext> Ctx(
78*82d56013Sjoerg new MCContext(Triple(TT), MAI.get(), MRI.get(), STI.get()));
797330f729Sjoerg if (!Ctx)
807330f729Sjoerg return nullptr;
817330f729Sjoerg
827330f729Sjoerg // Set up disassembler.
837330f729Sjoerg std::unique_ptr<MCDisassembler> DisAsm(
847330f729Sjoerg TheTarget->createMCDisassembler(*STI, *Ctx));
857330f729Sjoerg if (!DisAsm)
867330f729Sjoerg return nullptr;
877330f729Sjoerg
887330f729Sjoerg std::unique_ptr<MCRelocationInfo> RelInfo(
897330f729Sjoerg TheTarget->createMCRelocationInfo(TT, *Ctx));
907330f729Sjoerg if (!RelInfo)
917330f729Sjoerg return nullptr;
927330f729Sjoerg
937330f729Sjoerg std::unique_ptr<MCSymbolizer> Symbolizer(TheTarget->createMCSymbolizer(
947330f729Sjoerg TT, GetOpInfo, SymbolLookUp, DisInfo, Ctx.get(), std::move(RelInfo)));
957330f729Sjoerg DisAsm->setSymbolizer(std::move(Symbolizer));
967330f729Sjoerg
977330f729Sjoerg // Set up the instruction printer.
987330f729Sjoerg int AsmPrinterVariant = MAI->getAssemblerDialect();
997330f729Sjoerg std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
1007330f729Sjoerg Triple(TT), AsmPrinterVariant, *MAI, *MII, *MRI));
1017330f729Sjoerg if (!IP)
1027330f729Sjoerg return nullptr;
1037330f729Sjoerg
1047330f729Sjoerg LLVMDisasmContext *DC = new LLVMDisasmContext(
1057330f729Sjoerg TT, DisInfo, TagType, GetOpInfo, SymbolLookUp, TheTarget, std::move(MAI),
1067330f729Sjoerg std::move(MRI), std::move(STI), std::move(MII), std::move(Ctx),
1077330f729Sjoerg std::move(DisAsm), std::move(IP));
1087330f729Sjoerg if (!DC)
1097330f729Sjoerg return nullptr;
1107330f729Sjoerg
1117330f729Sjoerg DC->setCPU(CPU);
1127330f729Sjoerg return DC;
1137330f729Sjoerg }
1147330f729Sjoerg
1157330f729Sjoerg LLVMDisasmContextRef
LLVMCreateDisasmCPU(const char * TT,const char * CPU,void * DisInfo,int TagType,LLVMOpInfoCallback GetOpInfo,LLVMSymbolLookupCallback SymbolLookUp)1167330f729Sjoerg LLVMCreateDisasmCPU(const char *TT, const char *CPU, void *DisInfo, int TagType,
1177330f729Sjoerg LLVMOpInfoCallback GetOpInfo,
1187330f729Sjoerg LLVMSymbolLookupCallback SymbolLookUp) {
1197330f729Sjoerg return LLVMCreateDisasmCPUFeatures(TT, CPU, "", DisInfo, TagType, GetOpInfo,
1207330f729Sjoerg SymbolLookUp);
1217330f729Sjoerg }
1227330f729Sjoerg
LLVMCreateDisasm(const char * TT,void * DisInfo,int TagType,LLVMOpInfoCallback GetOpInfo,LLVMSymbolLookupCallback SymbolLookUp)1237330f729Sjoerg LLVMDisasmContextRef LLVMCreateDisasm(const char *TT, void *DisInfo,
1247330f729Sjoerg int TagType, LLVMOpInfoCallback GetOpInfo,
1257330f729Sjoerg LLVMSymbolLookupCallback SymbolLookUp) {
1267330f729Sjoerg return LLVMCreateDisasmCPUFeatures(TT, "", "", DisInfo, TagType, GetOpInfo,
1277330f729Sjoerg SymbolLookUp);
1287330f729Sjoerg }
1297330f729Sjoerg
1307330f729Sjoerg //
1317330f729Sjoerg // LLVMDisasmDispose() disposes of the disassembler specified by the context.
1327330f729Sjoerg //
LLVMDisasmDispose(LLVMDisasmContextRef DCR)1337330f729Sjoerg void LLVMDisasmDispose(LLVMDisasmContextRef DCR){
1347330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
1357330f729Sjoerg delete DC;
1367330f729Sjoerg }
1377330f729Sjoerg
1387330f729Sjoerg /// Emits the comments that are stored in \p DC comment stream.
1397330f729Sjoerg /// Each comment in the comment stream must end with a newline.
emitComments(LLVMDisasmContext * DC,formatted_raw_ostream & FormattedOS)1407330f729Sjoerg static void emitComments(LLVMDisasmContext *DC,
1417330f729Sjoerg formatted_raw_ostream &FormattedOS) {
1427330f729Sjoerg // Flush the stream before taking its content.
1437330f729Sjoerg StringRef Comments = DC->CommentsToEmit.str();
1447330f729Sjoerg // Get the default information for printing a comment.
1457330f729Sjoerg const MCAsmInfo *MAI = DC->getAsmInfo();
1467330f729Sjoerg StringRef CommentBegin = MAI->getCommentString();
1477330f729Sjoerg unsigned CommentColumn = MAI->getCommentColumn();
1487330f729Sjoerg bool IsFirst = true;
1497330f729Sjoerg while (!Comments.empty()) {
1507330f729Sjoerg if (!IsFirst)
1517330f729Sjoerg FormattedOS << '\n';
1527330f729Sjoerg // Emit a line of comments.
1537330f729Sjoerg FormattedOS.PadToColumn(CommentColumn);
1547330f729Sjoerg size_t Position = Comments.find('\n');
1557330f729Sjoerg FormattedOS << CommentBegin << ' ' << Comments.substr(0, Position);
1567330f729Sjoerg // Move after the newline character.
1577330f729Sjoerg Comments = Comments.substr(Position+1);
1587330f729Sjoerg IsFirst = false;
1597330f729Sjoerg }
1607330f729Sjoerg FormattedOS.flush();
1617330f729Sjoerg
1627330f729Sjoerg // Tell the comment stream that the vector changed underneath it.
1637330f729Sjoerg DC->CommentsToEmit.clear();
1647330f729Sjoerg }
1657330f729Sjoerg
1667330f729Sjoerg /// Gets latency information for \p Inst from the itinerary
1677330f729Sjoerg /// scheduling model, based on \p DC information.
1687330f729Sjoerg /// \return The maximum expected latency over all the operands or -1
1697330f729Sjoerg /// if no information is available.
getItineraryLatency(LLVMDisasmContext * DC,const MCInst & Inst)1707330f729Sjoerg static int getItineraryLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
1717330f729Sjoerg const int NoInformationAvailable = -1;
1727330f729Sjoerg
1737330f729Sjoerg // Check if we have a CPU to get the itinerary information.
1747330f729Sjoerg if (DC->getCPU().empty())
1757330f729Sjoerg return NoInformationAvailable;
1767330f729Sjoerg
1777330f729Sjoerg // Get itinerary information.
1787330f729Sjoerg const MCSubtargetInfo *STI = DC->getSubtargetInfo();
1797330f729Sjoerg InstrItineraryData IID = STI->getInstrItineraryForCPU(DC->getCPU());
1807330f729Sjoerg // Get the scheduling class of the requested instruction.
1817330f729Sjoerg const MCInstrDesc& Desc = DC->getInstrInfo()->get(Inst.getOpcode());
1827330f729Sjoerg unsigned SCClass = Desc.getSchedClass();
1837330f729Sjoerg
1847330f729Sjoerg int Latency = 0;
1857330f729Sjoerg for (unsigned OpIdx = 0, OpIdxEnd = Inst.getNumOperands(); OpIdx != OpIdxEnd;
1867330f729Sjoerg ++OpIdx)
1877330f729Sjoerg Latency = std::max(Latency, IID.getOperandCycle(SCClass, OpIdx));
1887330f729Sjoerg
1897330f729Sjoerg return Latency;
1907330f729Sjoerg }
1917330f729Sjoerg
1927330f729Sjoerg /// Gets latency information for \p Inst, based on \p DC information.
1937330f729Sjoerg /// \return The maximum expected latency over all the definitions or -1
1947330f729Sjoerg /// if no information is available.
getLatency(LLVMDisasmContext * DC,const MCInst & Inst)1957330f729Sjoerg static int getLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
1967330f729Sjoerg // Try to compute scheduling information.
1977330f729Sjoerg const MCSubtargetInfo *STI = DC->getSubtargetInfo();
1987330f729Sjoerg const MCSchedModel SCModel = STI->getSchedModel();
1997330f729Sjoerg const int NoInformationAvailable = -1;
2007330f729Sjoerg
2017330f729Sjoerg // Check if we have a scheduling model for instructions.
2027330f729Sjoerg if (!SCModel.hasInstrSchedModel())
2037330f729Sjoerg // Try to fall back to the itinerary model if the scheduling model doesn't
2047330f729Sjoerg // have a scheduling table. Note the default does not have a table.
2057330f729Sjoerg return getItineraryLatency(DC, Inst);
2067330f729Sjoerg
2077330f729Sjoerg // Get the scheduling class of the requested instruction.
2087330f729Sjoerg const MCInstrDesc& Desc = DC->getInstrInfo()->get(Inst.getOpcode());
2097330f729Sjoerg unsigned SCClass = Desc.getSchedClass();
2107330f729Sjoerg const MCSchedClassDesc *SCDesc = SCModel.getSchedClassDesc(SCClass);
2117330f729Sjoerg // Resolving the variant SchedClass requires an MI to pass to
2127330f729Sjoerg // SubTargetInfo::resolveSchedClass.
2137330f729Sjoerg if (!SCDesc || !SCDesc->isValid() || SCDesc->isVariant())
2147330f729Sjoerg return NoInformationAvailable;
2157330f729Sjoerg
2167330f729Sjoerg // Compute output latency.
2177330f729Sjoerg int16_t Latency = 0;
2187330f729Sjoerg for (unsigned DefIdx = 0, DefEnd = SCDesc->NumWriteLatencyEntries;
2197330f729Sjoerg DefIdx != DefEnd; ++DefIdx) {
2207330f729Sjoerg // Lookup the definition's write latency in SubtargetInfo.
2217330f729Sjoerg const MCWriteLatencyEntry *WLEntry = STI->getWriteLatencyEntry(SCDesc,
2227330f729Sjoerg DefIdx);
2237330f729Sjoerg Latency = std::max(Latency, WLEntry->Cycles);
2247330f729Sjoerg }
2257330f729Sjoerg
2267330f729Sjoerg return Latency;
2277330f729Sjoerg }
2287330f729Sjoerg
2297330f729Sjoerg /// Emits latency information in DC->CommentStream for \p Inst, based
2307330f729Sjoerg /// on the information available in \p DC.
emitLatency(LLVMDisasmContext * DC,const MCInst & Inst)2317330f729Sjoerg static void emitLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
2327330f729Sjoerg int Latency = getLatency(DC, Inst);
2337330f729Sjoerg
2347330f729Sjoerg // Report only interesting latencies.
2357330f729Sjoerg if (Latency < 2)
2367330f729Sjoerg return;
2377330f729Sjoerg
2387330f729Sjoerg DC->CommentStream << "Latency: " << Latency << '\n';
2397330f729Sjoerg }
2407330f729Sjoerg
2417330f729Sjoerg //
2427330f729Sjoerg // LLVMDisasmInstruction() disassembles a single instruction using the
2437330f729Sjoerg // disassembler context specified in the parameter DC. The bytes of the
2447330f729Sjoerg // instruction are specified in the parameter Bytes, and contains at least
2457330f729Sjoerg // BytesSize number of bytes. The instruction is at the address specified by
2467330f729Sjoerg // the PC parameter. If a valid instruction can be disassembled its string is
2477330f729Sjoerg // returned indirectly in OutString which whos size is specified in the
2487330f729Sjoerg // parameter OutStringSize. This function returns the number of bytes in the
2497330f729Sjoerg // instruction or zero if there was no valid instruction. If this function
2507330f729Sjoerg // returns zero the caller will have to pick how many bytes they want to step
2517330f729Sjoerg // over by printing a .byte, .long etc. to continue.
2527330f729Sjoerg //
LLVMDisasmInstruction(LLVMDisasmContextRef DCR,uint8_t * Bytes,uint64_t BytesSize,uint64_t PC,char * OutString,size_t OutStringSize)2537330f729Sjoerg size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
2547330f729Sjoerg uint64_t BytesSize, uint64_t PC, char *OutString,
2557330f729Sjoerg size_t OutStringSize){
2567330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
2577330f729Sjoerg // Wrap the pointer to the Bytes, BytesSize and PC in a MemoryObject.
2587330f729Sjoerg ArrayRef<uint8_t> Data(Bytes, BytesSize);
2597330f729Sjoerg
2607330f729Sjoerg uint64_t Size;
2617330f729Sjoerg MCInst Inst;
2627330f729Sjoerg const MCDisassembler *DisAsm = DC->getDisAsm();
2637330f729Sjoerg MCInstPrinter *IP = DC->getIP();
2647330f729Sjoerg MCDisassembler::DecodeStatus S;
2657330f729Sjoerg SmallVector<char, 64> InsnStr;
2667330f729Sjoerg raw_svector_ostream Annotations(InsnStr);
267*82d56013Sjoerg S = DisAsm->getInstruction(Inst, Size, Data, PC, Annotations);
2687330f729Sjoerg switch (S) {
2697330f729Sjoerg case MCDisassembler::Fail:
2707330f729Sjoerg case MCDisassembler::SoftFail:
2717330f729Sjoerg // FIXME: Do something different for soft failure modes?
2727330f729Sjoerg return 0;
2737330f729Sjoerg
2747330f729Sjoerg case MCDisassembler::Success: {
2757330f729Sjoerg StringRef AnnotationsStr = Annotations.str();
2767330f729Sjoerg
2777330f729Sjoerg SmallVector<char, 64> InsnStr;
2787330f729Sjoerg raw_svector_ostream OS(InsnStr);
2797330f729Sjoerg formatted_raw_ostream FormattedOS(OS);
280*82d56013Sjoerg IP->printInst(&Inst, PC, AnnotationsStr, *DC->getSubtargetInfo(),
281*82d56013Sjoerg FormattedOS);
2827330f729Sjoerg
2837330f729Sjoerg if (DC->getOptions() & LLVMDisassembler_Option_PrintLatency)
2847330f729Sjoerg emitLatency(DC, Inst);
2857330f729Sjoerg
2867330f729Sjoerg emitComments(DC, FormattedOS);
2877330f729Sjoerg
2887330f729Sjoerg assert(OutStringSize != 0 && "Output buffer cannot be zero size");
2897330f729Sjoerg size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
2907330f729Sjoerg std::memcpy(OutString, InsnStr.data(), OutputSize);
2917330f729Sjoerg OutString[OutputSize] = '\0'; // Terminate string.
2927330f729Sjoerg
2937330f729Sjoerg return Size;
2947330f729Sjoerg }
2957330f729Sjoerg }
2967330f729Sjoerg llvm_unreachable("Invalid DecodeStatus!");
2977330f729Sjoerg }
2987330f729Sjoerg
2997330f729Sjoerg //
3007330f729Sjoerg // LLVMSetDisasmOptions() sets the disassembler's options. It returns 1 if it
3017330f729Sjoerg // can set all the Options and 0 otherwise.
3027330f729Sjoerg //
LLVMSetDisasmOptions(LLVMDisasmContextRef DCR,uint64_t Options)3037330f729Sjoerg int LLVMSetDisasmOptions(LLVMDisasmContextRef DCR, uint64_t Options){
3047330f729Sjoerg if (Options & LLVMDisassembler_Option_UseMarkup){
3057330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
3067330f729Sjoerg MCInstPrinter *IP = DC->getIP();
3077330f729Sjoerg IP->setUseMarkup(true);
3087330f729Sjoerg DC->addOptions(LLVMDisassembler_Option_UseMarkup);
3097330f729Sjoerg Options &= ~LLVMDisassembler_Option_UseMarkup;
3107330f729Sjoerg }
3117330f729Sjoerg if (Options & LLVMDisassembler_Option_PrintImmHex){
3127330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
3137330f729Sjoerg MCInstPrinter *IP = DC->getIP();
3147330f729Sjoerg IP->setPrintImmHex(true);
3157330f729Sjoerg DC->addOptions(LLVMDisassembler_Option_PrintImmHex);
3167330f729Sjoerg Options &= ~LLVMDisassembler_Option_PrintImmHex;
3177330f729Sjoerg }
3187330f729Sjoerg if (Options & LLVMDisassembler_Option_AsmPrinterVariant){
3197330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
3207330f729Sjoerg // Try to set up the new instruction printer.
3217330f729Sjoerg const MCAsmInfo *MAI = DC->getAsmInfo();
3227330f729Sjoerg const MCInstrInfo *MII = DC->getInstrInfo();
3237330f729Sjoerg const MCRegisterInfo *MRI = DC->getRegisterInfo();
3247330f729Sjoerg int AsmPrinterVariant = MAI->getAssemblerDialect();
3257330f729Sjoerg AsmPrinterVariant = AsmPrinterVariant == 0 ? 1 : 0;
3267330f729Sjoerg MCInstPrinter *IP = DC->getTarget()->createMCInstPrinter(
3277330f729Sjoerg Triple(DC->getTripleName()), AsmPrinterVariant, *MAI, *MII, *MRI);
3287330f729Sjoerg if (IP) {
3297330f729Sjoerg DC->setIP(IP);
3307330f729Sjoerg DC->addOptions(LLVMDisassembler_Option_AsmPrinterVariant);
3317330f729Sjoerg Options &= ~LLVMDisassembler_Option_AsmPrinterVariant;
3327330f729Sjoerg }
3337330f729Sjoerg }
3347330f729Sjoerg if (Options & LLVMDisassembler_Option_SetInstrComments) {
3357330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
3367330f729Sjoerg MCInstPrinter *IP = DC->getIP();
3377330f729Sjoerg IP->setCommentStream(DC->CommentStream);
3387330f729Sjoerg DC->addOptions(LLVMDisassembler_Option_SetInstrComments);
3397330f729Sjoerg Options &= ~LLVMDisassembler_Option_SetInstrComments;
3407330f729Sjoerg }
3417330f729Sjoerg if (Options & LLVMDisassembler_Option_PrintLatency) {
3427330f729Sjoerg LLVMDisasmContext *DC = static_cast<LLVMDisasmContext *>(DCR);
3437330f729Sjoerg DC->addOptions(LLVMDisassembler_Option_PrintLatency);
3447330f729Sjoerg Options &= ~LLVMDisassembler_Option_PrintLatency;
3457330f729Sjoerg }
3467330f729Sjoerg return (Options == 0);
3477330f729Sjoerg }
348