llvm.org GIT mirror llvm / acc381b
Refactor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129938 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 9 years ago
3 changed file(s) with 38 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
382382 /// encoding specified.
383383 virtual unsigned getISAEncoding() { return 0; }
384384
385 /// EmitDwarfRegOp - Emit dwarf register operation.
386 virtual void EmitDwarfRegOp(const MachineLocation &MLoc) const;
387
385388 //===------------------------------------------------------------------===//
386389 // Dwarf Lowering Routines
387390 //===------------------------------------------------------------------===//
751751 return MachineLocation();
752752 }
753753
754 /// EmitDwarfRegOp - Emit dwarf register operation.
755 void AsmPrinter::EmitDwarfRegOp(const MachineLocation &MLoc) const {
756 const TargetRegisterInfo *RI = TM.getRegisterInfo();
757 unsigned Reg = RI->getDwarfRegNum(MLoc.getReg(), false);
758 if (int Offset = MLoc.getOffset()) {
759 // If the value is at a certain offset from frame register then
760 // use DW_OP_fbreg.
761 unsigned OffsetSize = Offset ? MCAsmInfo::getSLEB128Size(Offset) : 1;
762 OutStreamer.AddComment("Loc expr size");
763 EmitInt16(1 + OffsetSize);
764 OutStreamer.AddComment(
765 dwarf::OperationEncodingString(dwarf::DW_OP_fbreg));
766 EmitInt8(dwarf::DW_OP_fbreg);
767 OutStreamer.AddComment("Offset");
768 EmitSLEB128(Offset);
769 } else {
770 if (Reg < 32) {
771 OutStreamer.AddComment("Loc expr size");
772 EmitInt16(1);
773 OutStreamer.AddComment(
774 dwarf::OperationEncodingString(dwarf::DW_OP_reg0 + Reg));
775 EmitInt8(dwarf::DW_OP_reg0 + Reg);
776 } else {
777 OutStreamer.AddComment("Loc expr size");
778 EmitInt16(1 + MCAsmInfo::getULEB128Size(Reg));
779 OutStreamer.AddComment(
780 dwarf::OperationEncodingString(dwarf::DW_OP_regx));
781 EmitInt8(dwarf::DW_OP_regx);
782 OutStreamer.AddComment(Twine(Reg));
783 EmitULEB128(Reg);
784 }
785 }
786 }
787
754788 bool AsmPrinter::doFinalization(Module &M) {
755789 // Emit global variables.
756790 for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
26912691 } else {
26922692 Asm->OutStreamer.EmitSymbolValue(Entry.Begin, Size, 0);
26932693 Asm->OutStreamer.EmitSymbolValue(Entry.End, Size, 0);
2694 const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
2695 unsigned Reg = RI->getDwarfRegNum(Entry.Loc.getReg(), false);
2696 if (int Offset = Entry.Loc.getOffset()) {
2697 // If the value is at a certain offset from frame register then
2698 // use DW_OP_fbreg.
2699 unsigned OffsetSize = Offset ? MCAsmInfo::getSLEB128Size(Offset) : 1;
2700 Asm->OutStreamer.AddComment("Loc expr size");
2701 Asm->EmitInt16(1 + OffsetSize);
2702 Asm->OutStreamer.AddComment(
2703 dwarf::OperationEncodingString(dwarf::DW_OP_fbreg));
2704 Asm->EmitInt8(dwarf::DW_OP_fbreg);
2705 Asm->OutStreamer.AddComment("Offset");
2706 Asm->EmitSLEB128(Offset);
2707 } else {
2708 if (Reg < 32) {
2709 Asm->OutStreamer.AddComment("Loc expr size");
2710 Asm->EmitInt16(1);
2711 Asm->OutStreamer.AddComment(
2712 dwarf::OperationEncodingString(dwarf::DW_OP_reg0 + Reg));
2713 Asm->EmitInt8(dwarf::DW_OP_reg0 + Reg);
2714 } else {
2715 Asm->OutStreamer.AddComment("Loc expr size");
2716 Asm->EmitInt16(1 + MCAsmInfo::getULEB128Size(Reg));
2717 Asm->OutStreamer.AddComment(
2718 dwarf::OperationEncodingString(dwarf::DW_OP_regx));
2719 Asm->EmitInt8(dwarf::DW_OP_regx);
2720 Asm->OutStreamer.AddComment(Twine(Reg));
2721 Asm->EmitULEB128(Reg);
2722 }
2723 }
2694 Asm->EmitDwarfRegOp(Entry.Loc);
27242695 }
27252696 }
27262697 }