#include "llvm/Support/DataTypes.h"
namespace llvm {
+class MCAsmInfo;
class MCContext;
class MCSymbol;
class MCValue;
/// @name Utility Methods
/// @{
- void print(raw_ostream &OS) const;
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
void dump() const;
/// @}
namespace llvm {
class raw_ostream;
+class MCAsmInfo;
class MCExpr;
/// MCOperand - Instances of this class represent operands of the MCInst class.
return Op;
}
- void print(raw_ostream &OS) const;
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
void dump() const;
};
Operands.push_back(Op);
}
- void print(raw_ostream &OS) const;
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
void dump() const;
};
#include "llvm/Support/DataTypes.h"
namespace llvm {
+ class MCAsmInfo;
class MCSection;
class MCContext;
class raw_ostream;
/// @}
/// print - Print the value to the stream \arg OS.
- void print(raw_ostream &OS) const;
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
/// dump - Print the value to stderr.
void dump() const;
const MCSection *getAssociatedSection() const;
/// print - Print the value to the stream \arg OS.
- void print(raw_ostream &OS) const;
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
/// dump - Print the value to stderr.
void dump() const;
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
assert(CurSection && "Cannot emit before setting section!");
- OS << Symbol << ":\n";
+ Symbol->print(OS, &MAI);
+ OS << ":\n";
Symbol->setSection(*CurSection);
}
assert((Symbol->isUndefined() || Symbol->isAbsolute()) &&
"Cannot define a symbol twice!");
- OS << Symbol << " = ";
- Value->print(OS);
+ Symbol->print(OS, &MAI);
+ OS << " = ";
+ Value->print(OS, &MAI);
OS << '\n';
}
case WeakReference: OS << ".weak_reference"; break;
}
- OS << ' ' << Symbol << '\n';
+ OS << ' ';
+ Symbol->print(OS, &MAI);
+ OS << '\n';
}
void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
- OS << ".desc" << ' ' << Symbol << ',' << DescValue << '\n';
+ OS << ".desc" << ' ';
+ Symbol->print(OS, &MAI);
+ OS << ',' << DescValue << '\n';
}
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
unsigned ByteAlignment) {
- OS << ".comm";
- OS << ' ' << Symbol << ',' << Size;
+ OS << ".comm ";
+ Symbol->print(OS, &MAI);
+ OS << ',' << Size;
if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment);
OS << '\n';
OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
if (Symbol != NULL) {
- OS << ',' << Symbol << ',' << Size;
+ OS << ',';
+ Symbol->print(OS, &MAI);
+ OS << ',' << Size;
if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment);
}
}
OS << ' ';
- truncateToSize(Value, Size)->print(OS);
+ truncateToSize(Value, Size)->print(OS, &MAI);
OS << '\n';
}
unsigned char Value) {
// FIXME: Verify that Offset is associated with the current section.
OS << ".org ";
- Offset->print(OS);
+ Offset->print(OS, &MAI);
OS << ", " << (unsigned) Value << '\n';
}
// Otherwise fall back to a structural printing for now. Eventually we should
// always have access to the target specific printer.
- Inst.print(OS);
+ Inst.print(OS, &MAI);
OS << '\n';
}
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-void MCExpr::print(raw_ostream &OS) const {
+void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
switch (getKind()) {
case MCExpr::Constant:
OS << cast<MCConstantExpr>(*this).getValue();
return;
case MCExpr::SymbolRef:
- cast<MCSymbolRefExpr>(*this).getSymbol().print(OS);
+ cast<MCSymbolRefExpr>(*this).getSymbol().print(OS, MAI);
return;
case MCExpr::Unary: {
case MCUnaryExpr::Not: OS << '~'; break;
case MCUnaryExpr::Plus: OS << '+'; break;
}
- UE.getSubExpr()->print(OS);
+ UE.getSubExpr()->print(OS, MAI);
return;
}
case MCExpr::Binary: {
const MCBinaryExpr &BE = cast<MCBinaryExpr>(*this);
OS << '(';
- BE.getLHS()->print(OS);
+ BE.getLHS()->print(OS, MAI);
OS << ' ';
switch (BE.getOpcode()) {
default: assert(0 && "Invalid opcode!");
case MCBinaryExpr::Xor: OS << '^'; break;
}
OS << ' ';
- BE.getRHS()->print(OS);
+ BE.getRHS()->print(OS, MAI);
OS << ')';
return;
}
}
void MCExpr::dump() const {
- print(errs());
+ print(errs(), 0);
errs() << '\n';
}
using namespace llvm;
-void MCOperand::print(raw_ostream &OS) const {
+void MCOperand::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << "<MCOperand ";
if (!isValid())
OS << "INVALID";
<< getMBBLabelBlock() << ")";
else if (isExpr()) {
OS << "Expr:(";
- getExpr()->print(OS);
+ getExpr()->print(OS, MAI);
OS << ")";
} else
OS << "UNDEFINED";
}
void MCOperand::dump() const {
- print(errs());
+ print(errs(), 0);
errs() << "\n";
}
-void MCInst::print(raw_ostream &OS) const {
+void MCInst::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << "<MCInst " << getOpcode();
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
OS << " ";
- getOperand(i).print(OS);
+ getOperand(i).print(OS, MAI);
}
OS << ">";
}
void MCInst::dump() const {
- print(errs());
+ print(errs(), 0);
errs() << "\n";
}
return false;
}
-void MCSymbol::print(raw_ostream &OS) const {
+void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
if (NeedsQuoting(getName()))
OS << '"' << getName() << '"';
else
}
void MCSymbol::dump() const {
- print(errs());
+ print(errs(), 0);
}
using namespace llvm;
-void MCValue::print(raw_ostream &OS) const {
+void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
if (isAbsolute()) {
OS << getConstant();
return;
}
- getSymA()->print(OS);
+ getSymA()->print(OS, MAI);
if (getSymB()) {
OS << " - ";
- getSymB()->print(OS);
+ getSymB()->print(OS, MAI);
}
if (getConstant())
}
void MCValue::dump() const {
- print(errs());
+ print(errs(), 0);
}
if (Op.isImm())
O << Op.getImm();
else if (Op.isExpr())
- Op.getExpr()->print(O);
+ Op.getExpr()->print(O, MAI);
else if (Op.isMBBLabel())
// FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel
// should eventually call into this code, not the other way around.
return;
} else if (Op.isExpr()) {
O << '$';
- Op.getExpr()->print(O);
+ Op.getExpr()->print(O, MAI);
return;
}
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
O << DispVal;
} else if (DispSpec.isExpr()) {
- DispSpec.getExpr()->print(O);
+ DispSpec.getExpr()->print(O, MAI);
} else {
llvm_unreachable("non-immediate displacement for LEA?");
//assert(DispSpec.isGlobal() || DispSpec.isCPI() ||