Skip to content

Commit 95f983f

Browse files
committed
[MC] Change Subsection parameters from const MCExpr * to uint32_t
Follow-up to 05ba5c0. uint32_t is preferred over const MCExpr * in the section stack uses because it should only be evaluated once. Change the paramter type to match.
1 parent b37a4b9 commit 95f983f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+95
-142
lines changed

llvm/include/llvm/MC/MCContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class MCContext {
600600
unsigned EntrySize);
601601

602602
MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind,
603-
MCSection *Parent, const MCExpr *SubsectionId);
603+
MCSection *Parent, uint32_t Subsection = 0);
604604

605605
MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
606606
StringRef COMDATSymName, int Selection,

llvm/include/llvm/MC/MCELFStreamer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MCELFStreamer : public MCObjectStreamer {
4646
/// @{
4747

4848
void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override;
49-
void changeSection(MCSection *Section, const MCExpr *Subsection) override;
49+
void changeSection(MCSection *Section, uint32_t Subsection) override;
5050
void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
5151
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F,
5252
uint64_t Offset) override;

llvm/include/llvm/MC/MCObjectStreamer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class MCObjectStreamer : public MCStreamer {
101101
MCDataFragment *getOrCreateDataFragment(const MCSubtargetInfo* STI = nullptr);
102102

103103
protected:
104-
bool changeSectionImpl(MCSection *Section, const MCExpr *Subsection);
104+
bool changeSectionImpl(MCSection *Section, uint32_t Subsection);
105105

106106
public:
107107
void visitUsedSymbol(const MCSymbol &Sym) override;
@@ -122,7 +122,7 @@ class MCObjectStreamer : public MCStreamer {
122122
void emitULEB128Value(const MCExpr *Value) override;
123123
void emitSLEB128Value(const MCExpr *Value) override;
124124
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
125-
void changeSection(MCSection *Section, const MCExpr *Subsection) override;
125+
void changeSection(MCSection *Section, uint32_t Subsection) override;
126126
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
127127

128128
/// Emit an instruction to a special fragment, because this instruction

llvm/include/llvm/MC/MCSection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class MCSection {
211211

212212
virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
213213
raw_ostream &OS,
214-
const MCExpr *Subsection) const = 0;
214+
uint32_t Subsection) const = 0;
215215

216216
/// Return true if a .align directive should use "optimized nops" to fill
217217
/// instead of 0s.

llvm/include/llvm/MC/MCSectionCOFF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class MCSectionCOFF final : public MCSection {
7373

7474
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
7575
raw_ostream &OS,
76-
const MCExpr *Subsection) const override;
76+
uint32_t Subsection) const override;
7777
bool useCodeAlign() const override;
7878
bool isVirtualSection() const override;
7979
StringRef getVirtualSectionKind() const override;

llvm/include/llvm/MC/MCSectionDXContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MCSectionDXContainer final : public MCSection {
2828

2929
public:
3030
void printSwitchToSection(const MCAsmInfo &, const Triple &, raw_ostream &,
31-
const MCExpr *) const override;
31+
uint32_t) const override;
3232
bool useCodeAlign() const override { return false; }
3333
bool isVirtualSection() const override { return false; }
3434
};

llvm/include/llvm/MC/MCSectionELF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class MCSectionELF final : public MCSection {
7979

8080
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
8181
raw_ostream &OS,
82-
const MCExpr *Subsection) const override;
82+
uint32_t Subsection) const override;
8383
bool useCodeAlign() const override;
8484
bool isVirtualSection() const override;
8585
StringRef getVirtualSectionKind() const override;

llvm/include/llvm/MC/MCSectionGOFF.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ class MCExpr;
2626
class MCSectionGOFF final : public MCSection {
2727
private:
2828
MCSection *Parent;
29-
const MCExpr *SubsectionId;
29+
uint32_t Subsection;
3030

3131
friend class MCContext;
32-
MCSectionGOFF(StringRef Name, SectionKind K, MCSection *P, const MCExpr *Sub)
32+
MCSectionGOFF(StringRef Name, SectionKind K, MCSection *P, uint32_t Sub)
3333
: MCSection(SV_GOFF, Name, K.isText(), nullptr), Parent(P),
34-
SubsectionId(Sub) {}
34+
Subsection(Sub) {}
3535

3636
public:
3737
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
3838
raw_ostream &OS,
39-
const MCExpr *Subsection) const override {
39+
uint32_t /*Subsection*/) const override {
4040
OS << "\t.section\t\"" << getName() << "\"\n";
4141
}
4242

@@ -45,7 +45,7 @@ class MCSectionGOFF final : public MCSection {
4545
bool isVirtualSection() const override { return false; }
4646

4747
MCSection *getParent() const { return Parent; }
48-
const MCExpr *getSubsectionId() const { return SubsectionId; }
48+
uint32_t getSubsection() const { return Subsection; }
4949

5050
static bool classof(const MCSection *S) { return S->getVariant() == SV_GOFF; }
5151
};

llvm/include/llvm/MC/MCSectionMachO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class MCSectionMachO final : public MCSection {
7373

7474
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
7575
raw_ostream &OS,
76-
const MCExpr *Subsection) const override;
76+
uint32_t Subsection) const override;
7777
bool useCodeAlign() const override;
7878
bool isVirtualSection() const override;
7979

llvm/include/llvm/MC/MCSectionSPIRV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MCSectionSPIRV final : public MCSection {
3131
~MCSectionSPIRV() = default;
3232
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
3333
raw_ostream &OS,
34-
const MCExpr *Subsection) const override {}
34+
uint32_t Subsection) const override {}
3535
bool useCodeAlign() const override { return false; }
3636
bool isVirtualSection() const override { return false; }
3737
};

0 commit comments

Comments
 (0)