[PATCH] [mips][microMIPSr6] Implement mips32 to microMIPSr6 mapping support

Zoran Jovanovic zoran.jovanovic at imgtec.com
Fri Mar 27 06:25:57 PDT 2015


Hi dsanders, jkolek,

http://reviews.llvm.org/D8661

Files:
  lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
  lib/Target/Mips/MipsInstrFormats.td

Index: lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
@@ -180,17 +180,23 @@
       (Opcode != Mips::SLL_MM) && !Binary)
     llvm_unreachable("unimplemented opcode in EncodeInstruction()");
 
-  if (isMicroMips(STI) || isMicroMips32r6(STI)) {
-    int NewOpcode = isMicroMips(STI) ?
-                    Mips::Std2MicroMips(Opcode, Mips::Arch_micromips) :
-                    Mips::MipsR62MicroMipsR6(Opcode, Mips::Arch_micromipsr6);
-    if (NewOpcode != -1) {
-      if (Fixups.size() > N)
-        Fixups.pop_back();
-      Opcode = NewOpcode;
-      TmpInst.setOpcode (NewOpcode);
-      Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
-    }
+  int NewOpcode = -1;
+  if (isMicroMips(STI))
+    NewOpcode = Mips::Std2MicroMips(Opcode, Mips::Arch_micromips);
+
+  if (isMicroMips32r6(STI)) {
+    NewOpcode = Mips::MipsR62MicroMipsR6(Opcode, Mips::Arch_micromipsr6);
+    if (NewOpcode == -1)
+      NewOpcode = Mips::Std2MicroMipsR6(Opcode, Mips::Arch_micromipsr6);
+  }
+
+  if (NewOpcode != -1) {
+    if (Fixups.size() > N)
+      Fixups.pop_back();
+
+    Opcode = NewOpcode;
+    TmpInst.setOpcode (NewOpcode);
+    Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
   }
 
   const MCInstrDesc &Desc = MCII.get(TmpInst.getOpcode());
Index: lib/Target/Mips/MipsInstrFormats.td
===================================================================
--- lib/Target/Mips/MipsInstrFormats.td
+++ lib/Target/Mips/MipsInstrFormats.td
@@ -50,6 +50,20 @@
   let ValueCols = [["se"], ["micromips"]];
 }
 
+class StdMMR6Rel;
+
+def Std2MicroMipsR6 : InstrMapping {
+  let FilterClass = "StdMMR6Rel";
+  // Instructions with the same BaseOpcode and isNVStore values form a row.
+  let RowFields = ["BaseOpcode"];
+  // Instructions with the same predicate sense form a column.
+  let ColFields = ["Arch"];
+  // The key column is the unpredicated instructions.
+  let KeyCol = ["se"];
+  // Value columns are PredSense=true and PredSense=false
+  let ValueCols = [["se"], ["micromipsr6"]];
+}
+
 class StdArch {
   string Arch = "se";
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8661.22791.patch
Type: text/x-patch
Size: 2226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150327/2ab521aa/attachment.bin>


More information about the llvm-commits mailing list