mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
MC: Add target hook to control symbol quoting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -445,6 +445,6 @@ void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
}
|
||||
|
||||
assert(Op.isExpr() && "unknown operand kind in printOperand");
|
||||
O << *Op.getExpr();
|
||||
Op.getExpr()->print(O, &MAI);
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ PPCMCExpr::create(VariantKind Kind, const MCExpr *Expr,
|
||||
return new (Ctx) PPCMCExpr(Kind, Expr, isDarwin);
|
||||
}
|
||||
|
||||
void PPCMCExpr::printImpl(raw_ostream &OS) const {
|
||||
void PPCMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
||||
if (isDarwinSyntax()) {
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
@@ -34,10 +34,10 @@ void PPCMCExpr::printImpl(raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
OS << '(';
|
||||
getSubExpr()->print(OS);
|
||||
getSubExpr()->print(OS, MAI);
|
||||
OS << ')';
|
||||
} else {
|
||||
getSubExpr()->print(OS);
|
||||
getSubExpr()->print(OS, MAI);
|
||||
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
|
@@ -77,7 +77,7 @@ public:
|
||||
|
||||
/// @}
|
||||
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "PPCMCAsmInfo.h"
|
||||
#include "PPCTargetStreamer.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCELFStreamer.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
@@ -132,7 +133,13 @@ public:
|
||||
OS << "\t.abiversion " << AbiVersion << '\n';
|
||||
}
|
||||
void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset) override {
|
||||
OS << "\t.localentry\t" << *S << ", " << *LocalOffset << '\n';
|
||||
const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
|
||||
|
||||
OS << "\t.localentry\t";
|
||||
S->print(OS, MAI);
|
||||
OS << ", ";
|
||||
LocalOffset->print(OS, MAI);
|
||||
OS << '\n';
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -181,14 +181,14 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
return;
|
||||
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
O << *MO.getMBB()->getSymbol();
|
||||
MO.getMBB()->getSymbol()->print(O, MAI);
|
||||
return;
|
||||
case MachineOperand::MO_ConstantPoolIndex:
|
||||
O << DL->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber()
|
||||
<< '_' << MO.getIndex();
|
||||
return;
|
||||
case MachineOperand::MO_BlockAddress:
|
||||
O << *GetBlockAddressSymbol(MO.getBlockAddress());
|
||||
GetBlockAddressSymbol(MO.getBlockAddress())->print(O, MAI);
|
||||
return;
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
// Computing the address of a global symbol, not calling it.
|
||||
@@ -222,8 +222,8 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
} else {
|
||||
SymToPrint = getSymbol(GV);
|
||||
}
|
||||
|
||||
O << *SymToPrint;
|
||||
|
||||
SymToPrint->print(O, MAI);
|
||||
|
||||
printOffset(MO.getOffset(), O);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user