1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2025-03-14 15:33:34 +00:00

MC: clang-format. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2015-05-15 19:13:20 +00:00
parent 251a66ec37
commit 792476e626
4 changed files with 107 additions and 149 deletions

@ -119,14 +119,11 @@ public:
/// Note that padding size is restricted to 8 bits. This is an optimization
/// to reduce the amount of space used for each fragment. In practice, larger
/// padding should never be required.
virtual uint8_t getBundlePadding() const {
return 0;
}
virtual uint8_t getBundlePadding() const { return 0; }
/// \brief Set the padding size for this fragment. By default it's a no-op,
/// and only some fragments have a meaningful implementation.
virtual void setBundlePadding(uint8_t N) {
}
virtual void setBundlePadding(uint8_t N) {}
void dump();
};
@ -138,23 +135,18 @@ class MCEncodedFragment : public MCFragment {
virtual void anchor();
uint8_t BundlePadding;
public:
MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = nullptr)
: MCFragment(FType, SD), BundlePadding(0)
{
}
: MCFragment(FType, SD), BundlePadding(0) {}
~MCEncodedFragment() override;
virtual SmallVectorImpl<char> &getContents() = 0;
virtual const SmallVectorImpl<char> &getContents() const = 0;
uint8_t getBundlePadding() const override {
return BundlePadding;
}
uint8_t getBundlePadding() const override { return BundlePadding; }
void setBundlePadding(uint8_t N) override {
BundlePadding = N;
}
void setBundlePadding(uint8_t N) override { BundlePadding = N; }
static bool classof(const MCFragment *F) {
MCFragment::FragmentType Kind = F->getKind();
@ -178,9 +170,7 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
public:
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType,
MCSectionData *SD = nullptr)
: MCEncodedFragment(FType, SD)
{
}
: MCEncodedFragment(FType, SD) {}
~MCEncodedFragmentWithFixups() override;
@ -216,25 +206,18 @@ class MCDataFragment : public MCEncodedFragmentWithFixups {
/// Fixups - The list of fixups in this fragment.
SmallVector<MCFixup, 4> Fixups;
public:
MCDataFragment(MCSectionData *SD = nullptr)
: MCEncodedFragmentWithFixups(FT_Data, SD),
HasInstructions(false), AlignToBundleEnd(false)
{
}
: MCEncodedFragmentWithFixups(FT_Data, SD), HasInstructions(false),
AlignToBundleEnd(false) {}
SmallVectorImpl<char> &getContents() override { return Contents; }
const SmallVectorImpl<char> &getContents() const override {
return Contents;
}
const SmallVectorImpl<char> &getContents() const override { return Contents; }
SmallVectorImpl<MCFixup> &getFixups() override {
return Fixups;
}
SmallVectorImpl<MCFixup> &getFixups() override { return Fixups; }
const SmallVectorImpl<MCFixup> &getFixups() const override {
return Fixups;
}
const SmallVectorImpl<MCFixup> &getFixups() const override { return Fixups; }
bool hasInstructions() const override { return HasInstructions; }
virtual void setHasInstructions(bool V) { HasInstructions = V; }
@ -265,15 +248,12 @@ class MCCompactEncodedInstFragment : public MCEncodedFragment {
bool AlignToBundleEnd;
SmallVector<char, 4> Contents;
public:
MCCompactEncodedInstFragment(MCSectionData *SD = nullptr)
: MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false)
{
}
: MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false) {}
bool hasInstructions() const override {
return true;
}
bool hasInstructions() const override { return true; }
SmallVectorImpl<char> &getContents() override { return Contents; }
const SmallVectorImpl<char> &getContents() const override { return Contents; }
@ -319,13 +299,9 @@ public:
const MCSubtargetInfo &getSubtargetInfo() { return STI; }
SmallVectorImpl<MCFixup> &getFixups() override {
return Fixups;
}
SmallVectorImpl<MCFixup> &getFixups() override { return Fixups; }
const SmallVectorImpl<MCFixup> &getFixups() const override {
return Fixups;
}
const SmallVectorImpl<MCFixup> &getFixups() const override { return Fixups; }
bool hasInstructions() const override { return true; }
@ -463,11 +439,13 @@ class MCLEBFragment : public MCFragment {
bool IsSigned;
SmallString<8> Contents;
public:
MCLEBFragment(const MCExpr &Value_, bool IsSigned_,
MCSectionData *SD = nullptr)
: MCFragment(FT_LEB, SD),
Value(&Value_), IsSigned(IsSigned_) { Contents.push_back(0); }
: MCFragment(FT_LEB, SD), Value(&Value_), IsSigned(IsSigned_) {
Contents.push_back(0);
}
/// \name Accessors
/// @{
@ -577,6 +555,7 @@ public:
BundleLocked,
BundleLockedAlignToEnd
};
private:
FragmentListType Fragments;
const MCSection *Section;
@ -658,13 +637,9 @@ public:
iterator getSubsectionInsertionPoint(unsigned Subsection);
bool isBundleLocked() const {
return BundleLockState != NotBundleLocked;
}
bool isBundleLocked() const { return BundleLockState != NotBundleLocked; }
BundleLockStateType getBundleLockState() const {
return BundleLockState;
}
BundleLockStateType getBundleLockState() const { return BundleLockState; }
void setBundleLockState(BundleLockStateType NewState);
@ -771,14 +746,9 @@ public:
return CommonSize;
}
void setSize(const MCExpr *SS) {
SymbolSize = SS;
}
const MCExpr *getSize() const {
return SymbolSize;
}
void setSize(const MCExpr *SS) { SymbolSize = SS; }
const MCExpr *getSize() const { return SymbolSize; }
/// getCommonAlignment - Return the alignment of a 'common' symbol.
unsigned getCommonAlignment() const {
@ -860,6 +830,7 @@ public:
unsigned Minor;
unsigned Update;
} VersionMinInfoType;
private:
MCAssembler(const MCAssembler &) = delete;
void operator=(const MCAssembler &) = delete;
@ -929,6 +900,7 @@ private:
MCLOHContainer LOHContainer;
VersionMinInfoType VersionMinInfo;
private:
/// Evaluate a fixup to a relocatable expression and the value which should be
/// placed into the fixup.
@ -943,9 +915,9 @@ private:
/// \return Whether the fixup value was fully resolved. This is true if the
/// \p Value result is fixed, otherwise the value may change due to
/// relocation.
bool evaluateFixup(const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
MCValue &Target, uint64_t &Value) const;
bool evaluateFixup(const MCAsmLayout &Layout, const MCFixup &Fixup,
const MCFragment *DF, MCValue &Target,
uint64_t &Value) const;
/// Check whether a fixup can be satisfied, or whether it needs to be relaxed
/// (increased in size, in order to hold its value correctly).
@ -1053,23 +1025,15 @@ public:
void Finish();
// FIXME: This does not belong here.
bool getSubsectionsViaSymbols() const {
return SubsectionsViaSymbols;
}
void setSubsectionsViaSymbols(bool Value) {
SubsectionsViaSymbols = Value;
}
bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }
void setSubsectionsViaSymbols(bool Value) { SubsectionsViaSymbols = Value; }
bool getRelaxAll() const { return RelaxAll; }
void setRelaxAll(bool Value) { RelaxAll = Value; }
bool isBundlingEnabled() const {
return BundleAlignSize != 0;
}
bool isBundlingEnabled() const { return BundleAlignSize != 0; }
unsigned getBundleAlignSize() const {
return BundleAlignSize;
}
unsigned getBundleAlignSize() const { return BundleAlignSize; }
void setBundleAlignSize(unsigned Size) {
assert((Size == 0 || !(Size & (Size - 1))) &&
@ -1105,7 +1069,9 @@ public:
const_symbol_iterator symbol_end() const { return Symbols.end(); }
symbol_range symbols() { return make_range(symbol_begin(), symbol_end()); }
const_symbol_range symbols() const { return make_range(symbol_begin(), symbol_end()); }
const_symbol_range symbols() const {
return make_range(symbol_begin(), symbol_end());
}
size_t symbol_size() const { return Symbols.size(); }
@ -1151,20 +1117,14 @@ public:
// FIXME: This is a total hack, this should not be here. Once things are
// factored so that the streamer has direct access to the .o writer, it can
// disappear.
std::vector<DataRegionData> &getDataRegions() {
return DataRegions;
}
std::vector<DataRegionData> &getDataRegions() { return DataRegions; }
data_region_iterator data_region_begin() {
return DataRegions.begin();
}
data_region_iterator data_region_begin() { return DataRegions.begin(); }
const_data_region_iterator data_region_begin() const {
return DataRegions.begin();
}
data_region_iterator data_region_end() {
return DataRegions.end();
}
data_region_iterator data_region_end() { return DataRegions.end(); }
const_data_region_iterator data_region_end() const {
return DataRegions.end();
}
@ -1178,9 +1138,7 @@ public:
// FIXME: This is a total hack, this should not be here. Once things are
// factored so that the streamer has direct access to the .o writer, it can
// disappear.
MCLOHContainer & getLOHContainer() {
return LOHContainer;
}
MCLOHContainer &getLOHContainer() { return LOHContainer; }
const MCLOHContainer &getLOHContainer() const {
return const_cast<MCAssembler *>(this)->getLOHContainer();
}
@ -1198,7 +1156,8 @@ public:
bool *Created = nullptr) {
MCSectionData *&Entry = SectionMap[&Section];
if (Created) *Created = !Entry;
if (Created)
*Created = !Entry;
if (!Entry)
Entry = new MCSectionData(Section, this);
@ -1224,7 +1183,8 @@ public:
bool *Created = nullptr) {
MCSymbolData *&Entry = SymbolMap[&Symbol];
if (Created) *Created = !Entry;
if (Created)
*Created = !Entry;
if (!Entry)
Entry = new MCSymbolData(Symbol, nullptr, 0, this);
@ -1235,9 +1195,7 @@ public:
return FileNames.begin();
}
const_file_name_iterator file_names_end() const {
return FileNames.end();
}
const_file_name_iterator file_names_end() const { return FileNames.end(); }
void addFileName(StringRef FileName) {
if (std::find(file_names_begin(), file_names_end(), FileName) ==
@ -1258,8 +1216,7 @@ public:
/// \brief Compute the amount of padding required before the fragment \p F to
/// obey bundling restrictions, where \p FOffset is the fragment's offset in
/// its section and \p FSize is the fragment's size.
uint64_t computeBundlePadding(const MCAssembler &Assembler,
const MCFragment *F,
uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F,
uint64_t FOffset, uint64_t FSize);
} // end namespace llvm

@ -24,6 +24,7 @@ class MCCodeEmitter {
private:
MCCodeEmitter(const MCCodeEmitter &) = delete;
void operator=(const MCCodeEmitter &) = delete;
protected: // Can only create subclasses.
MCCodeEmitter();