mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
MC: clang-format MCContext. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,10 +45,12 @@ namespace llvm {
|
|||||||
/// sections that it creates.
|
/// sections that it creates.
|
||||||
///
|
///
|
||||||
class MCContext {
|
class MCContext {
|
||||||
MCContext(const MCContext&) = delete;
|
MCContext(const MCContext &) = delete;
|
||||||
MCContext &operator=(const MCContext&) = delete;
|
MCContext &operator=(const MCContext &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef StringMap<MCSymbol*, BumpPtrAllocator&> SymbolTable;
|
typedef StringMap<MCSymbol *, BumpPtrAllocator &> SymbolTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The SourceMgr for this object, if any.
|
/// The SourceMgr for this object, if any.
|
||||||
const SourceMgr *SrcMgr;
|
const SourceMgr *SrcMgr;
|
||||||
@@ -73,7 +75,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// ELF sections can have a corresponding symbol. This maps one to the
|
/// ELF sections can have a corresponding symbol. This maps one to the
|
||||||
/// other.
|
/// other.
|
||||||
DenseMap<const MCSectionELF*, MCSymbol*> SectionSymbols;
|
DenseMap<const MCSectionELF *, MCSymbol *> SectionSymbols;
|
||||||
|
|
||||||
/// A mapping from a local label number and an instance count to a symbol.
|
/// A mapping from a local label number and an instance count to a symbol.
|
||||||
/// For example, in the assembly
|
/// For example, in the assembly
|
||||||
@@ -81,11 +83,11 @@ namespace llvm {
|
|||||||
/// 2:
|
/// 2:
|
||||||
/// 1:
|
/// 1:
|
||||||
/// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
|
/// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
|
||||||
DenseMap<std::pair<unsigned, unsigned>, MCSymbol*> LocalSymbols;
|
DenseMap<std::pair<unsigned, unsigned>, MCSymbol *> LocalSymbols;
|
||||||
|
|
||||||
/// Keeps tracks of names that were used both for used declared and
|
/// Keeps tracks of names that were used both for used declared and
|
||||||
/// artificial symbols.
|
/// artificial symbols.
|
||||||
StringMap<bool, BumpPtrAllocator&> UsedNames;
|
StringMap<bool, BumpPtrAllocator &> UsedNames;
|
||||||
|
|
||||||
/// The next ID to dole out to an unnamed assembler temporary symbol with
|
/// The next ID to dole out to an unnamed assembler temporary symbol with
|
||||||
/// a given prefix.
|
/// a given prefix.
|
||||||
@@ -136,8 +138,8 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Symbols created for the start and end of each section, used for
|
/// Symbols created for the start and end of each section, used for
|
||||||
/// generating the .debug_ranges and .debug_aranges sections.
|
/// generating the .debug_ranges and .debug_aranges sections.
|
||||||
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >
|
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>>
|
||||||
SectionStartEndSyms;
|
SectionStartEndSyms;
|
||||||
|
|
||||||
/// The information gathered from labels that will have dwarf label
|
/// The information gathered from labels that will have dwarf label
|
||||||
/// entries when generating dwarf assembly source files.
|
/// entries when generating dwarf assembly source files.
|
||||||
@@ -197,7 +199,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap<const MCSectionMachO*> MachOUniquingMap;
|
StringMap<const MCSectionMachO *> MachOUniquingMap;
|
||||||
std::map<ELFSectionKey, const MCSectionELF *> ELFUniquingMap;
|
std::map<ELFSectionKey, const MCSectionELF *> ELFUniquingMap;
|
||||||
std::map<COFFSectionKey, const MCSectionCOFF *> COFFUniquingMap;
|
std::map<COFFSectionKey, const MCSectionCOFF *> COFFUniquingMap;
|
||||||
StringMap<bool> ELFRelSecNames;
|
StringMap<bool> ELFRelSecNames;
|
||||||
@@ -280,9 +282,7 @@ namespace llvm {
|
|||||||
/// want to, for example, iterate over all symbols. 'const' because we
|
/// want to, for example, iterate over all symbols. 'const' because we
|
||||||
/// still want any modifications to the table itself to use the MCContext
|
/// still want any modifications to the table itself to use the MCContext
|
||||||
/// APIs.
|
/// APIs.
|
||||||
const SymbolTable &getSymbols() const {
|
const SymbolTable &getSymbols() const { return Symbols; }
|
||||||
return Symbols;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
@@ -433,9 +433,7 @@ namespace llvm {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned getDwarfCompileUnitID() {
|
unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
|
||||||
return DwarfCompileUnitID;
|
|
||||||
}
|
|
||||||
void setDwarfCompileUnitID(unsigned CUIndex) {
|
void setDwarfCompileUnitID(unsigned CUIndex) {
|
||||||
DwarfCompileUnitID = CUIndex;
|
DwarfCompileUnitID = CUIndex;
|
||||||
}
|
}
|
||||||
@@ -469,12 +467,12 @@ namespace llvm {
|
|||||||
void setGenDwarfFileNumber(unsigned FileNumber) {
|
void setGenDwarfFileNumber(unsigned FileNumber) {
|
||||||
GenDwarfFileNumber = FileNumber;
|
GenDwarfFileNumber = FileNumber;
|
||||||
}
|
}
|
||||||
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> > &
|
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>> &
|
||||||
getGenDwarfSectionSyms() {
|
getGenDwarfSectionSyms() {
|
||||||
return SectionStartEndSyms;
|
return SectionStartEndSyms;
|
||||||
}
|
}
|
||||||
std::pair<MapVector<const MCSection *,
|
std::pair<MapVector<const MCSection *,
|
||||||
std::pair<MCSymbol *, MCSymbol *> >::iterator,
|
std::pair<MCSymbol *, MCSymbol *>>::iterator,
|
||||||
bool>
|
bool>
|
||||||
addGenDwarfSection(const MCSection *Sec) {
|
addGenDwarfSection(const MCSection *Sec) {
|
||||||
return SectionStartEndSyms.insert(
|
return SectionStartEndSyms.insert(
|
||||||
@@ -502,18 +500,13 @@ namespace llvm {
|
|||||||
char *getSecureLogFile() { return SecureLogFile; }
|
char *getSecureLogFile() { return SecureLogFile; }
|
||||||
raw_ostream *getSecureLog() { return SecureLog; }
|
raw_ostream *getSecureLog() { return SecureLog; }
|
||||||
bool getSecureLogUsed() { return SecureLogUsed; }
|
bool getSecureLogUsed() { return SecureLogUsed; }
|
||||||
void setSecureLog(raw_ostream *Value) {
|
void setSecureLog(raw_ostream *Value) { SecureLog = Value; }
|
||||||
SecureLog = Value;
|
void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
|
||||||
}
|
|
||||||
void setSecureLogUsed(bool Value) {
|
|
||||||
SecureLogUsed = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *allocate(unsigned Size, unsigned Align = 8) {
|
void *allocate(unsigned Size, unsigned Align = 8) {
|
||||||
return Allocator.Allocate(Size, Align);
|
return Allocator.Allocate(Size, Align);
|
||||||
}
|
}
|
||||||
void deallocate(void *Ptr) {
|
void deallocate(void *Ptr) {}
|
||||||
}
|
|
||||||
|
|
||||||
// Unrecoverable error has occurred. Display the best diagnostic we can
|
// Unrecoverable error has occurred. Display the best diagnostic we can
|
||||||
// and bail via exit(1). For now, most MC backend errors are unrecoverable.
|
// and bail via exit(1). For now, most MC backend errors are unrecoverable.
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ MCContext::~MCContext() {
|
|||||||
// we don't need to free them here.
|
// we don't need to free them here.
|
||||||
|
|
||||||
// If the stream for the .secure_log_unique directive was created free it.
|
// If the stream for the .secure_log_unique directive was created free it.
|
||||||
delete (raw_ostream*)SecureLog;
|
delete (raw_ostream *)SecureLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@@ -81,7 +81,7 @@ void MCContext::reset() {
|
|||||||
MCGenDwarfLabelEntries.clear();
|
MCGenDwarfLabelEntries.clear();
|
||||||
DwarfDebugFlags = StringRef();
|
DwarfDebugFlags = StringRef();
|
||||||
DwarfCompileUnitID = 0;
|
DwarfCompileUnitID = 0;
|
||||||
CurrentDwarfLoc = MCDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0);
|
CurrentDwarfLoc = MCDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0);
|
||||||
|
|
||||||
MachOUniquingMap.clear();
|
MachOUniquingMap.clear();
|
||||||
ELFUniquingMap.clear();
|
ELFUniquingMap.clear();
|
||||||
@@ -275,9 +275,10 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
|
|||||||
ELFSectionKey{Section->getSectionName(), GroupName, UniqueID});
|
ELFSectionKey{Section->getSectionName(), GroupName, UniqueID});
|
||||||
auto I = ELFUniquingMap.insert(std::make_pair(
|
auto I = ELFUniquingMap.insert(std::make_pair(
|
||||||
ELFSectionKey{Name, GroupName, UniqueID},
|
ELFSectionKey{Name, GroupName, UniqueID},
|
||||||
Section)).first;
|
Section))
|
||||||
|
.first;
|
||||||
StringRef CachedName = I->first.SectionName;
|
StringRef CachedName = I->first.SectionName;
|
||||||
const_cast<MCSectionELF*>(Section)->setSectionName(CachedName);
|
const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *
|
const MCSectionELF *
|
||||||
@@ -424,8 +425,8 @@ unsigned MCContext::getDwarfFile(StringRef Directory, StringRef FileName,
|
|||||||
/// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
|
/// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
|
||||||
/// currently is assigned and false otherwise.
|
/// currently is assigned and false otherwise.
|
||||||
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
|
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
|
||||||
const SmallVectorImpl<MCDwarfFile>& MCDwarfFiles = getMCDwarfFiles(CUID);
|
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = getMCDwarfFiles(CUID);
|
||||||
if(FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
|
if (FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !MCDwarfFiles[FileNumber].Name.empty();
|
return !MCDwarfFiles[FileNumber].Name.empty();
|
||||||
@@ -447,8 +448,8 @@ void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
|
|||||||
sec->second.second = SectionEndSym;
|
sec->second.second = SectionEndSym;
|
||||||
++sec;
|
++sec;
|
||||||
} else {
|
} else {
|
||||||
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >::iterator
|
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>>::iterator
|
||||||
to_erase = sec;
|
to_erase = sec;
|
||||||
sec = SectionStartEndSyms.erase(to_erase);
|
sec = SectionStartEndSyms.erase(to_erase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user