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

Phabricator reviews at reviews.llvm.org
Wed Apr 22 06:30:50 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8661

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

Index: llvm/trunk/lib/Target/Mips/MipsInstrFormats.td
===================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrFormats.td
+++ llvm/trunk/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";
 }
Index: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
@@ -179,13 +179,20 @@
       (Opcode != Mips::SLL_MM) && !Binary)
     llvm_unreachable("unimplemented opcode in EncodeInstruction()");
 
+  int NewOpcode = -1;
   if (isMicroMips(STI)) {
-    int NewOpcode = isMips32r6(STI) ?
-                    Mips::MipsR62MicroMipsR6(Opcode, Mips::Arch_micromipsr6) :
-                    Mips::Std2MicroMips(Opcode, Mips::Arch_micromips);
+    if (isMips32r6(STI)) {
+      NewOpcode = Mips::MipsR62MicroMipsR6(Opcode, Mips::Arch_micromipsr6);
+      if (NewOpcode == -1)
+        NewOpcode = Mips::Std2MicroMipsR6(Opcode, Mips::Arch_micromipsr6);
+    }
+    else
+      NewOpcode = Mips::Std2MicroMips(Opcode, Mips::Arch_micromips);
+
     if (NewOpcode != -1) {
       if (Fixups.size() > N)
         Fixups.pop_back();
+
       Opcode = NewOpcode;
       TmpInst.setOpcode (NewOpcode);
       Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);

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


More information about the llvm-commits mailing list