blob: 82063fb74696d8e8d5adcbdc296441cc5b7e7461 [file] [log] [blame]
Nick Lewycky2e2d75f2011-09-01 21:09:04 +00001//===-- lib/MC/Disassembler.cpp - Disassembler Public C Interface ---------===//
Kevin Enderbyf3070dc2011-03-28 18:25:07 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Chris Lattner0388fb02011-05-22 04:52:24 +00009
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000010#include "Disassembler.h"
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000011#include "llvm-c/Disassembler.h"
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000012#include "llvm/MC/MCAsmInfo.h"
Evan Cheng345b6b42011-07-20 06:54:19 +000013#include "llvm/MC/MCContext.h"
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000014#include "llvm/MC/MCDisassembler.h"
15#include "llvm/MC/MCInst.h"
16#include "llvm/MC/MCInstPrinter.h"
Sean Callanane804b5b2012-04-06 18:21:09 +000017#include "llvm/MC/MCInstrInfo.h"
Evan Cheng345b6b42011-07-20 06:54:19 +000018#include "llvm/MC/MCRegisterInfo.h"
Ahmed Bougachaad1084d2013-05-24 00:39:57 +000019#include "llvm/MC/MCRelocationInfo.h"
Sean Callanane804b5b2012-04-06 18:21:09 +000020#include "llvm/MC/MCSubtargetInfo.h"
Quentin Colombetf4828052013-05-24 22:51:52 +000021#include "llvm/MC/MCSymbolizer.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000022#include "llvm/Support/ErrorHandling.h"
Quentin Colombet93a98aa2013-10-01 22:14:56 +000023#include "llvm/Support/FormattedStream.h"
Evan Cheng2bb40352011-08-24 18:08:43 +000024#include "llvm/Support/TargetRegistry.h"
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000025
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000026using namespace llvm;
27
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000028// LLVMCreateDisasm() creates a disassembler for the TripleName. Symbolic
29// disassembly is supported by passing a block of information in the DisInfo
Chris Lattner0388fb02011-05-22 04:52:24 +000030// parameter and specifying the TagType and callback functions as described in
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000031// the header llvm-c/Disassembler.h . The pointer to the block and the
Chris Lattner0388fb02011-05-22 04:52:24 +000032// functions can all be passed as NULL. If successful, this returns a
33// disassembler context. If not, it returns NULL.
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000034//
Bradley Smith7a770752014-09-30 16:31:40 +000035LLVMDisasmContextRef
Eric Christopher71b1e5f2015-03-30 22:31:14 +000036LLVMCreateDisasmCPUFeatures(const char *TT, const char *CPU,
Bradley Smith7a770752014-09-30 16:31:40 +000037 const char *Features, void *DisInfo, int TagType,
38 LLVMOpInfoCallback GetOpInfo,
39 LLVMSymbolLookupCallback SymbolLookUp) {
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000040 // Get the target.
41 std::string Error;
Eric Christopher71b1e5f2015-03-30 22:31:14 +000042 const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
Kevin Enderby64d93452013-05-23 00:32:34 +000043 if (!TheTarget)
Craig Topper353eda42014-04-24 06:44:33 +000044 return nullptr;
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000045
Eric Christopher71b1e5f2015-03-30 22:31:14 +000046 const MCRegisterInfo *MRI = TheTarget->createMCRegInfo(TT);
Rafael Espindola227144c2013-05-13 01:16:13 +000047 if (!MRI)
Craig Topper353eda42014-04-24 06:44:33 +000048 return nullptr;
Rafael Espindola227144c2013-05-13 01:16:13 +000049
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000050 // Get the assembler info needed to setup the MCContext.
Eric Christopher71b1e5f2015-03-30 22:31:14 +000051 const MCAsmInfo *MAI = TheTarget->createMCAsmInfo(*MRI, TT);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000052 if (!MAI)
Craig Topper353eda42014-04-24 06:44:33 +000053 return nullptr;
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000054
Craig Topper54bfde72012-04-02 06:09:36 +000055 const MCInstrInfo *MII = TheTarget->createMCInstrInfo();
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000056 if (!MII)
Craig Topper353eda42014-04-24 06:44:33 +000057 return nullptr;
Craig Topper54bfde72012-04-02 06:09:36 +000058
Eric Christopher71b1e5f2015-03-30 22:31:14 +000059 const MCSubtargetInfo *STI =
60 TheTarget->createMCSubtargetInfo(TT, CPU, Features);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000061 if (!STI)
Craig Topper353eda42014-04-24 06:44:33 +000062 return nullptr;
James Molloy4c493e82011-09-07 17:24:38 +000063
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000064 // Set up the MCContext for creating symbols and MCExpr's.
Craig Topper353eda42014-04-24 06:44:33 +000065 MCContext *Ctx = new MCContext(MAI, MRI, nullptr);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000066 if (!Ctx)
Craig Topper353eda42014-04-24 06:44:33 +000067 return nullptr;
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000068
69 // Set up disassembler.
Lang Hamesa1bc0f52014-04-15 04:40:56 +000070 MCDisassembler *DisAsm = TheTarget->createMCDisassembler(*STI, *Ctx);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000071 if (!DisAsm)
Craig Topper353eda42014-04-24 06:44:33 +000072 return nullptr;
Ahmed Bougachaad1084d2013-05-24 00:39:57 +000073
Ahmed Charles56440fd2014-03-06 05:51:42 +000074 std::unique_ptr<MCRelocationInfo> RelInfo(
Eric Christopher71b1e5f2015-03-30 22:31:14 +000075 TheTarget->createMCRelocationInfo(TT, *Ctx));
Ahmed Bougachaad1084d2013-05-24 00:39:57 +000076 if (!RelInfo)
Craig Topper353eda42014-04-24 06:44:33 +000077 return nullptr;
Ahmed Bougachaad1084d2013-05-24 00:39:57 +000078
Ahmed Charles56440fd2014-03-06 05:51:42 +000079 std::unique_ptr<MCSymbolizer> Symbolizer(TheTarget->createMCSymbolizer(
Eric Christopher71b1e5f2015-03-30 22:31:14 +000080 TT, GetOpInfo, SymbolLookUp, DisInfo, Ctx, std::move(RelInfo)));
Ahmed Charlesdf17c832014-03-07 09:38:02 +000081 DisAsm->setSymbolizer(std::move(Symbolizer));
Lang Hames95400e22014-04-11 20:07:58 +000082
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000083 // Set up the instruction printer.
84 int AsmPrinterVariant = MAI->getAssemblerDialect();
Eric Christopherf8019402015-03-31 00:10:04 +000085 MCInstPrinter *IP = TheTarget->createMCInstPrinter(
Daniel Sanders50f17232015-09-15 16:17:27 +000086 Triple(TT), AsmPrinterVariant, *MAI, *MII, *MRI);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000087 if (!IP)
Craig Topper353eda42014-04-24 06:44:33 +000088 return nullptr;
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000089
Eric Christopher71b1e5f2015-03-30 22:31:14 +000090 LLVMDisasmContext *DC =
91 new LLVMDisasmContext(TT, DisInfo, TagType, GetOpInfo, SymbolLookUp,
92 TheTarget, MAI, MRI, STI, MII, Ctx, DisAsm, IP);
Kevin Enderbyf536c6a2013-03-12 18:12:17 +000093 if (!DC)
Craig Topper353eda42014-04-24 06:44:33 +000094 return nullptr;
Owen Anderson233f1302011-09-15 18:37:20 +000095
Quentin Colombet76e55572013-10-03 17:51:49 +000096 DC->setCPU(CPU);
Kevin Enderbyf3070dc2011-03-28 18:25:07 +000097 return DC;
98}
99
Eric Christopher71b1e5f2015-03-30 22:31:14 +0000100LLVMDisasmContextRef
101LLVMCreateDisasmCPU(const char *TT, const char *CPU, void *DisInfo, int TagType,
102 LLVMOpInfoCallback GetOpInfo,
103 LLVMSymbolLookupCallback SymbolLookUp) {
104 return LLVMCreateDisasmCPUFeatures(TT, CPU, "", DisInfo, TagType, GetOpInfo,
105 SymbolLookUp);
Bradley Smith7a770752014-09-30 16:31:40 +0000106}
107
Eric Christopher71b1e5f2015-03-30 22:31:14 +0000108LLVMDisasmContextRef LLVMCreateDisasm(const char *TT, void *DisInfo,
Jim Grosbach0ca9d5b2012-12-07 23:53:27 +0000109 int TagType, LLVMOpInfoCallback GetOpInfo,
110 LLVMSymbolLookupCallback SymbolLookUp) {
Eric Christopher71b1e5f2015-03-30 22:31:14 +0000111 return LLVMCreateDisasmCPUFeatures(TT, "", "", DisInfo, TagType, GetOpInfo,
112 SymbolLookUp);
Jim Grosbach0ca9d5b2012-12-07 23:53:27 +0000113}
114
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000115//
116// LLVMDisasmDispose() disposes of the disassembler specified by the context.
117//
118void LLVMDisasmDispose(LLVMDisasmContextRef DCR){
119 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
120 delete DC;
121}
122
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000123/// \brief Emits the comments that are stored in \p DC comment stream.
124/// Each comment in the comment stream must end with a newline.
125static void emitComments(LLVMDisasmContext *DC,
126 formatted_raw_ostream &FormattedOS) {
127 // Flush the stream before taking its content.
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000128 StringRef Comments = DC->CommentsToEmit.str();
129 // Get the default information for printing a comment.
130 const MCAsmInfo *MAI = DC->getAsmInfo();
131 const char *CommentBegin = MAI->getCommentString();
132 unsigned CommentColumn = MAI->getCommentColumn();
133 bool IsFirst = true;
134 while (!Comments.empty()) {
135 if (!IsFirst)
136 FormattedOS << '\n';
137 // Emit a line of comments.
138 FormattedOS.PadToColumn(CommentColumn);
139 size_t Position = Comments.find('\n');
140 FormattedOS << CommentBegin << ' ' << Comments.substr(0, Position);
141 // Move after the newline character.
142 Comments = Comments.substr(Position+1);
143 IsFirst = false;
144 }
145 FormattedOS.flush();
146
147 // Tell the comment stream that the vector changed underneath it.
148 DC->CommentsToEmit.clear();
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000149}
150
Eric Christopheracf25762015-01-13 00:21:14 +0000151/// \brief Gets latency information for \p Inst from the itinerary
Quentin Colombet76e55572013-10-03 17:51:49 +0000152/// scheduling model, based on \p DC information.
153/// \return The maximum expected latency over all the operands or -1
Eric Christopheracf25762015-01-13 00:21:14 +0000154/// if no information is available.
Quentin Colombet76e55572013-10-03 17:51:49 +0000155static int getItineraryLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
156 const int NoInformationAvailable = -1;
157
158 // Check if we have a CPU to get the itinerary information.
159 if (DC->getCPU().empty())
160 return NoInformationAvailable;
161
162 // Get itinerary information.
163 const MCSubtargetInfo *STI = DC->getSubtargetInfo();
164 InstrItineraryData IID = STI->getInstrItineraryForCPU(DC->getCPU());
165 // Get the scheduling class of the requested instruction.
166 const MCInstrDesc& Desc = DC->getInstrInfo()->get(Inst.getOpcode());
167 unsigned SCClass = Desc.getSchedClass();
168
169 int Latency = 0;
170 for (unsigned OpIdx = 0, OpIdxEnd = Inst.getNumOperands(); OpIdx != OpIdxEnd;
171 ++OpIdx)
172 Latency = std::max(Latency, IID.getOperandCycle(SCClass, OpIdx));
173
174 return Latency;
175}
176
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000177/// \brief Gets latency information for \p Inst, based on \p DC information.
178/// \return The maximum expected latency over all the definitions or -1
Eric Christopheracf25762015-01-13 00:21:14 +0000179/// if no information is available.
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000180static int getLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
181 // Try to compute scheduling information.
182 const MCSubtargetInfo *STI = DC->getSubtargetInfo();
Pete Cooper11759452014-09-02 17:43:54 +0000183 const MCSchedModel SCModel = STI->getSchedModel();
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000184 const int NoInformationAvailable = -1;
185
186 // Check if we have a scheduling model for instructions.
Pete Cooper11759452014-09-02 17:43:54 +0000187 if (!SCModel.hasInstrSchedModel())
188 // Try to fall back to the itinerary model if the scheduling model doesn't
189 // have a scheduling table. Note the default does not have a table.
Quentin Colombet76e55572013-10-03 17:51:49 +0000190 return getItineraryLatency(DC, Inst);
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000191
192 // Get the scheduling class of the requested instruction.
193 const MCInstrDesc& Desc = DC->getInstrInfo()->get(Inst.getOpcode());
194 unsigned SCClass = Desc.getSchedClass();
Pete Cooper11759452014-09-02 17:43:54 +0000195 const MCSchedClassDesc *SCDesc = SCModel.getSchedClassDesc(SCClass);
Quentin Colombetc3665042013-10-02 23:11:47 +0000196 // Resolving the variant SchedClass requires an MI to pass to
197 // SubTargetInfo::resolveSchedClass.
198 if (!SCDesc || !SCDesc->isValid() || SCDesc->isVariant())
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000199 return NoInformationAvailable;
200
201 // Compute output latency.
202 int Latency = 0;
203 for (unsigned DefIdx = 0, DefEnd = SCDesc->NumWriteLatencyEntries;
204 DefIdx != DefEnd; ++DefIdx) {
205 // Lookup the definition's write latency in SubtargetInfo.
206 const MCWriteLatencyEntry *WLEntry = STI->getWriteLatencyEntry(SCDesc,
207 DefIdx);
208 Latency = std::max(Latency, WLEntry->Cycles);
209 }
210
211 return Latency;
212}
213
214
215/// \brief Emits latency information in DC->CommentStream for \p Inst, based
216/// on the information available in \p DC.
217static void emitLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
218 int Latency = getLatency(DC, Inst);
219
Eric Christopheracf25762015-01-13 00:21:14 +0000220 // Report only interesting latencies.
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000221 if (Latency < 2)
222 return;
223
224 DC->CommentStream << "Latency: " << Latency << '\n';
225}
226
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000227//
Benjamin Kramer26e77682011-04-09 14:06:12 +0000228// LLVMDisasmInstruction() disassembles a single instruction using the
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000229// disassembler context specified in the parameter DC. The bytes of the
Benjamin Kramer26e77682011-04-09 14:06:12 +0000230// instruction are specified in the parameter Bytes, and contains at least
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000231// BytesSize number of bytes. The instruction is at the address specified by
232// the PC parameter. If a valid instruction can be disassembled its string is
233// returned indirectly in OutString which whos size is specified in the
234// parameter OutStringSize. This function returns the number of bytes in the
235// instruction or zero if there was no valid instruction. If this function
236// returns zero the caller will have to pick how many bytes they want to step
237// over by printing a .byte, .long etc. to continue.
238//
239size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
240 uint64_t BytesSize, uint64_t PC, char *OutString,
241 size_t OutStringSize){
242 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
243 // Wrap the pointer to the Bytes, BytesSize and PC in a MemoryObject.
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000244 ArrayRef<uint8_t> Data(Bytes, BytesSize);
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000245
246 uint64_t Size;
247 MCInst Inst;
248 const MCDisassembler *DisAsm = DC->getDisAsm();
249 MCInstPrinter *IP = DC->getIP();
James Molloy5ada2a72011-09-01 22:01:14 +0000250 MCDisassembler::DecodeStatus S;
Alp Tokere69170a2014-06-26 22:52:05 +0000251 SmallVector<char, 64> InsnStr;
252 raw_svector_ostream Annotations(InsnStr);
Rafael Espindola6c933972014-11-13 16:52:07 +0000253 S = DisAsm->getInstruction(Inst, Size, Data, PC,
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000254 /*REMOVE*/ nulls(), Annotations);
James Molloy5ada2a72011-09-01 22:01:14 +0000255 switch (S) {
256 case MCDisassembler::Fail:
257 case MCDisassembler::SoftFail:
James Molloydb4ce602011-09-01 18:02:14 +0000258 // FIXME: Do something different for soft failure modes?
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000259 return 0;
James Molloy5ada2a72011-09-01 22:01:14 +0000260
261 case MCDisassembler::Success: {
Alp Tokere69170a2014-06-26 22:52:05 +0000262 StringRef AnnotationsStr = Annotations.str();
263
Owen Andersona0c3b972011-09-15 23:38:46 +0000264 SmallVector<char, 64> InsnStr;
265 raw_svector_ostream OS(InsnStr);
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000266 formatted_raw_ostream FormattedOS(OS);
Akira Hatanakab46d0232015-03-27 20:36:02 +0000267 IP->printInst(&Inst, FormattedOS, AnnotationsStr, *DC->getSubtargetInfo());
Owen Anderson233f1302011-09-15 18:37:20 +0000268
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000269 if (DC->getOptions() & LLVMDisassembler_Option_PrintLatency)
270 emitLatency(DC, Inst);
271
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000272 emitComments(DC, FormattedOS);
Owen Anderson233f1302011-09-15 18:37:20 +0000273
James Molloy5ada2a72011-09-01 22:01:14 +0000274 assert(OutStringSize != 0 && "Output buffer cannot be zero size");
275 size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
276 std::memcpy(OutString, InsnStr.data(), OutputSize);
277 OutString[OutputSize] = '\0'; // Terminate string.
278
279 return Size;
James Molloydb4ce602011-09-01 18:02:14 +0000280 }
James Molloy5ada2a72011-09-01 22:01:14 +0000281 }
David Blaikie46a9f012012-01-20 21:51:11 +0000282 llvm_unreachable("Invalid DecodeStatus!");
Kevin Enderbyf3070dc2011-03-28 18:25:07 +0000283}
Kevin Enderby62183c42012-10-22 22:31:46 +0000284
285//
286// LLVMSetDisasmOptions() sets the disassembler's options. It returns 1 if it
287// can set all the Options and 0 otherwise.
288//
289int LLVMSetDisasmOptions(LLVMDisasmContextRef DCR, uint64_t Options){
290 if (Options & LLVMDisassembler_Option_UseMarkup){
291 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
292 MCInstPrinter *IP = DC->getIP();
293 IP->setUseMarkup(1);
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000294 DC->addOptions(LLVMDisassembler_Option_UseMarkup);
Kevin Enderby62183c42012-10-22 22:31:46 +0000295 Options &= ~LLVMDisassembler_Option_UseMarkup;
296 }
Kevin Enderby168ffb32012-12-05 18:13:19 +0000297 if (Options & LLVMDisassembler_Option_PrintImmHex){
298 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
299 MCInstPrinter *IP = DC->getIP();
300 IP->setPrintImmHex(1);
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000301 DC->addOptions(LLVMDisassembler_Option_PrintImmHex);
Kevin Enderby168ffb32012-12-05 18:13:19 +0000302 Options &= ~LLVMDisassembler_Option_PrintImmHex;
303 }
Kevin Enderby85cf5312012-12-18 23:47:28 +0000304 if (Options & LLVMDisassembler_Option_AsmPrinterVariant){
305 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
306 // Try to set up the new instruction printer.
307 const MCAsmInfo *MAI = DC->getAsmInfo();
308 const MCInstrInfo *MII = DC->getInstrInfo();
309 const MCRegisterInfo *MRI = DC->getRegisterInfo();
Kevin Enderby85cf5312012-12-18 23:47:28 +0000310 int AsmPrinterVariant = MAI->getAssemblerDialect();
311 AsmPrinterVariant = AsmPrinterVariant == 0 ? 1 : 0;
312 MCInstPrinter *IP = DC->getTarget()->createMCInstPrinter(
Daniel Sanders50f17232015-09-15 16:17:27 +0000313 Triple(DC->getTripleName()), AsmPrinterVariant, *MAI, *MII, *MRI);
Kevin Enderby85cf5312012-12-18 23:47:28 +0000314 if (IP) {
315 DC->setIP(IP);
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000316 DC->addOptions(LLVMDisassembler_Option_AsmPrinterVariant);
Kevin Enderby85cf5312012-12-18 23:47:28 +0000317 Options &= ~LLVMDisassembler_Option_AsmPrinterVariant;
318 }
319 }
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000320 if (Options & LLVMDisassembler_Option_SetInstrComments) {
321 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
322 MCInstPrinter *IP = DC->getIP();
323 IP->setCommentStream(DC->CommentStream);
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000324 DC->addOptions(LLVMDisassembler_Option_SetInstrComments);
Quentin Colombet93a98aa2013-10-01 22:14:56 +0000325 Options &= ~LLVMDisassembler_Option_SetInstrComments;
326 }
Quentin Colombet5f09cb02013-10-02 22:07:57 +0000327 if (Options & LLVMDisassembler_Option_PrintLatency) {
328 LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
329 DC->addOptions(LLVMDisassembler_Option_PrintLatency);
330 Options &= ~LLVMDisassembler_Option_PrintLatency;
331 }
Kevin Enderby62183c42012-10-22 22:31:46 +0000332 return (Options == 0);
333}