[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.
This commit is contained in:
Shengchen Kan 2020-03-16 16:52:31 +08:00
parent a2923b2a1e
commit b1a7a245ec
3 changed files with 12 additions and 12 deletions

View File

@ -51,10 +51,10 @@ public:
virtual bool allowAutoPadding() const { return false; }
/// Give the target a chance to manipulate state related to instruction
/// alignment (e.g. padding for optimization) before and after actually
/// emitting the instruction.
virtual void alignBranchesBegin(MCObjectStreamer &OS, const MCInst &Inst) {}
virtual void alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) {}
/// alignment (e.g. padding for optimization), instruction relaxablility, etc.
/// before and after actually emitting the instruction.
virtual void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) {}
virtual void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {}
/// lifetime management
virtual void reset() {}

View File

@ -367,9 +367,9 @@ bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const {
void MCObjectStreamer::emitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI) {
getAssembler().getBackend().alignBranchesBegin(*this, Inst);
getAssembler().getBackend().emitInstructionBegin(*this, Inst);
emitInstructionImpl(Inst, STI);
getAssembler().getBackend().alignBranchesEnd(*this, Inst);
getAssembler().getBackend().emitInstructionEnd(*this, Inst);
}
void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst,

View File

@ -161,8 +161,8 @@ public:
}
bool allowAutoPadding() const override;
void alignBranchesBegin(MCObjectStreamer &OS, const MCInst &Inst) override;
void alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) override;
void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) override;
void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) override;
unsigned getNumFixupKinds() const override {
return X86::NumTargetFixupKinds;
@ -171,7 +171,7 @@ public:
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target) override;
@ -512,7 +512,7 @@ bool X86AsmBackend::needAlignInst(const MCInst &Inst) const {
}
/// Insert BoundaryAlignFragment before instructions to align branches.
void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
void X86AsmBackend::emitInstructionBegin(MCObjectStreamer &OS,
const MCInst &Inst) {
if (!needAlign(OS))
return;
@ -538,7 +538,7 @@ void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
//
// Do nothing here since we already inserted a BoudaryAlign fragment when
// we met the first instruction in the fused pair and we'll tie them
// together in alignBranchesEnd.
// together in emitInstructionEnd.
//
// Note: When there is at least one fragment, such as MCAlignFragment,
// inserted after the previous instruction, e.g.
@ -564,7 +564,7 @@ void X86AsmBackend::alignBranchesBegin(MCObjectStreamer &OS,
}
/// Set the last fragment to be aligned for the BoundaryAlignFragment.
void X86AsmBackend::alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) {
void X86AsmBackend::emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {
if (!needAlign(OS))
return;