aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index b9e03b6cb6d2..ee99cfc7d655 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -18,6 +18,7 @@
//===----------------------------------------------------------------------===//
#include "PPCELFStreamer.h"
+#include "PPCMCAsmInfo.h"
#include "PPCMCCodeEmitter.h"
#include "PPCMCTargetDesc.h"
#include "llvm/BinaryFormat/ELF.h"
@@ -138,8 +139,8 @@ void PPCELFStreamer::emitGOTToPCRelReloc(const MCInst &Inst) {
// Cast the last operand to MCSymbolRefExpr to get the symbol.
const MCExpr *Expr = Operand.getExpr();
const MCSymbolRefExpr *SymExpr = static_cast<const MCSymbolRefExpr *>(Expr);
- assert(SymExpr->getKind() == MCSymbolRefExpr::VK_PPC_PCREL_OPT &&
- "Expecting a symbol of type VK_PPC_PCREL_OPT");
+ assert(getSpecifier(SymExpr) == PPC::S_PCREL_OPT &&
+ "Expecting a symbol of type VK_PCREL_OPT");
MCSymbol *LabelSym =
getContext().getOrCreateSymbol(SymExpr->getSymbol().getName());
const MCExpr *LabelExpr = MCSymbolRefExpr::create(LabelSym, getContext());
@@ -158,9 +159,7 @@ void PPCELFStreamer::emitGOTToPCRelReloc(const MCInst &Inst) {
assert(DF && "Expecting a valid data fragment.");
MCFixupKind FixupKind = static_cast<MCFixupKind>(FirstLiteralRelocationKind +
ELF::R_PPC64_PCREL_OPT);
- DF->getFixups().push_back(
- MCFixup::create(LabelSym->getOffset() - 8, SubExpr2,
- FixupKind, Inst.getLoc()));
+ DF->addFixup(MCFixup::create(LabelSym->getOffset() - 8, SubExpr2, FixupKind));
emitLabel(CurrentLocation, Inst.getLoc());
}
@@ -173,8 +172,8 @@ void PPCELFStreamer::emitGOTToPCRelLabel(const MCInst &Inst) {
// Cast the last operand to MCSymbolRefExpr to get the symbol.
const MCExpr *Expr = Operand.getExpr();
const MCSymbolRefExpr *SymExpr = static_cast<const MCSymbolRefExpr *>(Expr);
- assert(SymExpr->getKind() == MCSymbolRefExpr::VK_PPC_PCREL_OPT &&
- "Expecting a symbol of type VK_PPC_PCREL_OPT");
+ assert(getSpecifier(SymExpr) == PPC::S_PCREL_OPT &&
+ "Expecting a symbol of type VK_PCREL_OPT");
MCSymbol *LabelSym =
getContext().getOrCreateSymbol(SymExpr->getSymbol().getName());
emitLabel(LabelSym, Inst.getLoc());
@@ -189,7 +188,7 @@ void PPCELFStreamer::emitGOTToPCRelLabel(const MCInst &Inst) {
// The above is a pair of such instructions and this function will not return
// std::nullopt for either one of them. In both cases we are looking for the
// last operand <MCOperand Expr:(.Lpcrel@<<invalid>>)> which needs to be an
-// MCExpr and has the flag MCSymbolRefExpr::VK_PPC_PCREL_OPT. After that we just
+// MCExpr and has the flag PPC::S_PCREL_OPT. After that we just
// look at the opcode and in the case of PLDpc we will return true. For the load
// (or store) this function will return false indicating it has found the second
// instruciton in the pair.
@@ -201,26 +200,27 @@ std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,
unsigned LastOp = Inst.getNumOperands() - 1;
// The last operand needs to be an MCExpr and it needs to have a variant kind
- // of VK_PPC_PCREL_OPT. If it does not satisfy these conditions it is not a
+ // of VK_PCREL_OPT. If it does not satisfy these conditions it is not a
// link time GOT PC Rel opt instruction and we can ignore it and return
// std::nullopt.
const MCOperand &Operand = Inst.getOperand(LastOp);
if (!Operand.isExpr())
return std::nullopt;
- // Check for the variant kind VK_PPC_PCREL_OPT in this expression.
+ // Check for the variant kind VK_PCREL_OPT in this expression.
const MCExpr *Expr = Operand.getExpr();
const MCSymbolRefExpr *SymExpr = static_cast<const MCSymbolRefExpr *>(Expr);
- if (!SymExpr || SymExpr->getKind() != MCSymbolRefExpr::VK_PPC_PCREL_OPT)
+ if (!SymExpr || getSpecifier(SymExpr) != PPC::S_PCREL_OPT)
return std::nullopt;
return (Inst.getOpcode() == PPC::PLDpc);
}
-MCELFStreamer *llvm::createPPCELFStreamer(
- MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
- std::unique_ptr<MCObjectWriter> OW,
- std::unique_ptr<MCCodeEmitter> Emitter) {
- return new PPCELFStreamer(Context, std::move(MAB), std::move(OW),
+MCStreamer *
+llvm::createPPCELFStreamer(const Triple &T, MCContext &C,
+ std::unique_ptr<MCAsmBackend> &&MAB,
+ std::unique_ptr<MCObjectWriter> &&OW,
+ std::unique_ptr<MCCodeEmitter> &&Emitter) {
+ return new PPCELFStreamer(C, std::move(MAB), std::move(OW),
std::move(Emitter));
}