Commit b69f1a10 authored by Pawel Wodnicki's avatar Pawel Wodnicki
Browse files

Merging MIPS GOT changeset into 3.2 release branch.

Merging r168471:

Mips direct object xgot support

This patch provides support for the MIPS relocations:

    *)  R_MIPS_GOT_HI16
    *)  R_MIPS_GOT_LO16
    *)  R_MIPS_CALL_HI16
    *)  R_MIPS_CALL_LO16

These are used for large GOT instruction sequences.

Contributer: Jack Carter

Merging r168460:

[mips] Generate big GOT code.

Merging r168458:

[mips] Simplify lowering functions in MipsISelLowering.cpp by using the helper
functions added in r168456.

Merging r168456:

[mips] Add helper functions that create nodes for computing address.

Merging r168455:

[mips] Add command line option "-mxgot".

Merging r168453:

[mips] When a node which loads from a GOT is created, pass a MachinePointerInfo
referring to a GOT entry.

Merging r168450:

[mips] Add target operand flag enums for big GOT relocations.

Merging r168448:

Add relocations used for mips big GOT.

llvm-svn: 169294
parent 7b6e3e24
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -197,7 +197,11 @@ public:
    VK_Mips_GOT_PAGE,
    VK_Mips_GOT_OFST,
    VK_Mips_HIGHER,
    VK_Mips_HIGHEST
    VK_Mips_HIGHEST,
    VK_Mips_GOT_HI16,
    VK_Mips_GOT_LO16,
    VK_Mips_CALL_HI16,
    VK_Mips_CALL_LO16
  };

private:
+4 −0
Original line number Diff line number Diff line
@@ -229,6 +229,10 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
  case VK_Mips_GOT_OFST: return "GOT_OFST";
  case VK_Mips_HIGHER:   return "HIGHER";
  case VK_Mips_HIGHEST:  return "HIGHEST";
  case VK_Mips_GOT_HI16: return "GOT_HI16";
  case VK_Mips_GOT_LO16: return "GOT_LO16";
  case VK_Mips_CALL_HI16: return "CALL_HI16";
  case VK_Mips_CALL_LO16: return "CALL_LO16";
  }
  llvm_unreachable("Invalid variant kind");
}
+4 −0
Original line number Diff line number Diff line
@@ -128,6 +128,10 @@ static void printExpr(const MCExpr *Expr, raw_ostream &OS) {
  case MCSymbolRefExpr::VK_Mips_GOT_OFST:  OS << "%got_ofst("; break;
  case MCSymbolRefExpr::VK_Mips_HIGHER:    OS << "%higher("; break;
  case MCSymbolRefExpr::VK_Mips_HIGHEST:   OS << "%highest("; break;
  case MCSymbolRefExpr::VK_Mips_GOT_HI16:  OS << "%got_hi("; break;
  case MCSymbolRefExpr::VK_Mips_GOT_LO16:  OS << "%got_lo("; break;
  case MCSymbolRefExpr::VK_Mips_CALL_HI16: OS << "%call_hi("; break;
  case MCSymbolRefExpr::VK_Mips_CALL_LO16: OS << "%call_lo("; break;
  }

  OS << SRE->getSymbol();
+9 −1
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
  case Mips::fixup_Mips_GOT_PAGE:
  case Mips::fixup_Mips_GOT_OFST:
  case Mips::fixup_Mips_GOT_DISP:
  case Mips::fixup_Mips_GOT_LO16:
  case Mips::fixup_Mips_CALL_LO16:
    break;
  case Mips::fixup_Mips_PC16:
    // So far we are only using this type for branches.
@@ -60,6 +62,8 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
    break;
  case Mips::fixup_Mips_HI16:
  case Mips::fixup_Mips_GOT_Local:
  case Mips::fixup_Mips_GOT_HI16:
  case Mips::fixup_Mips_CALL_HI16:
    // Get the 2nd 16-bits. Also add 1 if bit 15 is 1.
    Value = ((Value + 0x8000) >> 16) & 0xffff;
    break;
@@ -179,7 +183,11 @@ public:
      { "fixup_Mips_GOT_OFST",     0,     16,   0 },
      { "fixup_Mips_GOT_DISP",     0,     16,   0 },
      { "fixup_Mips_HIGHER",       0,     16,   0 },
      { "fixup_Mips_HIGHEST",      0,     16,   0 }
      { "fixup_Mips_HIGHEST",      0,     16,   0 },
      { "fixup_Mips_GOT_HI16",     0,     16,   0 },
      { "fixup_Mips_GOT_LO16",     0,     16,   0 },
      { "fixup_Mips_CALL_HI16",    0,     16,   0 },
      { "fixup_Mips_CALL_LO16",    0,     16,   0 }
    };

    if (Kind < FirstTargetFixupKind)
+7 −1
Original line number Diff line number Diff line
@@ -84,7 +84,13 @@ namespace MipsII {
    /// MO_HIGHER/HIGHEST - Represents the highest or higher half word of a
    /// 64-bit symbol address.
    MO_HIGHER,
    MO_HIGHEST
    MO_HIGHEST,

    /// MO_GOT_HI16/LO16, MO_CALL_HI16/LO16 - Relocations used for large GOTs.
    MO_GOT_HI16,
    MO_GOT_LO16,
    MO_CALL_HI16,
    MO_CALL_LO16
  };

  enum {
Loading