[llvm-commits] [PATCH][Review request] Mips direct object generation patch #2

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Tue Oct 25 18:47:48 PDT 2011


Hi,

On Tue, Oct 25, 2011 at 6:19 PM, Carter, Jack <jcarter at mips.com> wrote:
> This is the first of several patches for Mips direct object generation. This
> first patch is for expression variable kinds.
>
> In this patch we are following the current convention of putting target
> specific  ELF relocation handling in the base class due to unfortunate
> expression class mechanics.
>
> Hopefully after our port settles down we can address this issue with the
> community and coordinate a structural change that pushes the target specific
> relocation and expression handling completely down to the Target level.

On the snippet below, early exit returning ELF::R_MIPS_NONE

+  // determine the type of the relocation
+  unsigned Type;
+  if (IsPCRel) {
+    switch ((unsigned)Fixup.getKind()) {
+    default:
+      llvm_unreachable("Unimplemented");
+      case Mips::fixup_Mips_Branch_PCRel:
+      case Mips::fixup_Mips_PC16:
+        Type = ELF::R_MIPS_NONE;
+        break;
+      break;
+    }

After that, remove the else below, use only 2 spaces for indentation
under the switch statement, and also return directly the other
relocation types.

+  } else {
+    switch ((unsigned)Fixup.getKind()) {
+        default:
+            llvm_unreachable("invalid fixup kind!");
+        case FK_Data_4:
+            Type = ELF::R_MIPS_32;
+            break;
+        case Mips::fixup_Mips_GPREL16:
+            Type = ELF::R_MIPS_GPREL16;
+            break;



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc




More information about the llvm-commits mailing list