diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 | 
| commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
| tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /lib/CodeGen/GlobalISel/LegalizerInfo.cpp | |
| parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) | |
Diffstat (limited to 'lib/CodeGen/GlobalISel/LegalizerInfo.cpp')
| -rw-r--r-- | lib/CodeGen/GlobalISel/LegalizerInfo.cpp | 31 | 
1 files changed, 24 insertions, 7 deletions
| diff --git a/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/lib/CodeGen/GlobalISel/LegalizerInfo.cpp index e49662075ed5..eaf4056e47ea 100644 --- a/lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ b/lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -41,6 +41,8 @@ LegalizerInfo::LegalizerInfo() : TablesInitialized(false) {    DefaultActions[TargetOpcode::G_STORE] = NarrowScalar;    DefaultActions[TargetOpcode::G_BRCOND] = WidenScalar; +  DefaultActions[TargetOpcode::G_INSERT] = NarrowScalar; +  DefaultActions[TargetOpcode::G_FNEG] = Lower;  }  void LegalizerInfo::computeTables() { @@ -71,28 +73,36 @@ LegalizerInfo::getAction(const InstrAspect &Aspect) const {    // These *have* to be implemented for now, they're the fundamental basis of    // how everything else is transformed. -  // Nothing is going to go well with types that aren't a power of 2 yet, so -  // don't even try because we might make things worse. -  if (!isPowerOf2_64(Aspect.Type.getSizeInBits())) -      return std::make_pair(Unsupported, LLT()); -    // FIXME: the long-term plan calls for expansion in terms of load/store (if    // they're not legal).    if (Aspect.Opcode == TargetOpcode::G_SEQUENCE || -      Aspect.Opcode == TargetOpcode::G_EXTRACT) +      Aspect.Opcode == TargetOpcode::G_EXTRACT || +      Aspect.Opcode == TargetOpcode::G_MERGE_VALUES || +      Aspect.Opcode == TargetOpcode::G_UNMERGE_VALUES)      return std::make_pair(Legal, Aspect.Type); +  LLT Ty = Aspect.Type;    LegalizeAction Action = findInActions(Aspect); +  // LegalizerHelper is not able to handle non-power-of-2 types right now, so do +  // not try to legalize them unless they are marked as Legal or Custom. +  // FIXME: This is a temporary hack until the general non-power-of-2 +  // legalization works. +  if (!isPowerOf2_64(Ty.getSizeInBits()) && +      !(Action == Legal || Action == Custom)) +    return std::make_pair(Unsupported, LLT()); +    if (Action != NotFound)      return findLegalAction(Aspect, Action);    unsigned Opcode = Aspect.Opcode; -  LLT Ty = Aspect.Type;    if (!Ty.isVector()) {      auto DefaultAction = DefaultActions.find(Aspect.Opcode);      if (DefaultAction != DefaultActions.end() && DefaultAction->second == Legal)        return std::make_pair(Legal, Ty); +    if (DefaultAction != DefaultActions.end() && DefaultAction->second == Lower) +      return std::make_pair(Lower, Ty); +      if (DefaultAction == DefaultActions.end() ||          DefaultAction->second != NarrowScalar)        return std::make_pair(Unsupported, LLT()); @@ -160,6 +170,7 @@ LLT LegalizerInfo::findLegalType(const InstrAspect &Aspect,    case Legal:    case Lower:    case Libcall: +  case Custom:      return Aspect.Type;    case NarrowScalar: {      return findLegalType(Aspect, @@ -180,3 +191,9 @@ LLT LegalizerInfo::findLegalType(const InstrAspect &Aspect,    }    }  } + +bool LegalizerInfo::legalizeCustom(MachineInstr &MI, +                                   MachineRegisterInfo &MRI, +                                   MachineIRBuilder &MIRBuilder) const { +  return false; +} | 
