Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3651)

Unified Diff: llvm/lib/Target/Mips/MipsAsmPrinter.cpp

Issue 8273005: [MIPS] Initial support for MIPS architecture. (Closed)
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « llvm/lib/Target/Mips/MipsAsmPrinter.h ('k') | llvm/lib/Target/Mips/MipsInstrInfo.td » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: llvm/lib/Target/Mips/MipsAsmPrinter.cpp
===================================================================
old mode 100644
new mode 100755
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -211,6 +211,17 @@ const char *MipsAsmPrinter::getCurrentAB
}
void MipsAsmPrinter::EmitFunctionEntryLabel() {
+ // @LOCALMOD-START
+ // make sure function entry is aligned. We use XmagicX as our basis
+ // for alignment decisions (c.f. assembler sfi macros).
+ int alignment = MF->getAlignment();
+ if (alignment < 4) alignment = 4;
+ EmitAlignment(alignment);
+ if (Subtarget->isTargetNaCl() && OutStreamer.hasRawTextSupport()) {
+ OutStreamer.EmitRawText(StringRef("\t.set XmagicX, .\n"));
+ }
+ // @LOCALMOD-END
+
OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
OutStreamer.EmitLabel(CurrentFnSym);
}
@@ -414,6 +425,10 @@ printFCCOperand(const MachineInstr *MI,
O << Mips::MipsFCCToString((Mips::CondCode)MO.getImm());
}
+// @LOCALMOD-START
+extern void EmitMipsSFIHeaders(raw_ostream &O);
+// @LOCALMOD-END
+
void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
// FIXME: Use SwitchSection.
@@ -430,7 +445,35 @@ void MipsAsmPrinter::EmitStartOfAsmFile(
// return to previous section
OutStreamer.EmitRawText(StringRef("\t.previous"));
+
+ // @LOCALMOD-START
+ if (Subtarget->isTargetNaCl() && OutStreamer.hasRawTextSupport()) {
+ std::string str;
+ raw_string_ostream OS(str);
+ EmitMipsSFIHeaders(OS);
+ OutStreamer.EmitRawText(StringRef(OS.str()));
+ }
+ // @LOCALMOD-END
}
+
+// @LOCALMOD-START
+unsigned MipsAsmPrinter::GetTargetLabelAlign(const MachineInstr *MI) const {
+ if (Subtarget->isTargetNaCl()) {
+ switch (MI->getOpcode()) {
+ default: return 0;
+ // These labels may indicate an indirect entry point that is
+ // externally reachable and hence must be bundle aligned.
+ // Note: these labels appear to be always at basic block beginnings
+ // so it may be possible to simply set the MBB alignment.
+ // However, it is unclear whether this always holds.
+ case TargetOpcode::EH_LABEL:
+ case TargetOpcode::GC_LABEL:
+ return 4;
+ }
+ }
+ return 0;
+}
+// @LOCALMOD-END
MachineLocation
MipsAsmPrinter::getDebugValueLocation(const MachineInstr *MI) const {
« no previous file with comments | « llvm/lib/Target/Mips/MipsAsmPrinter.h ('k') | llvm/lib/Target/Mips/MipsInstrInfo.td » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698