Skip to content

Commit 77aaa22

Browse files
author
Luke Cheeseman
committedSep 26, 2018
Revert r343112 as CallFrameString API change has broken lldb builds
llvm-svn: 343114
1 parent c5d192b commit 77aaa22

25 files changed

+75
-192
lines changed
 

‎llvm/include/llvm/BinaryFormat/Dwarf.def

+4-11
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
1919
defined HANDLE_DW_CC || defined HANDLE_DW_LNS || defined HANDLE_DW_LNE || \
2020
defined HANDLE_DW_LNCT || defined HANDLE_DW_MACRO || \
21-
defined HANDLE_DW_RLE || \
22-
(defined HANDLE_DW_CFA && defined HANDLE_DW_CFA_PRED) || \
21+
defined HANDLE_DW_RLE || defined HANDLE_DW_CFA || \
2322
defined HANDLE_DW_APPLE_PROPERTY || defined HANDLE_DW_UT || \
2423
defined HANDLE_DWARF_SECTION || defined HANDLE_DW_IDX || \
2524
defined HANDLE_DW_END)
@@ -86,10 +85,6 @@
8685
#define HANDLE_DW_CFA(ID, NAME)
8786
#endif
8887

89-
#ifndef HANDLE_DW_CFA_PRED
90-
#define HANDLE_DW_CFA_PRED(ID, NAME, PRED)
91-
#endif
92-
9388
#ifndef HANDLE_DW_APPLE_PROPERTY
9489
#define HANDLE_DW_APPLE_PROPERTY(ID, NAME)
9590
#endif
@@ -836,10 +831,9 @@ HANDLE_DW_CFA(0x14, val_offset)
836831
HANDLE_DW_CFA(0x15, val_offset_sf)
837832
HANDLE_DW_CFA(0x16, val_expression)
838833
// Vendor extensions:
839-
HANDLE_DW_CFA_PRED(0x1d, MIPS_advance_loc8, SELECT_MIPS64)
840-
HANDLE_DW_CFA_PRED(0x2d, GNU_window_save, SELECT_SPARC)
841-
HANDLE_DW_CFA_PRED(0x2d, AARCH64_negate_ra_state, SELECT_AARCH64)
842-
HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86)
834+
HANDLE_DW_CFA(0x1d, MIPS_advance_loc8)
835+
HANDLE_DW_CFA(0x2d, GNU_window_save)
836+
HANDLE_DW_CFA(0x2e, GNU_args_size)
843837

844838
// Apple Objective-C Property Attributes.
845839
// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
@@ -921,7 +915,6 @@ HANDLE_DW_IDX(0x05, type_hash)
921915
#undef HANDLE_DW_MACRO
922916
#undef HANDLE_DW_RLE
923917
#undef HANDLE_DW_CFA
924-
#undef HANDLE_DW_CFA_PRED
925918
#undef HANDLE_DW_APPLE_PROPERTY
926919
#undef HANDLE_DW_UT
927920
#undef HANDLE_DWARF_SECTION

‎llvm/include/llvm/BinaryFormat/Dwarf.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "llvm/Support/ErrorHandling.h"
2727
#include "llvm/Support/Format.h"
2828
#include "llvm/Support/FormatVariadicDetails.h"
29-
#include "llvm/ADT/Triple.h"
3029

