9
9
10
10
#include " Disassembler.h"
11
11
#include " llvm-c/Disassembler.h"
12
+ #include " llvm/ADT/ArrayRef.h"
13
+ #include " llvm/ADT/SmallVector.h"
14
+ #include " llvm/ADT/Triple.h"
12
15
#include " llvm/MC/MCAsmInfo.h"
13
16
#include " llvm/MC/MCContext.h"
14
17
#include " llvm/MC/MCDisassembler/MCDisassembler.h"
15
18
#include " llvm/MC/MCDisassembler/MCRelocationInfo.h"
16
19
#include " llvm/MC/MCDisassembler/MCSymbolizer.h"
17
20
#include " llvm/MC/MCInst.h"
18
21
#include " llvm/MC/MCInstPrinter.h"
22
+ #include " llvm/MC/MCInstrDesc.h"
19
23
#include " llvm/MC/MCInstrInfo.h"
24
+ #include " llvm/MC/MCInstrItineraries.h"
20
25
#include " llvm/MC/MCRegisterInfo.h"
26
+ #include " llvm/MC/MCSchedule.h"
21
27
#include " llvm/MC/MCSubtargetInfo.h"
22
28
#include " llvm/Support/ErrorHandling.h"
23
29
#include " llvm/Support/FormattedStream.h"
30
+ #include " llvm/Support/raw_ostream.h"
24
31
#include " llvm/Support/TargetRegistry.h"
32
+ #include < cassert>
33
+ #include < cstddef>
34
+ #include < cstring>
25
35
26
36
using namespace llvm ;
27
37
@@ -116,7 +126,7 @@ LLVMDisasmContextRef LLVMCreateDisasm(const char *TT, void *DisInfo,
116
126
// LLVMDisasmDispose() disposes of the disassembler specified by the context.
117
127
//
118
128
void LLVMDisasmDispose (LLVMDisasmContextRef DCR){
119
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
129
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
120
130
delete DC;
121
131
}
122
132
@@ -211,7 +221,6 @@ static int getLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
211
221
return Latency;
212
222
}
213
223
214
-
215
224
// / \brief Emits latency information in DC->CommentStream for \p Inst, based
216
225
// / on the information available in \p DC.
217
226
static void emitLatency (LLVMDisasmContext *DC, const MCInst &Inst) {
@@ -239,7 +248,7 @@ static void emitLatency(LLVMDisasmContext *DC, const MCInst &Inst) {
239
248
size_t LLVMDisasmInstruction (LLVMDisasmContextRef DCR, uint8_t *Bytes,
240
249
uint64_t BytesSize, uint64_t PC, char *OutString,
241
250
size_t OutStringSize){
242
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
251
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
243
252
// Wrap the pointer to the Bytes, BytesSize and PC in a MemoryObject.
244
253
ArrayRef<uint8_t > Data (Bytes, BytesSize);
245
254
@@ -288,21 +297,21 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
288
297
//
289
298
int LLVMSetDisasmOptions (LLVMDisasmContextRef DCR, uint64_t Options){
290
299
if (Options & LLVMDisassembler_Option_UseMarkup){
291
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
300
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
292
301
MCInstPrinter *IP = DC->getIP ();
293
- IP->setUseMarkup (1 );
302
+ IP->setUseMarkup (true );
294
303
DC->addOptions (LLVMDisassembler_Option_UseMarkup);
295
304
Options &= ~LLVMDisassembler_Option_UseMarkup;
296
305
}
297
306
if (Options & LLVMDisassembler_Option_PrintImmHex){
298
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
307
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
299
308
MCInstPrinter *IP = DC->getIP ();
300
- IP->setPrintImmHex (1 );
309
+ IP->setPrintImmHex (true );
301
310
DC->addOptions (LLVMDisassembler_Option_PrintImmHex);
302
311
Options &= ~LLVMDisassembler_Option_PrintImmHex;
303
312
}
304
313
if (Options & LLVMDisassembler_Option_AsmPrinterVariant){
305
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
314
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
306
315
// Try to set up the new instruction printer.
307
316
const MCAsmInfo *MAI = DC->getAsmInfo ();
308
317
const MCInstrInfo *MII = DC->getInstrInfo ();
@@ -318,14 +327,14 @@ int LLVMSetDisasmOptions(LLVMDisasmContextRef DCR, uint64_t Options){
318
327
}
319
328
}
320
329
if (Options & LLVMDisassembler_Option_SetInstrComments) {
321
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
330
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
322
331
MCInstPrinter *IP = DC->getIP ();
323
332
IP->setCommentStream (DC->CommentStream );
324
333
DC->addOptions (LLVMDisassembler_Option_SetInstrComments);
325
334
Options &= ~LLVMDisassembler_Option_SetInstrComments;
326
335
}
327
336
if (Options & LLVMDisassembler_Option_PrintLatency) {
328
- LLVMDisasmContext *DC = ( LLVMDisasmContext *) DCR;
337
+ LLVMDisasmContext *DC = static_cast < LLVMDisasmContext *>( DCR) ;
329
338
DC->addOptions (LLVMDisassembler_Option_PrintLatency);
330
339
Options &= ~LLVMDisassembler_Option_PrintLatency;
331
340
}
0 commit comments