summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalISel
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2018-01-29 17:37:29 +0000
committerDaniel Sanders <daniel_l_sanders@apple.com>2018-01-29 17:37:29 +0000
commit9ade5592d96a68bbe1b9a16099b0575c32db7905 (patch)
tree1c6e5dbd7a2ea907d59639aa144bc7190f687a34 /llvm/lib/CodeGen/GlobalISel
parent6845dec91715ee1fc9939053b8add76cacced6ef (diff)
downloadbcm5719-llvm-9ade5592d96a68bbe1b9a16099b0575c32db7905.tar.gz
bcm5719-llvm-9ade5592d96a68bbe1b9a16099b0575c32db7905.zip
[globalisel] Make LegalizerInfo::LegalizeAction available outside of LegalizerInfo. NFC
Summary: The improvements to the LegalizerInfo discussed in D42244 require that LegalizerInfo::LegalizeAction be available for use in other classes. As such, it needs to be moved out of LegalizerInfo. This has been done separately to the next patch to minimize the noise in that patch. llvm-svn: 323669
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp17
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp8
2 files changed, 14 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 06e3c75e081..2121b722958 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -26,6 +26,7 @@
#define DEBUG_TYPE "legalizer"
using namespace llvm;
+using namespace LegalizeActions;
LegalizerHelper::LegalizerHelper(MachineFunction &MF)
: MRI(MF.getRegInfo()), LI(*MF.getSubtarget().getLegalizerInfo()) {
@@ -38,25 +39,25 @@ LegalizerHelper::legalizeInstrStep(MachineInstr &MI) {
auto Step = LI.getAction(MI, MRI);
switch (Step.Action) {
- case LegalizerInfo::Legal:
+ case Legal:
DEBUG(dbgs() << ".. Already legal\n");
return AlreadyLegal;
- case LegalizerInfo::Libcall:
+ case Libcall:
DEBUG(dbgs() << ".. Convert to libcall\n");
return libcall(MI);
- case LegalizerInfo::NarrowScalar:
+ case NarrowScalar:
DEBUG(dbgs() << ".. Narrow scalar\n");
return narrowScalar(MI, Step.TypeIdx, Step.NewType);
- case LegalizerInfo::WidenScalar:
+ case WidenScalar:
DEBUG(dbgs() << ".. Widen scalar\n");
return widenScalar(MI, Step.TypeIdx, Step.NewType);
- case LegalizerInfo::Lower:
+ case Lower:
DEBUG(dbgs() << ".. Lower\n");
return lower(MI, Step.TypeIdx, Step.NewType);
- case LegalizerInfo::FewerElements:
+ case FewerElements:
DEBUG(dbgs() << ".. Reduce number of elements\n");
return fewerElementsVector(MI, Step.TypeIdx, Step.NewType);
- case LegalizerInfo::Custom:
+ case Custom:
DEBUG(dbgs() << ".. Custom legalization\n");
return LI.legalizeCustom(MI, MRI, MIRBuilder) ? Legalized
: UnableToLegalize;
@@ -941,7 +942,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty) {
// Lower (G_FSUB LHS, RHS) to (G_FADD LHS, (G_FNEG RHS)).
// First, check if G_FNEG is marked as Lower. If so, we may
// end up with an infinite loop as G_FSUB is used to legalize G_FNEG.
- if (LI.getAction({G_FNEG, {Ty}}).Action == LegalizerInfo::Lower)
+ if (LI.getAction({G_FNEG, {Ty}}).Action == Lower)
return UnableToLegalize;
unsigned Res = MI.getOperand(0).getReg();
unsigned LHS = MI.getOperand(1).getReg();
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index aedf9cde8d0..12f5524aa8c 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -29,7 +29,9 @@
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <map>
+
using namespace llvm;
+using namespace LegalizeActions;
LegalizerInfo::LegalizerInfo() : TablesInitialized(false) {
// Set defaults.
@@ -162,7 +164,7 @@ void LegalizerInfo::computeTables() {
// probably going to need specialized lookup structures for various types before
// we have any hope of doing well with something like <13 x i3>. Even the common
// cases should do better than what we have now.
-std::pair<LegalizerInfo::LegalizeAction, LLT>
+std::pair<LegalizeAction, LLT>
LegalizerInfo::getAspectAction(const InstrAspect &Aspect) const {
assert(TablesInitialized && "backend forgot to call computeTables");
// These *have* to be implemented for now, they're the fundamental basis of
@@ -326,7 +328,7 @@ LegalizerInfo::findAction(const SizeAndActionsVec &Vec, const uint32_t Size) {
llvm_unreachable("Action has an unknown enum value");
}
-std::pair<LegalizerInfo::LegalizeAction, LLT>
+std::pair<LegalizeAction, LLT>
LegalizerInfo::findScalarLegalAction(const InstrAspect &Aspect) const {
assert(Aspect.Type.isScalar() || Aspect.Type.isPointer());
if (Aspect.Opcode < FirstOp || Aspect.Opcode > LastOp)
@@ -355,7 +357,7 @@ LegalizerInfo::findScalarLegalAction(const InstrAspect &Aspect) const {
SizeAndAction.first)};
}
-std::pair<LegalizerInfo::LegalizeAction, LLT>
+std::pair<LegalizeAction, LLT>
LegalizerInfo::findVectorLegalAction(const InstrAspect &Aspect) const {
assert(Aspect.Type.isVector());
// First legalize the vector element size, then legalize the number of
OpenPOWER on IntegriCloud