Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | X86AsmBackend(const Target &T, const MCSubtargetInfo &STI) | ||||
// Allow overriding defaults set by master flag | // Allow overriding defaults set by master flag | ||||
if (X86AlignBranchBoundary.getNumOccurrences()) | if (X86AlignBranchBoundary.getNumOccurrences()) | ||||
AlignBoundary = assumeAligned(X86AlignBranchBoundary); | AlignBoundary = assumeAligned(X86AlignBranchBoundary); | ||||
if (X86AlignBranch.getNumOccurrences()) | if (X86AlignBranch.getNumOccurrences()) | ||||
AlignBranchType = X86AlignBranchKindLoc; | AlignBranchType = X86AlignBranchKindLoc; | ||||
} | } | ||||
bool allowAutoPadding() const override; | bool allowAutoPadding() const override; | ||||
bool allowEnhancedRelaxation() const override; | |||||
LuoYuanke: Why not just name it as "allowRelaxing" ? The relax information is eventually be indicated in… | |||||
See the description in the summary. Traditional relaxation means the operand's size of instruction may be change (e.g, JCC1->JCC4), but if we allow enhanced relaxtion, we can change the instruction's size by adding prefixes on it. They are different, and the enhanced relaxtion has nothing to do with td file skan: See the description in the summary. Traditional relaxation means the operand's size of… | |||||
void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) override; | void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) override; | ||||
void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) override; | void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) override; | ||||
unsigned getNumFixupKinds() const override { | unsigned getNumFixupKinds() const override { | ||||
return X86::NumTargetFixupKinds; | return X86::NumTargetFixupKinds; | ||||
} | } | ||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override; | Optional<MCFixupKind> getFixupKind(StringRef Name) const override; | ||||
▲ Show 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | static bool hasVariantSymbol(const MCInst &MI) { | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
bool X86AsmBackend::allowAutoPadding() const { | bool X86AsmBackend::allowAutoPadding() const { | ||||
return (AlignBoundary != Align(1) && AlignBranchType != X86::AlignBranchNone); | return (AlignBoundary != Align(1) && AlignBranchType != X86::AlignBranchNone); | ||||
} | } | ||||
bool X86AsmBackend::allowEnhancedRelaxation() const { | |||||
return allowAutoPadding() && X86PadMaxPrefixSize != 0 && X86PadForBranchAlign; | |||||
} | |||||
bool X86AsmBackend::needAlign(MCObjectStreamer &OS) const { | bool X86AsmBackend::needAlign(MCObjectStreamer &OS) const { | ||||
if (!OS.getAllowAutoPadding()) | if (!OS.getAllowAutoPadding()) | ||||
return false; | return false; | ||||
assert(allowAutoPadding() && "incorrect initialization!"); | assert(allowAutoPadding() && "incorrect initialization!"); | ||||
// To be Done: Currently don't deal with Bundle cases. | // To be Done: Currently don't deal with Bundle cases. | ||||
if (OS.getAssembler().isBundlingEnabled()) | if (OS.getAssembler().isBundlingEnabled()) | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 1,134 Lines • Show Last 20 Lines |
Why not just name it as "allowRelaxing" ? The relax information is eventually be indicated in instruction's .td file, right?