[llvm-commits] [llvm] r100348 - in /llvm/trunk/lib/CodeGen/AsmPrinter: AsmPrinterDwarf.cpp DwarfPrinter.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 4 13:01:25 PDT 2010
Author: lattner
Date: Sun Apr 4 15:01:25 2010
New Revision: 100348
URL: http://llvm.org/viewvc/llvm-project?rev=100348&view=rev
Log:
move EmitCFAByte to AsmPrinter.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=100348&r1=100347&r2=100348&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Sun Apr 4 15:01:25 2010
@@ -16,6 +16,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Dwarf.h"
using namespace llvm;
/// EmitSLEB128 - emit the specified signed leb128 value.
@@ -69,3 +70,15 @@
}
}
+/// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
+void AsmPrinter::EmitCFAByte(unsigned Val) const {
+ if (isVerbose()) {
+ if (Val >= dwarf::DW_CFA_offset && Val < dwarf::DW_CFA_offset+64)
+ OutStreamer.AddComment("DW_CFA_offset + Reg (" +
+ Twine(Val-dwarf::DW_CFA_offset) + ")");
+ else
+ OutStreamer.AddComment(dwarf::CallFrameString(Val));
+ }
+ OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
+}
+
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=100348&r1=100347&r2=100348&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Sun Apr 4 15:01:25 2010
@@ -100,18 +100,6 @@
Asm->OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
}
-/// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
-void DwarfPrinter::EmitCFAByte(unsigned Val) {
- 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) + ")");
- else
- Asm->OutStreamer.AddComment(dwarf::CallFrameString(Val));
- }
- Asm->OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
-}
-
void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
@@ -176,7 +164,7 @@
if (BaseLabel && Label) {
MCSymbol *ThisSym = Label;
if (ThisSym != BaseLabel) {
- EmitCFAByte(dwarf::DW_CFA_advance_loc4);
+ Asm->EmitCFAByte(dwarf::DW_CFA_advance_loc4);
Asm->EmitLabelDifference(ThisSym, BaseLabel, 4);
BaseLabel = ThisSym;
}
@@ -186,9 +174,9 @@
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
if (!Src.isReg()) {
if (Src.getReg() == MachineLocation::VirtualFP) {
- EmitCFAByte(dwarf::DW_CFA_def_cfa_offset);
+ Asm->EmitCFAByte(dwarf::DW_CFA_def_cfa_offset);
} else {
- EmitCFAByte(dwarf::DW_CFA_def_cfa);
+ Asm->EmitCFAByte(dwarf::DW_CFA_def_cfa);
Asm->EmitULEB128(RI->getDwarfRegNum(Src.getReg(), isEH), "Register");
}
@@ -200,7 +188,7 @@
} else if (Src.isReg() &&
Src.getReg() == MachineLocation::VirtualFP) {
if (Dst.isReg()) {
- EmitCFAByte(dwarf::DW_CFA_def_cfa_register);
+ Asm->EmitCFAByte(dwarf::DW_CFA_def_cfa_register);
Asm->EmitULEB128(RI->getDwarfRegNum(Dst.getReg(), isEH), "Register");
} else {
llvm_unreachable("Machine move not supported yet.");
@@ -210,14 +198,14 @@
int Offset = Dst.getOffset() / stackGrowth;
if (Offset < 0) {
- EmitCFAByte(dwarf::DW_CFA_offset_extended_sf);
+ Asm->EmitCFAByte(dwarf::DW_CFA_offset_extended_sf);
Asm->EmitULEB128(Reg, "Reg");
Asm->EmitSLEB128(Offset, "Offset");
} else if (Reg < 64) {
- EmitCFAByte(dwarf::DW_CFA_offset + Reg);
+ Asm->EmitCFAByte(dwarf::DW_CFA_offset + Reg);
Asm->EmitULEB128(Offset, "Offset");
} else {
- EmitCFAByte(dwarf::DW_CFA_offset_extended);
+ Asm->EmitCFAByte(dwarf::DW_CFA_offset_extended);
Asm->EmitULEB128(Reg, "Reg");
Asm->EmitULEB128(Offset, "Offset");
}
More information about the llvm-commits
mailing list