OLD | NEW |
1 //===-- MipsAsmPrinter.cpp - Mips LLVM Assembly Printer -------------------===// | 1 //===-- MipsAsmPrinter.cpp - Mips LLVM Assembly Printer -------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file contains a printer that converts from our internal representation | 10 // This file contains a printer that converts from our internal representation |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "llvm/IR/BasicBlock.h" | 32 #include "llvm/IR/BasicBlock.h" |
33 #include "llvm/IR/DataLayout.h" | 33 #include "llvm/IR/DataLayout.h" |
34 #include "llvm/IR/InlineAsm.h" | 34 #include "llvm/IR/InlineAsm.h" |
35 #include "llvm/IR/Instructions.h" | 35 #include "llvm/IR/Instructions.h" |
36 #include "llvm/IR/Mangler.h" | 36 #include "llvm/IR/Mangler.h" |
37 #include "llvm/MC/MCAsmInfo.h" | 37 #include "llvm/MC/MCAsmInfo.h" |
38 #include "llvm/MC/MCContext.h" | 38 #include "llvm/MC/MCContext.h" |
39 #include "llvm/MC/MCELFStreamer.h" | 39 #include "llvm/MC/MCELFStreamer.h" |
40 #include "llvm/MC/MCExpr.h" | 40 #include "llvm/MC/MCExpr.h" |
41 #include "llvm/MC/MCInst.h" | 41 #include "llvm/MC/MCInst.h" |
| 42 #include "llvm/MC/MCNaCl.h" |
42 #include "llvm/MC/MCSection.h" | 43 #include "llvm/MC/MCSection.h" |
43 #include "llvm/MC/MCSectionELF.h" | 44 #include "llvm/MC/MCSectionELF.h" |
44 #include "llvm/MC/MCSymbol.h" | 45 #include "llvm/MC/MCSymbol.h" |
45 #include "llvm/Support/ELF.h" | 46 #include "llvm/Support/ELF.h" |
46 #include "llvm/Support/TargetRegistry.h" | 47 #include "llvm/Support/TargetRegistry.h" |
47 #include "llvm/Support/raw_ostream.h" | 48 #include "llvm/Support/raw_ostream.h" |
48 #include "llvm/Target/TargetLoweringObjectFile.h" | 49 #include "llvm/Target/TargetLoweringObjectFile.h" |
49 #include "llvm/Target/TargetOptions.h" | 50 #include "llvm/Target/TargetOptions.h" |
50 #include <string> | 51 #include <string> |
51 | 52 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 Subtarget->isFP64bit())) | 735 Subtarget->isFP64bit())) |
735 getTargetStreamer().emitDirectiveModuleFP(); | 736 getTargetStreamer().emitDirectiveModuleFP(); |
736 | 737 |
737 // We should always emit a '.module [no]oddspreg' but binutils 2.24 does not | 738 // We should always emit a '.module [no]oddspreg' but binutils 2.24 does not |
738 // accept it. We therefore emit it when it contradicts the default or an | 739 // accept it. We therefore emit it when it contradicts the default or an |
739 // option has changed the default (i.e. FPXX) and omit it otherwise. | 740 // option has changed the default (i.e. FPXX) and omit it otherwise. |
740 if (Subtarget->isABI_O32() && (!Subtarget->useOddSPReg() || | 741 if (Subtarget->isABI_O32() && (!Subtarget->useOddSPReg() || |
741 Subtarget->isABI_FPXX())) | 742 Subtarget->isABI_FPXX())) |
742 getTargetStreamer().emitDirectiveModuleOddSPReg(Subtarget->useOddSPReg(), | 743 getTargetStreamer().emitDirectiveModuleOddSPReg(Subtarget->useOddSPReg(), |
743 Subtarget->isABI_O32()); | 744 Subtarget->isABI_O32()); |
| 745 |
| 746 // @LOCALMOD-START |
| 747 if (Subtarget->isTargetNaCl()) { |
| 748 initializeNaClMCStreamer(OutStreamer, OutContext, |
| 749 Triple(Subtarget->getTargetTriple())); |
| 750 } |
| 751 // @LOCALMOD-END |
744 } | 752 } |
745 | 753 |
| 754 // @LOCALMOD-START |
| 755 unsigned MipsAsmPrinter::GetTargetLabelAlign(const MachineInstr *MI) const { |
| 756 if (Subtarget->isTargetNaCl()) { |
| 757 switch (MI->getOpcode()) { |
| 758 default: return 0; |
| 759 // These labels may indicate an indirect entry point that is |
| 760 // externally reachable and hence must be bundle aligned. |
| 761 // Note: these labels appear to be always at basic block beginnings |
| 762 // so it may be possible to simply set the MBB alignment. |
| 763 // However, it is unclear whether this always holds. |
| 764 case TargetOpcode::EH_LABEL: |
| 765 case TargetOpcode::GC_LABEL: |
| 766 return 4; |
| 767 } |
| 768 } |
| 769 return 0; |
| 770 } |
| 771 // @LOCALMOD-END |
| 772 |
746 void MipsAsmPrinter::EmitJal(MCSymbol *Symbol) { | 773 void MipsAsmPrinter::EmitJal(MCSymbol *Symbol) { |
747 MCInst I; | 774 MCInst I; |
748 I.setOpcode(Mips::JAL); | 775 I.setOpcode(Mips::JAL); |
749 I.addOperand( | 776 I.addOperand( |
750 MCOperand::CreateExpr(MCSymbolRefExpr::Create(Symbol, OutContext))); | 777 MCOperand::CreateExpr(MCSymbolRefExpr::Create(Symbol, OutContext))); |
751 OutStreamer.EmitInstruction(I, getSubtargetInfo()); | 778 OutStreamer.EmitInstruction(I, getSubtargetInfo()); |
752 } | 779 } |
753 | 780 |
754 void MipsAsmPrinter::EmitInstrReg(unsigned Opcode, unsigned Reg) { | 781 void MipsAsmPrinter::EmitInstrReg(unsigned Opcode, unsigned Reg) { |
755 MCInst I; | 782 MCInst I; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 || Opcode == Mips::LONG_BRANCH_DADDiu); | 1072 || Opcode == Mips::LONG_BRANCH_DADDiu); |
1046 } | 1073 } |
1047 | 1074 |
1048 // Force static initialization. | 1075 // Force static initialization. |
1049 extern "C" void LLVMInitializeMipsAsmPrinter() { | 1076 extern "C" void LLVMInitializeMipsAsmPrinter() { |
1050 RegisterAsmPrinter<MipsAsmPrinter> X(TheMipsTarget); | 1077 RegisterAsmPrinter<MipsAsmPrinter> X(TheMipsTarget); |
1051 RegisterAsmPrinter<MipsAsmPrinter> Y(TheMipselTarget); | 1078 RegisterAsmPrinter<MipsAsmPrinter> Y(TheMipselTarget); |
1052 RegisterAsmPrinter<MipsAsmPrinter> A(TheMips64Target); | 1079 RegisterAsmPrinter<MipsAsmPrinter> A(TheMips64Target); |
1053 RegisterAsmPrinter<MipsAsmPrinter> B(TheMips64elTarget); | 1080 RegisterAsmPrinter<MipsAsmPrinter> B(TheMips64elTarget); |
1054 } | 1081 } |
OLD | NEW |