Skip to content

Commit b1a7a24

Browse files
committed
[NFC][MC] Rename alignBranches* to emitInstruction*
alignBranches is X86 specific, change the name in a more general one since other target can do some state chang before and after emitting the instruction.
1 parent a2923b2 commit b1a7a24

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ class MCAsmBackend {
5151
virtual bool allowAutoPadding() const { return false; }
5252

5353
/// Give the target a chance to manipulate state related to instruction
54-
/// alignment (e.g. padding for optimization) before and after actually
55-
/// emitting the instruction.
56-
virtual void alignBranchesBegin(MCObjectStreamer &OS, const MCInst &Inst) {}
57-
virtual void alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) {}
54+
/// alignment (e.g. padding for optimization), instruction relaxablility, etc.
55+
/// before and after actually emitting the instruction.
56+
virtual void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) {}
57+
virtual void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {}
5858

5959
/// lifetime management
6060
virtual void reset() {}

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const {
367367

368368
void MCObjectStreamer::emitInstruction(const MCInst &Inst,
369369
const MCSubtargetInfo &STI) {
370-
getAssembler().getBackend().alignBranchesBegin(*this, Inst);
370+
getAssembler().getBackend().emitInstructionBegin(*this, Inst);
371371
emitInstructionImpl(Inst, STI);
372-
getAssembler().getBackend().alignBranchesEnd(*this, Inst);
372+
getAssembler().getBackend().emitInstructionEnd(*this, Inst);
373373
}
374374

375375
void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst,

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ class X86AsmBackend : public MCAsmBackend {
161161
}
162162

163163
bool allowAutoPadding() const override;
164-
void alignBranchesBegin(MCObjectStreamer &OS, const MCInst &Inst) override;
165-
void alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) override;
164+
void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) override;
165+
void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) override;
166166

167167
unsigned getNumFixupKinds() const override {
168168
return X86::NumTargetFixupKinds;
@@ -171,7 +171,7 @@ class X86AsmBackend : public MCAsmBackend {
171171
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
172172

173173
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
174-
174+
175175
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
176176
const MCValue &Target) override;
177177

@@ -512,7 +512,7 @@ bool X86AsmBackend::needAlignInst(const MCInst &Inst) const {
512512
}
513513

514514
/// Insert BoundaryAlignFragment before instructions to align branches.
515-
void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
515+
void X86AsmBackend::emitInstructionBegin(MCObjectStreamer &OS,
516516
const MCInst &Inst) {
517517
if (!needAlign(OS))
518518
return;
@@ -538,7 +538,7 @@ void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
538538
//
539539
// Do nothing here since we already inserted a BoudaryAlign fragment when
540540
// we met the first instruction in the fused pair and we'll tie them
541-
// together in alignBranchesEnd.
541+
// together in emitInstructionEnd.
542542
//
543543
// Note: When there is at least one fragment, such as MCAlignFragment,
544544
// inserted after the previous instruction, e.g.
@@ -564,7 +564,7 @@ void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
564564
}
565565

566566
/// Set the last fragment to be aligned for the BoundaryAlignFragment.
567-
void X86AsmBackend::alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) {
567+
void X86AsmBackend::emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {
568568
if (!needAlign(OS))
569569
return;
570570

0 commit comments

Comments
 (0)