aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp6
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp10
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp2
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp4
-rw-r--r--llvm/lib/MC/MCStreamer.cpp2
5 files changed, 11 insertions, 13 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 2a94655..9483dd5 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -381,7 +381,7 @@ public:
uint64_t Attr,
const MCPseudoProbeInlineStack &InlineStack, MCSymbol *FnSym) override;
- void emitBundleAlignMode(unsigned AlignPow2) override;
+ void emitBundleAlignMode(Align Alignment) override;
void emitBundleLock(bool AlignToEnd) override;
void emitBundleUnlock() override;
@@ -2353,8 +2353,8 @@ void MCAsmStreamer::emitPseudoProbe(
EmitEOL();
}
-void MCAsmStreamer::emitBundleAlignMode(unsigned AlignPow2) {
- OS << "\t.bundle_align_mode " << AlignPow2;
+void MCAsmStreamer::emitBundleAlignMode(Align Alignment) {
+ OS << "\t.bundle_align_mode " << Log2(Alignment);
EmitEOL();
}
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index e5b46a6..6b9f590 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -635,12 +635,12 @@ void MCELFStreamer::emitInstToData(const MCInst &Inst,
}
}
-void MCELFStreamer::emitBundleAlignMode(unsigned AlignPow2) {
- assert(AlignPow2 <= 30 && "Invalid bundle alignment");
+void MCELFStreamer::emitBundleAlignMode(Align Alignment) {
+ assert(Log2(Alignment) <= 30 && "Invalid bundle alignment");
MCAssembler &Assembler = getAssembler();
- if (AlignPow2 > 0 && (Assembler.getBundleAlignSize() == 0 ||
- Assembler.getBundleAlignSize() == 1U << AlignPow2))
- Assembler.setBundleAlignSize(1U << AlignPow2);
+ if (Alignment > 1 && (Assembler.getBundleAlignSize() == 0 ||
+ Assembler.getBundleAlignSize() == Alignment.value()))
+ Assembler.setBundleAlignSize(Alignment.value());
else
report_fatal_error(".bundle_align_mode cannot be changed once set");
}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index c99f127..701f0c5 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -480,7 +480,7 @@ static const char *const BundlingNotImplementedMsg =
"Aligned bundling is not implemented for this object format";
#endif
-void MCObjectStreamer::emitBundleAlignMode(unsigned AlignPow2) {
+void MCObjectStreamer::emitBundleAlignMode(Align Alignment) {
llvm_unreachable(BundlingNotImplementedMsg);
}
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index ce90c21..8866e9c 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -4808,9 +4808,7 @@ bool AsmParser::parseDirectiveBundleAlignMode() {
"invalid bundle alignment size (expected between 0 and 30)"))
return true;
- // Because of AlignSizePow2's verified range we can safely truncate it to
- // unsigned.
- getStreamer().emitBundleAlignMode(static_cast<unsigned>(AlignSizePow2));
+ getStreamer().emitBundleAlignMode(Align(1ULL << AlignSizePow2));
return false;
}
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index fbfef943..4405cda 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -1227,7 +1227,7 @@ void MCStreamer::emitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit) {}
void MCStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value,
SMLoc Loc) {}
-void MCStreamer::emitBundleAlignMode(unsigned AlignPow2) {}
+void MCStreamer::emitBundleAlignMode(Align Alignment) {}
void MCStreamer::emitBundleLock(bool AlignToEnd) {}
void MCStreamer::finishImpl() {}
void MCStreamer::emitBundleUnlock() {}