@@ -127,12 +127,9 @@ void SourceDebugger::dump() {
127127 errs () << " Debug Error: cannot get register info\n " ;
128128 return ;
129129 }
130- # if LLVM_VERSION_MAJOR >= 10
130+
131131 MCTargetOptions MCOptions;
132132 std::unique_ptr<MCAsmInfo> MAI (T->createMCAsmInfo (*MRI, TripleStr, MCOptions));
133- #else
134- std::unique_ptr<MCAsmInfo> MAI (T->createMCAsmInfo (*MRI, TripleStr));
135- #endif
136133 if (!MAI) {
137134 errs () << " Debug Error: cannot get assembly info\n " ;
138135 return ;
@@ -174,13 +171,7 @@ void SourceDebugger::dump() {
174171 return ;
175172 }
176173
177- // bcc has only one compilation unit
178- // getCompileUnitAtIndex() was gone in llvm 8.0 (https://reviews.llvm.org/D49741)
179- #if LLVM_VERSION_MAJOR >= 8
180174 DWARFCompileUnit *CU = cast<DWARFCompileUnit>(DwarfCtx->getUnitAtIndex (0 ));
181- #else
182- DWARFCompileUnit *CU = DwarfCtx->getCompileUnitAtIndex (0 );
183- #endif
184175 if (!CU) {
185176 errs () << " Debug Error: dwarf context failed to get compile unit\n " ;
186177 return ;
@@ -202,15 +193,15 @@ void SourceDebugger::dump() {
202193 uint64_t Size;
203194 uint8_t *FuncStart = info.start_ ;
204195 uint64_t FuncSize = info.size_ ;
205- # if LLVM_VERSION_MAJOR >= 9
196+
206197 auto section = sections_.find (info.section_ );
207198 if (section == sections_.end ()) {
208199 errs () << " Debug Error: no section entry for section " << info.section_
209200 << ' \n ' ;
210201 return ;
211202 }
212203 unsigned SectionID = get<2 >(section->second );
213- # endif
204+
214205 ArrayRef<uint8_t > Data (FuncStart, FuncSize);
215206 uint32_t CurrentSrcLine = 0 ;
216207
@@ -219,24 +210,15 @@ void SourceDebugger::dump() {
219210 string src_dbg_str;
220211 llvm::raw_string_ostream os (src_dbg_str);
221212 for (uint64_t Index = 0 ; Index < FuncSize; Index += Size) {
222- #if LLVM_VERSION_MAJOR >= 10
223213 S = DisAsm->getInstruction (Inst, Size, Data.slice (Index), Index, nulls ());
224- #else
225- S = DisAsm->getInstruction (Inst, Size, Data.slice (Index), Index, nulls (),
226- nulls ());
227- #endif
228214 if (S != MCDisassembler::Success) {
229215 os << " Debug Error: disassembler failed: " << std::to_string (S) << ' \n ' ;
230216 break ;
231217 } else {
232218 DILineInfo LineInfo;
233219
234220 LineTable->getFileLineInfoForAddress (
235- #if LLVM_VERSION_MAJOR >= 9
236221 {(uint64_t )FuncStart + Index, SectionID},
237- #else
238- (uint64_t )FuncStart + Index,
239- #endif
240222#if LLVM_VERSION_MAJOR >= 20
241223 false ,
242224#endif
@@ -248,11 +230,7 @@ void SourceDebugger::dump() {
248230 os);
249231 os << format (" %4" PRIu64 " :" , Index >> 3 ) << ' \t ' ;
250232 dumpBytes (Data.slice (Index, Size), os);
251- #if LLVM_VERSION_MAJOR >= 10
252233 IP->printInst (&Inst, 0 , " " , *STI, os);
253- #else
254- IP->printInst (&Inst, os, " " , *STI);
255- #endif
256234 os << ' \n ' ;
257235 }
258236 }
0 commit comments