aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-04 18:52:31 +0000
committerChris Lattner <sabre@nondot.org>2010-04-04 18:52:31 +0000
commit3f53c8398d81065736a784469c9dd5afff85673f (patch)
treeadd905ddbb890be4a136082f1d3c78cf86cf7a1e /lib/CodeGen/AsmPrinter
parent65eeaad91d78b2a677ca889eaff60f6d807c7030 (diff)
clean up the asmprinter header and privatize some stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp34
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp22
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfPrinter.cpp8
3 files changed, 32 insertions, 32 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 33f4efcea2..eb937ec0cd 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -62,7 +62,7 @@ AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
OutContext(Streamer.getContext()),
OutStreamer(Streamer),
LastMI(0), LastFn(0), Counter(~0U), SetCounter(0) {
- DW = 0; MMI = 0;
+ DW = 0; MMI = 0; LI = 0;
GCMetadataPrinters = 0;
VerboseAsm = Streamer.isVerboseAsm();
}
@@ -101,7 +101,7 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
MachineFunctionPass::getAnalysisUsage(AU);
AU.addRequired<MachineModuleInfo>();
AU.addRequired<GCModuleInfo>();
- if (VerboseAsm)
+ if (isVerbose())
AU.addRequired<MachineLoopInfo>();
}
@@ -218,7 +218,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
if (GVKind.isCommon() || GVKind.isBSSLocal()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (VerboseAsm) {
+ if (isVerbose()) {
WriteAsOperand(OutStreamer.GetCommentOS(), GV,
/*PrintType=*/false, GV->getParent());
OutStreamer.GetCommentOS() << '\n';
@@ -271,7 +271,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
EmitLinkage(GV->getLinkage(), GVSym);
EmitAlignment(AlignLog, GV);
- if (VerboseAsm) {
+ if (isVerbose()) {
WriteAsOperand(OutStreamer.GetCommentOS(), GV,
/*PrintType=*/false, GV->getParent());
OutStreamer.GetCommentOS() << '\n';
@@ -305,7 +305,7 @@ void AsmPrinter::EmitFunctionHeader() {
if (MAI->hasDotTypeDotSizeDirective())
OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
- if (VerboseAsm) {
+ if (isVerbose()) {
WriteAsOperand(OutStreamer.GetCommentOS(), F,
/*PrintType=*/false, F->getParent());
OutStreamer.GetCommentOS() << '\n';
@@ -429,7 +429,7 @@ void AsmPrinter::EmitFunctionBody() {
if (ShouldPrintDebugScopes)
DW->BeginScope(II);
- if (VerboseAsm)
+ if (isVerbose())
EmitComments(*II, OutStreamer.GetCommentOS());
switch (II->getOpcode()) {
@@ -575,7 +575,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
// Get the function symbol.
CurrentFnSym = Mang->getSymbol(MF.getFunction());
- if (VerboseAsm)
+ if (isVerbose())
LI = &getAnalysis<MachineLoopInfo>();
}
@@ -663,7 +663,7 @@ void AsmPrinter::EmitConstantPool() {
Offset = NewOffset + TM.getTargetData()->getTypeAllocSize(Ty);
// Emit the label with a comment on it.
- if (VerboseAsm) {
+ if (isVerbose()) {
OutStreamer.GetCommentOS() << "constant pool ";
WriteTypeSymbolic(OutStreamer.GetCommentOS(), CPE.getType(),
MF->getFunction()->getParent());
@@ -1177,7 +1177,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
// FP Constants are printed as integer constants to avoid losing
// precision.
if (CFP->getType()->isDoubleTy()) {
- if (AP.VerboseAsm) {
+ if (AP.isVerbose()) {
double Val = CFP->getValueAPF().convertToDouble();
AP.OutStreamer.GetCommentOS() << "double " << Val << '\n';
}
@@ -1188,7 +1188,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
}
if (CFP->getType()->isFloatTy()) {
- if (AP.VerboseAsm) {
+ if (AP.isVerbose()) {
float Val = CFP->getValueAPF().convertToFloat();
AP.OutStreamer.GetCommentOS() << "float " << Val << '\n';
}
@@ -1202,7 +1202,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
// api needed to prevent premature destruction
APInt API = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = API.getRawData();
- if (AP.VerboseAsm) {
+ if (AP.isVerbose()) {
// Convert to double so we can print the approximate val as a comment.
APFloat DoubleVal = CFP->getValueAPF();
bool ignored;
@@ -1273,7 +1273,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
case 2:
case 4:
case 8:
- if (VerboseAsm)
+ if (isVerbose())
OutStreamer.GetCommentOS() << format("0x%llx\n", CI->getZExtValue());
OutStreamer.EmitIntValue(CI->getZExtValue(), Size, AddrSpace);
return;
@@ -1327,7 +1327,7 @@ void AsmPrinter::printOffset(int64_t Offset, raw_ostream &OS) const {
/// EmitImplicitDef - This method emits the specified machine instruction
/// that is an implicit def.
void AsmPrinter::EmitImplicitDef(const MachineInstr *MI) const {
- if (!VerboseAsm) return;
+ if (!isVerbose()) return;
unsigned RegNo = MI->getOperand(0).getReg();
OutStreamer.AddComment(Twine("implicit-def: ") +
TM.getRegisterInfo()->getName(RegNo));
@@ -1335,7 +1335,7 @@ void AsmPrinter::EmitImplicitDef(const MachineInstr *MI) const {
}
void AsmPrinter::EmitKill(const MachineInstr *MI) const {
- if (!VerboseAsm) return;
+ if (!isVerbose()) return;
std::string Str = "kill:";
for (unsigned n = 0, e = MI->getNumOperands(); n != e; ++n) {
@@ -1478,7 +1478,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
// the references were generated.
if (MBB->hasAddressTaken()) {
const BasicBlock *BB = MBB->getBasicBlock();
- if (VerboseAsm)
+ if (isVerbose())
OutStreamer.AddComment("Block address taken");
std::vector<MCSymbol*> Syms = MMI->getAddrLabelSymbolToEmit(BB);
@@ -1489,7 +1489,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
// Print the main label for the block.
if (MBB->pred_empty() || isBlockOnlyReachableByFallthrough(MBB)) {
- if (VerboseAsm && OutStreamer.hasRawTextSupport()) {
+ if (isVerbose() && OutStreamer.hasRawTextSupport()) {
if (const BasicBlock *BB = MBB->getBasicBlock())
if (BB->hasName())
OutStreamer.AddComment("%" + BB->getName());
@@ -1501,7 +1501,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
Twine(MBB->getNumber()) + ":");
}
} else {
- if (VerboseAsm) {
+ if (isVerbose()) {
if (const BasicBlock *BB = MBB->getBasicBlock())
if (BB->hasName())
OutStreamer.AddComment("%" + BB->getName());
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 6d6071a3b5..a0ee874bf4 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2491,7 +2491,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
const DIEAbbrev *Abbrev = Abbreviations[AbbrevNumber - 1];
// Emit the code (index) for the abbreviation.
- if (Asm->VerboseAsm)
+ if (Asm->isVerbose())
Asm->OutStreamer.AddComment("Abbrev [" + Twine(AbbrevNumber) + "] 0x" +
Twine::utohexstr(Die->getOffset()) + ":0x" +
Twine::utohexstr(Die->getSize()) + " " +
@@ -2507,7 +2507,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
unsigned Form = AbbrevData[i].getForm();
assert(Form && "Too many attributes for DIE (check abbreviation)");
- if (Asm->VerboseAsm)
+ if (Asm->isVerbose())
Asm->OutStreamer.AddComment(dwarf::AttributeString(Attr));
switch (Attr) {
@@ -2535,7 +2535,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
for (unsigned j = 0, M = Children.size(); j < M; ++j)
emitDIE(Children[j]);
- if (Asm->VerboseAsm)
+ if (Asm->isVerbose())
Asm->OutStreamer.AddComment("End Of Children Mark");
Asm->EmitInt8(0);
}
@@ -2698,7 +2698,7 @@ void DwarfDebug::emitDebugLines() {
// Emit directories.
for (unsigned DI = 1, DE = getNumSourceDirectories()+1; DI != DE; ++DI) {
const std::string &Dir = getSourceDirectoryName(DI);
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("Directory");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("Directory");
Asm->OutStreamer.EmitBytes(StringRef(Dir.c_str(), Dir.size()+1), 0);
}
@@ -2710,7 +2710,7 @@ void DwarfDebug::emitDebugLines() {
// Remember source id starts at 1.
std::pair<unsigned, unsigned> Id = getSourceDirectoryAndFileIds(SI);
const std::string &FN = getSourceFileName(Id.second);
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("Source");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("Source");
Asm->OutStreamer.EmitBytes(StringRef(FN.c_str(), FN.size()+1), 0);
EmitULEB128(Id.first, "Directory #");
@@ -2927,7 +2927,7 @@ void DwarfDebug::emitDebugPubNames() {
Asm->OutStreamer.AddComment("DIE offset");
Asm->EmitInt32(Entity->getOffset());
- if (Asm->VerboseAsm)
+ if (Asm->isVerbose())
Asm->OutStreamer.AddComment("External Name");
Asm->OutStreamer.EmitBytes(StringRef(Name, strlen(Name)+1), 0);
}
@@ -2947,7 +2947,7 @@ void DwarfDebug::emitDebugPubTypes() {
Asm->OutStreamer.EmitLabel(getDWLabel("pubtypes_begin", ModuleCU->getID()));
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DWARF Version");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DWARF Version");
Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset of Compilation ModuleCU Info");
@@ -2965,10 +2965,10 @@ void DwarfDebug::emitDebugPubTypes() {
const char *Name = GI->getKeyData();
DIE * Entity = GI->second;
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DIE offset");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DIE offset");
Asm->EmitInt32(Entity->getOffset());
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("External Name");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("External Name");
Asm->OutStreamer.EmitBytes(StringRef(Name, GI->getKeyLength()+1), 0);
}
@@ -3106,10 +3106,10 @@ void DwarfDebug::emitDebugInlineInfo() {
for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
LE = Labels.end(); LI != LE; ++LI) {
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DIE offset");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DIE offset");
Asm->EmitInt32(LI->second->getOffset());
- if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("low_pc");
+ if (Asm->isVerbose()) Asm->OutStreamer.AddComment("low_pc");
Asm->OutStreamer.EmitSymbolValue(LI->first, TD->getPointerSize(), 0);
}
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 2ae7d476b6..267c41faf0 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -109,7 +109,7 @@ static const char *DecodeDWARFEncoding(unsigned Encoding) {
/// describing the encoding. Desc is an optional string saying what the
/// encoding is specifying (e.g. "LSDA").
void DwarfPrinter::EmitEncodingByte(unsigned Val, const char *Desc) {
- if (Asm->VerboseAsm) {
+ if (Asm->isVerbose()) {
if (Desc != 0)
Asm->OutStreamer.AddComment(Twine(Desc)+" Encoding = " +
Twine(DecodeDWARFEncoding(Val)));
@@ -123,7 +123,7 @@ void DwarfPrinter::EmitEncodingByte(unsigned Val, const char *Desc) {
/// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
void DwarfPrinter::EmitCFAByte(unsigned Val) {
- if (Asm->VerboseAsm) {
+ if (Asm->isVerbose()) {
if (Val >= dwarf::DW_CFA_offset && Val < dwarf::DW_CFA_offset+64)
Asm->OutStreamer.AddComment("DW_CFA_offset + Reg (" +
Twine(Val-dwarf::DW_CFA_offset) + ")");
@@ -135,7 +135,7 @@ void DwarfPrinter::EmitCFAByte(unsigned Val) {
/// EmitSLEB128 - emit the specified signed leb128 value.
void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
- if (Asm->VerboseAsm && Desc)
+ if (Asm->isVerbose() && Desc)
Asm->OutStreamer.AddComment(Desc);
if (MAI->hasLEB128()) {
@@ -160,7 +160,7 @@ void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
/// EmitULEB128 - emit the specified signed leb128 value.
void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc,
unsigned PadTo) const {
- if (Asm->VerboseAsm && Desc)
+ if (Asm->isVerbose() && Desc)
Asm->OutStreamer.AddComment(Desc);
if (MAI->hasLEB128() && PadTo == 0) {