Disassembler.cpp (219067) | Disassembler.cpp (221337) |
---|---|
1//===- Disassembler.cpp - Disassembler for hex strings --------------------===// 2// 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//===----------------------------------------------------------------------===// --- 113 unchanged lines hidden (view full) --- 122 123 ByteArray.push_back(std::make_pair((unsigned char)ByteVal, Value.data())); 124 Str = Str.substr(Next); 125 } 126 127 return false; 128} 129 | 1//===- Disassembler.cpp - Disassembler for hex strings --------------------===// 2// 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//===----------------------------------------------------------------------===// --- 113 unchanged lines hidden (view full) --- 122 123 ByteArray.push_back(std::make_pair((unsigned char)ByteVal, Value.data())); 124 Str = Str.substr(Next); 125 } 126 127 return false; 128} 129 |
130int Disassembler::disassemble(const Target &T, const std::string &Triple, | 130int Disassembler::disassemble(const Target &T, TargetMachine &TM, 131 const std::string &Triple, |
131 MemoryBuffer &Buffer, 132 raw_ostream &Out) { 133 // Set up disassembler. 134 OwningPtr<const MCAsmInfo> AsmInfo(T.createAsmInfo(Triple)); 135 136 if (!AsmInfo) { 137 errs() << "error: no assembly info for target " << Triple << "\n"; 138 return -1; 139 } 140 141 OwningPtr<const MCDisassembler> DisAsm(T.createMCDisassembler()); 142 if (!DisAsm) { 143 errs() << "error: no disassembler for target " << Triple << "\n"; 144 return -1; 145 } 146 147 int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); | 132 MemoryBuffer &Buffer, 133 raw_ostream &Out) { 134 // Set up disassembler. 135 OwningPtr<const MCAsmInfo> AsmInfo(T.createAsmInfo(Triple)); 136 137 if (!AsmInfo) { 138 errs() << "error: no assembly info for target " << Triple << "\n"; 139 return -1; 140 } 141 142 OwningPtr<const MCDisassembler> DisAsm(T.createMCDisassembler()); 143 if (!DisAsm) { 144 errs() << "error: no disassembler for target " << Triple << "\n"; 145 return -1; 146 } 147 148 int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); |
148 OwningPtr | 149 OwningPtr<MCInstPrinter> IP(T.createMCInstPrinter(TM, AsmPrinterVariant, |
149 *AsmInfo)); 150 if (!IP) { 151 errs() << "error: no instruction printer for target " << Triple << '\n'; 152 return -1; 153 } 154 155 bool ErrorOccurred = false; 156 --- 77 unchanged lines hidden (view full) --- 234 errs() << "error: couldn't get disassembler for " << TS << '\n'; 235 return -1; 236 } 237 238 while (ByteArray.size()) { 239 OwningPtr<EDInst> 240 inst(disassembler->createInst(byteArrayReader, 0, &ByteArray)); 241 | 150 *AsmInfo)); 151 if (!IP) { 152 errs() << "error: no instruction printer for target " << Triple << '\n'; 153 return -1; 154 } 155 156 bool ErrorOccurred = false; 157 --- 77 unchanged lines hidden (view full) --- 235 errs() << "error: couldn't get disassembler for " << TS << '\n'; 236 return -1; 237 } 238 239 while (ByteArray.size()) { 240 OwningPtr<EDInst> 241 inst(disassembler->createInst(byteArrayReader, 0, &ByteArray)); 242 |
242 ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize()); 243 | |
244 if (inst == 0) { 245 errs() << "error: Didn't get an instruction\n"; 246 return -1; 247 } | 243 if (inst == 0) { 244 errs() << "error: Didn't get an instruction\n"; 245 return -1; 246 } |
247 248 ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize()); |
|
248 249 unsigned numTokens = inst->numTokens(); 250 if ((int)numTokens < 0) { 251 errs() << "error: couldn't count the instruction's tokens\n"; 252 return -1; 253 } 254 255 for (unsigned tokenIndex = 0; tokenIndex != numTokens; ++tokenIndex) { --- 91 unchanged lines hidden --- | 249 250 unsigned numTokens = inst->numTokens(); 251 if ((int)numTokens < 0) { 252 errs() << "error: couldn't count the instruction's tokens\n"; 253 return -1; 254 } 255 256 for (unsigned tokenIndex = 0; tokenIndex != numTokens; ++tokenIndex) { --- 91 unchanged lines hidden --- |