3130
namespace llvm {
3231
class StringRef;
@@ -273,7 +272,6 @@ enum RangeListEntries {
273272
/// Call frame instruction encodings.
274273
enum CallFrameInfo {
275274
#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
276-
#define HANDLE_DW_CFA_PRED(ID, NAME, ARCH) DW_CFA_##NAME = ID,
277275
#include "llvm/BinaryFormat/Dwarf.def"
278276
DW_CFA_extended = 0x00,
279277

@@ -432,7 +430,7 @@ StringRef LNStandardString(unsigned Standard);
432430
StringRef LNExtendedString(unsigned Encoding);
433431
StringRef MacinfoString(unsigned Encoding);
434432
StringRef RangeListEncodingString(unsigned Encoding);
435-
StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch);
433+
StringRef CallFrameString(unsigned Encoding);
436434
StringRef ApplePropertyString(unsigned);
437435
StringRef UnitTypeString(unsigned);
438436
StringRef AtomTypeString(unsigned Atom);

‎llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class DWARFContext : public DIContext {
9090
bool CheckedForDWP = false;
9191
std::string DWPName;
9292

93-
Triple::ArchType Arch;
9493
std::unique_ptr<MCRegisterInfo> RegInfo;
9594

9695
/// Read compile units from the debug_info section (if necessary)
@@ -342,7 +341,7 @@ class DWARFContext : public DIContext {
342341
/// Loads register info for the architecture of the provided object file.
343342
/// Improves readability of dumped DWARF expressions. Requires the caller to
344343
/// have initialized the relevant target descriptions.
345-
Error loadArchitectureInfo(const object::ObjectFile &Obj);
344+
Error loadRegisterInfo(const object::ObjectFile &Obj);
346345

347346
/// Get address size from CUs.
348347
/// TODO: refactor compile_units() to make this const.

‎llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h

+9-17
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "llvm/ADT/ArrayRef.h"
1414
#include "llvm/ADT/iterator.h"
1515
#include "llvm/ADT/SmallString.h"
16-
#include "llvm/ADT/Triple.h"
1716
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
1817
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1918
#include "llvm/Support/Error.h"
@@ -60,11 +59,9 @@ class CFIProgram {
6059
unsigned size() const { return (unsigned)Instructions.size(); }
6160
bool empty() const { return Instructions.empty(); }
6261

63-
CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor,
64-
Triple::ArchType Arch)
62+
CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor)
6563
: CodeAlignmentFactor(CodeAlignmentFactor),
66-
DataAlignmentFactor(DataAlignmentFactor),
67-
Arch(Arch) {}
64+
DataAlignmentFactor(DataAlignmentFactor) {}
6865

6966
/// Parse and store a sequence of CFI instructions from Data,
7067
/// starting at *Offset and ending at EndOffset. *Offset is updated
@@ -79,7 +76,6 @@ class CFIProgram {
7976
std::vector<Instruction> Instructions;
8077
const uint64_t CodeAlignmentFactor;
8178
const int64_t DataAlignmentFactor;
82-
Triple::ArchType Arch;
8379

8480
/// Convenience method to add a new instruction with the given opcode.
8581
void addInstruction(uint8_t Opcode) {
@@ -134,9 +130,8 @@ class FrameEntry {
134130
enum FrameKind { FK_CIE, FK_FDE };
135131

136132
FrameEntry(FrameKind K, uint64_t Offset, uint64_t Length, uint64_t CodeAlign,
137-
int64_t DataAlign, Triple::ArchType Arch)
138-
: Kind(K), Offset(Offset), Length(Length),
139-
CFIs(CodeAlign, DataAlign, Arch) {}
133+
int64_t DataAlign)
134+
: Kind(K), Offset(Offset), Length(Length), CFIs(CodeAlign, DataAlign) {}
140135

141136
virtual ~FrameEntry() {}
142137

@@ -173,9 +168,9 @@ class CIE : public FrameEntry {
173168
int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister,
174169
SmallString<8> AugmentationData, uint32_t FDEPointerEncoding,
175170
uint32_t LSDAPointerEncoding, Optional<uint64_t> Personality,
176-
Optional<uint32_t> PersonalityEnc, Triple::ArchType Arch)
171+
Optional<uint32_t> PersonalityEnc)
177172
: FrameEntry(FK_CIE, Offset, Length, CodeAlignmentFactor,
178-
DataAlignmentFactor, Arch),
173+
DataAlignmentFactor),
179174
Version(Version), Augmentation(std::move(Augmentation)),
180175
AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize),
181176
CodeAlignmentFactor(CodeAlignmentFactor),
@@ -229,11 +224,10 @@ class FDE : public FrameEntry {
229224
// is obtained lazily once it's actually required.
230225
FDE(uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset,
231226
uint64_t InitialLocation, uint64_t AddressRange, CIE *Cie,
232-
Optional<uint64_t> LSDAAddress, Triple::ArchType Arch)
227+
Optional<uint64_t> LSDAAddress)
233228
: FrameEntry(FK_FDE, Offset, Length,
234229
Cie ? Cie->getCodeAlignmentFactor() : 0,
235-
Cie ? Cie->getDataAlignmentFactor() : 0,
236-
Arch),
230+
Cie ? Cie->getDataAlignmentFactor() : 0),
237231
LinkedCIEOffset(LinkedCIEOffset), InitialLocation(InitialLocation),
238232
AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {}
239233

@@ -262,7 +256,6 @@ class FDE : public FrameEntry {
262256

263257
/// A parsed .debug_frame or .eh_frame section
264258
class DWARFDebugFrame {
265-
const Triple::ArchType Arch;
266259
// True if this is parsing an eh_frame section.
267260
const bool IsEH;
268261
// Not zero for sane pointer values coming out of eh_frame
@@ -279,8 +272,7 @@ class DWARFDebugFrame {
279272
// it is a .debug_frame section. EHFrameAddress should be different
280273
// than zero for correct parsing of .eh_frame addresses when they
281274
// use a PC-relative encoding.
282-
DWARFDebugFrame(Triple::ArchType Arch,
283-
bool IsEH = false, uint64_t EHFrameAddress = 0);
275+
DWARFDebugFrame(bool IsEH = false, uint64_t EHFrameAddress = 0);
284276
~DWARFDebugFrame();
285277

286278
/// Dump the section data into the given stream.

‎llvm/include/llvm/MC/MCDwarf.h

-6
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ class MCCFIInstruction {
430430
OpUndefined,
431431
OpRegister,
432432
OpWindowSave,
433-
OpNegateRAState,
434433
OpGnuArgsSize
435434
};
436435

@@ -510,11 +509,6 @@ class MCCFIInstruction {
510509
return MCCFIInstruction(OpWindowSave, L, 0, 0, "");
511510
}
512511

513-
/// .cfi_negate_ra_state AArch64 negate RA state.
514-
static MCCFIInstruction createNegateRAState(MCSymbol *L) {
515-
return MCCFIInstruction(OpNegateRAState, L, 0, 0, "");
516-
}
517-
518512
/// .cfi_restore says that the rule for Register is now the same as it
519513
/// was at the beginning of the function, after all initial instructions added
520514
/// by .cfi_startproc were executed.

‎llvm/include/llvm/MC/MCStreamer.h

-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,6 @@ class MCStreamer {
891891
virtual void EmitCFIUndefined(int64_t Register);
892892
virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
893893
virtual void EmitCFIWindowSave();
894-
virtual void EmitCFINegateRAState();
895894

896895
virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc = SMLoc());
897896
virtual void EmitWinCFIEndProc(SMLoc Loc = SMLoc());

‎llvm/lib/BinaryFormat/Dwarf.cpp

+1-19
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#include "llvm/BinaryFormat/Dwarf.h"
1515
#include "llvm/ADT/StringSwitch.h"
16-
#include "llvm/ADT/Triple.h"
1716
#include "llvm/Support/ErrorHandling.h"
1817

1918
using namespace llvm;
@@ -456,31 +455,14 @@ StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) {
456455
}
457456
}
458457

459-
StringRef llvm::dwarf::CallFrameString(unsigned Encoding,
460-
Triple::ArchType Arch) {
461-
#define SELECT_AARCH64 (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64)
462-
#define SELECT_MIPS64 Arch == llvm::Triple::mips64
463-
#define SELECT_SPARC (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9)
464-
#define SELECT_X86 (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64)
465-
#define HANDLE_DW_CFA(ID, NAME)
466-
#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \
467-
if (ID == Encoding && PRED) \
468-
return "DW_CFA_" #NAME;
469-
#include "llvm/BinaryFormat/Dwarf.def"
470-
458+
StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
471459
switch (Encoding) {
472460
default:
473461
return StringRef();
474-
#define HANDLE_DW_CFA_PRED(ID, NAME, PRED)
475462
#define HANDLE_DW_CFA(ID, NAME) \
476463
case DW_CFA_##NAME: \
477464
return "DW_CFA_" #NAME;
478465
#include "llvm/BinaryFormat/Dwarf.def"
479-
480-
#undef SELECT_X86
481-
#undef SELECT_SPARC
482-
#undef SELECT_MIPS64
483-
#undef SELECT_AARCH64
484466
}
485467
}
486468

‎llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ void AsmPrinter::emitCFIInstruction(const MCCFIInstruction &Inst) const {
212212
case MCCFIInstruction::OpWindowSave:
213213
OutStreamer->EmitCFIWindowSave();
214214
break;
215-
case MCCFIInstruction::OpNegateRAState:
216-
OutStreamer->EmitCFINegateRAState();
217-
break;
218215
case MCCFIInstruction::OpSameValue:
219216
OutStreamer->EmitCFISameValue(Inst.getRegister());
220217
break;

‎llvm/lib/CodeGen/CFIInstrInserter.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
207207
case MCCFIInstruction::OpUndefined:
208208
case MCCFIInstruction::OpRegister:
209209
case MCCFIInstruction::OpWindowSave:
210-
case MCCFIInstruction::OpNegateRAState:
211210
case MCCFIInstruction::OpGnuArgsSize:
212211
break;
213212
}

‎llvm/lib/CodeGen/MIRParser/MILexer.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) {
220220
.Case("undefined", MIToken::kw_cfi_undefined)
221221
.Case("register", MIToken::kw_cfi_register)
222222
.Case("window_save", MIToken::kw_cfi_window_save)
223-
.Case("negate_ra_sign_state", MIToken::kw_cfi_aarch64_negate_ra_sign_state)
224223
.Case("blockaddress", MIToken::kw_blockaddress)
225224
.Case("intrinsic", MIToken::kw_intrinsic)
226225
.Case("target-index", MIToken::kw_target_index)

‎llvm/lib/CodeGen/MIRParser/MILexer.h

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ struct MIToken {
8989
kw_cfi_restore_state,
9090
kw_cfi_undefined,
9191
kw_cfi_window_save,
92-
kw_cfi_aarch64_negate_ra_sign_state,
9392
kw_blockaddress,
9493
kw_intrinsic,
9594
kw_target_index,

‎llvm/lib/CodeGen/MIRParser/MIParser.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -1816,9 +1816,6 @@ bool MIParser::parseCFIOperand(MachineOperand &Dest) {
18161816
case MIToken::kw_cfi_window_save:
18171817
CFIIndex = MF.addFrameInst(MCCFIInstruction::createWindowSave(nullptr));
18181818
break;
1819-
case MIToken::kw_cfi_aarch64_negate_ra_sign_state:
1820-
CFIIndex = MF.addFrameInst(MCCFIInstruction::createNegateRAState(nullptr));
1821-
break;
18221819
case MIToken::kw_cfi_escape: {
18231820
std::string Values;
18241821
if (parseCFIEscapeValues(Values))
@@ -2111,7 +2108,6 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest,
21112108
case MIToken::kw_cfi_restore_state:
21122109
case MIToken::kw_cfi_undefined:
21132110
case MIToken::kw_cfi_window_save:
2114-
case MIToken::kw_cfi_aarch64_negate_ra_sign_state:
21152111
return parseCFIOperand(Dest);
21162112
case MIToken::kw_blockaddress:
21172113
return parseBlockAddressOperand(Dest);

‎llvm/lib/CodeGen/MachineOperand.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,6 @@ static void printCFI(raw_ostream &OS, const MCCFIInstruction &CFI,
696696
if (MCSymbol *Label = CFI.getLabel())
697697
MachineOperand::printSymbol(OS, *Label);
698698
break;
699-
case MCCFIInstruction::OpNegateRAState:
700-
OS << "negate_ra_sign_state ";
701-
if (MCSymbol *Label = CFI.getLabel())
702-
MachineOperand::printSymbol(OS, *Label);
703-
break;
704699
default:
705700
// TODO: Print the other CFI Operations.
706701
OS << "<unserializable cfi directive>";

‎llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ const DWARFDebugFrame *DWARFContext::getDebugFrame() {
724724
// http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html
725725
DWARFDataExtractor debugFrameData(DObj->getDebugFrameSection(),
726726
isLittleEndian(), DObj->getAddressSize());
727-
DebugFrame.reset(new DWARFDebugFrame(Arch, false /* IsEH */));
727+
DebugFrame.reset(new DWARFDebugFrame(false /* IsEH */));
728728
DebugFrame->parse(debugFrameData);
729729
return DebugFrame.get();
730730
}
@@ -735,7 +735,7 @@ const DWARFDebugFrame *DWARFContext::getEHFrame() {
735735

736736
DWARFDataExtractor debugFrameData(DObj->getEHFrameSection(), isLittleEndian(),
737737
DObj->getAddressSize());
738-
DebugFrame.reset(new DWARFDebugFrame(Arch, true /* IsEH */));
738+
DebugFrame.reset(new DWARFDebugFrame(true /* IsEH */));
739739
DebugFrame->parse(debugFrameData);
740740
return DebugFrame.get();
741741
}
@@ -1581,11 +1581,9 @@ DWARFContext::create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
15811581
return llvm::make_unique<DWARFContext>(std::move(DObj), "");
15821582
}
15831583

1584-
Error DWARFContext::loadArchitectureInfo(const object::ObjectFile &Obj) {
1584+
Error DWARFContext::loadRegisterInfo(const object::ObjectFile &Obj) {
15851585
// Detect the architecture from the object file. We usually don't need OS
15861586
// info to lookup a target and create register info.
1587-
Arch = Triple::ArchType(Obj.getArch());
1588-
15891587
Triple TT;
15901588
TT.setArch(Triple::ArchType(Obj.getArch()));
15911589
TT.setVendor(Triple::UnknownVendor);

‎llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void CFIProgram::printOperand(raw_ostream &OS, const MCRegisterInfo *MRI,
225225
switch (Type) {
226226
case OT_Unset: {
227227
OS << " Unsupported " << (OperandIdx ? "second" : "first") << " operand to";
228-
auto OpcodeName = CallFrameString(Opcode, Arch);
228+
auto OpcodeName = CallFrameString(Opcode);
229229
if (!OpcodeName.empty())
230230
OS << " " << OpcodeName;
231231
else
@@ -279,7 +279,7 @@ void CFIProgram::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH,
279279
if (Opcode & DWARF_CFI_PRIMARY_OPCODE_MASK)
280280
Opcode &= DWARF_CFI_PRIMARY_OPCODE_MASK;
281281
OS.indent(2 * IndentLevel);
282-
OS << CallFrameString(Opcode, Arch) << ":";
282+
OS << CallFrameString(Opcode) << ":";
283283
for (unsigned i = 0; i < Instr.Ops.size(); ++i)
284284
printOperand(OS, MRI, IsEH, Instr, i, Instr.Ops[i]);
285285
OS << '\n';
@@ -325,9 +325,8 @@ void FDE::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH) const {
325325
OS << "\n";
326326
}
327327

328-
DWARFDebugFrame::DWARFDebugFrame(Triple::ArchType Arch,
329-
bool IsEH, uint64_t EHFrameAddress)
330-
: Arch(Arch), IsEH(IsEH), EHFrameAddress(EHFrameAddress) {}
328+
DWARFDebugFrame::DWARFDebugFrame(bool IsEH, uint64_t EHFrameAddress)
329+
: IsEH(IsEH), EHFrameAddress(EHFrameAddress) {}
331330

332331
DWARFDebugFrame::~DWARFDebugFrame() = default;
333332

@@ -461,7 +460,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) {
461460
StartOffset, Length, Version, AugmentationString, AddressSize,
462461
SegmentDescriptorSize, CodeAlignmentFactor, DataAlignmentFactor,
463462
ReturnAddressRegister, AugmentationData, FDEPointerEncoding,
464-
LSDAPointerEncoding, Personality, PersonalityEncoding, Arch);
463+
LSDAPointerEncoding, Personality, PersonalityEncoding);
465464
CIEs[StartOffset] = Cie.get();
466465
Entries.emplace_back(std::move(Cie));
467466
} else {
@@ -513,7 +512,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) {
513512

514513
Entries.emplace_back(new FDE(StartOffset, Length, CIEPointer,
515514
InitialLocation, AddressRange,
516-
Cie, LSDAAddress, Arch));
515+
Cie, LSDAAddress));
517516
}
518517

519518
if (Error E =

0 commit comments

Comments
 (0)
Please sign in to comment.