forked from OSchip/llvm-project
[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
This is preparation to reduce TargetInstrInfo.h dependencies. llvm-svn: 294084
This commit is contained in:
parent
aa741abfc5
commit
502d0bc28e
|
@ -11,40 +11,63 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "ScheduleDAGSDNodes.h"
|
||||
#include "SelectionDAGBuilder.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/PostOrderIterator.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||
#include "llvm/Analysis/CFG.h"
|
||||
#include "llvm/Analysis/EHPersonalities.h"
|
||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||
#include "llvm/CodeGen/FastISel.h"
|
||||
#include "llvm/CodeGen/FunctionLoweringInfo.h"
|
||||
#include "llvm/CodeGen/GCMetadata.h"
|
||||
#include "llvm/CodeGen/GCStrategy.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachinePassRegistry.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/CodeGen/SchedulerRegistry.h"
|
||||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "llvm/CodeGen/SelectionDAGISel.h"
|
||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||
#include "llvm/CodeGen/StackProtector.h"
|
||||
#include "llvm/CodeGen/WinEHFuncInfo.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/InstrTypes.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/User.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
@ -59,6 +82,13 @@
|
|||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -238,7 +268,7 @@ MachinePassRegistry RegisterScheduler::Registry;
|
|||
///
|
||||
//===---------------------------------------------------------------------===//
|
||||
static cl::opt<RegisterScheduler::FunctionPassCtor, false,
|
||||
RegisterPassParser<RegisterScheduler> >
|
||||
RegisterPassParser<RegisterScheduler>>
|
||||
ISHeuristic("pre-RA-sched",
|
||||
cl::init(&createDefaultScheduler), cl::Hidden,
|
||||
cl::desc("Instruction schedulers available (before register"
|
||||
|
@ -249,6 +279,7 @@ defaultListDAGScheduler("default", "Best scheduler for the target",
|
|||
createDefaultScheduler);
|
||||
|
||||
namespace llvm {
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// \brief This class is used by SelectionDAGISel to temporarily override
|
||||
/// the optimization level on a per-function basis.
|
||||
|
@ -318,6 +349,7 @@ namespace llvm {
|
|||
"Unknown sched type!");
|
||||
return createILPListDAGScheduler(IS, OptLevel);
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
// EmitInstrWithCustomInserter - This method should be implemented by targets
|
||||
|
@ -628,7 +660,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
|||
unsigned To = I->second;
|
||||
// If To is also scheduled to be replaced, find what its ultimate
|
||||
// replacement is.
|
||||
for (;;) {
|
||||
while (true) {
|
||||
DenseMap<unsigned, unsigned>::iterator J = FuncInfo->RegFixups.find(To);
|
||||
if (J == E) break;
|
||||
To = J->second;
|
||||
|
@ -907,10 +939,12 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/// ISelUpdater - helper class to handle updates of the instruction selection
|
||||
/// graph.
|
||||
class ISelUpdater : public SelectionDAG::DAGUpdateListener {
|
||||
SelectionDAG::allnodes_iterator &ISelPosition;
|
||||
|
||||
public:
|
||||
ISelUpdater(SelectionDAG &DAG, SelectionDAG::allnodes_iterator &isp)
|
||||
: SelectionDAG::DAGUpdateListener(DAG), ISelPosition(isp) {}
|
||||
|
@ -923,6 +957,7 @@ public:
|
|||
++ISelPosition;
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
static bool isStrictFPOp(SDNode *Node, unsigned &NewOpc) {
|
||||
|
@ -1113,7 +1148,7 @@ static bool isFoldedOrDeadInstruction(const Instruction *I,
|
|||
// will not add up to what is reported by NumFastIselFailures.
|
||||
static void collectFailStats(const Instruction *I) {
|
||||
switch (I->getOpcode()) {
|
||||
default: assert (0 && "<Invalid operator> ");
|
||||
default: assert(false && "<Invalid operator>");
|
||||
|
||||
// Terminators
|
||||
case Instruction::Ret: NumFastIselFailRet++; return;
|
||||
|
@ -2237,7 +2272,6 @@ bool SelectionDAGISel::IsLegalToFold(SDValue N, SDNode *U, SDNode *Root,
|
|||
IgnoreChains = false;
|
||||
}
|
||||
|
||||
|
||||
SmallPtrSet<SDNode*, 16> Visited;
|
||||
return !findNonImmUse(Root, N.getNode(), U, Root, Visited, IgnoreChains);
|
||||
}
|
||||
|
@ -2614,7 +2648,7 @@ MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList,
|
|||
LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool
|
||||
CheckSame(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
||||
SDValue N,
|
||||
const SmallVectorImpl<std::pair<SDValue, SDNode*> > &RecordedNodes) {
|
||||
const SmallVectorImpl<std::pair<SDValue, SDNode*>> &RecordedNodes) {
|
||||
// Accept if it is exactly the same as a previously recorded node.
|
||||
unsigned RecNo = MatcherTable[MatcherIndex++];
|
||||
assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
|
||||
|
@ -2624,9 +2658,9 @@ CheckSame(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
|||
/// CheckChildSame - Implements OP_CheckChildXSame.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool
|
||||
CheckChildSame(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
||||
SDValue N,
|
||||
const SmallVectorImpl<std::pair<SDValue, SDNode*> > &RecordedNodes,
|
||||
unsigned ChildNo) {
|
||||
SDValue N,
|
||||
const SmallVectorImpl<std::pair<SDValue, SDNode*>> &RecordedNodes,
|
||||
unsigned ChildNo) {
|
||||
if (ChildNo >= N.getNumOperands())
|
||||
return false; // Match fails if out of range child #.
|
||||
return ::CheckSame(MatcherTable, MatcherIndex, N.getOperand(ChildNo),
|
||||
|
@ -2748,7 +2782,7 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
|
|||
unsigned Index, SDValue N,
|
||||
bool &Result,
|
||||
const SelectionDAGISel &SDISel,
|
||||
SmallVectorImpl<std::pair<SDValue, SDNode*> > &RecordedNodes) {
|
||||
SmallVectorImpl<std::pair<SDValue, SDNode*>> &RecordedNodes) {
|
||||
switch (Table[Index++]) {
|
||||
default:
|
||||
Result = false;
|
||||
|
@ -2816,6 +2850,7 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
|
|||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct MatchScope {
|
||||
/// FailIndex - If this match fails, this is the index to continue with.
|
||||
unsigned FailIndex;
|
||||
|
@ -2845,6 +2880,7 @@ class MatchStateUpdater : public SelectionDAG::DAGUpdateListener
|
|||
SDNode **NodeToMatch;
|
||||
SmallVectorImpl<std::pair<SDValue, SDNode *>> &RecordedNodes;
|
||||
SmallVectorImpl<MatchScope> &MatchScopes;
|
||||
|
||||
public:
|
||||
MatchStateUpdater(SelectionDAG &DAG, SDNode **NodeToMatch,
|
||||
SmallVectorImpl<std::pair<SDValue, SDNode *>> &RN,
|
||||
|
@ -2876,6 +2912,7 @@ public:
|
|||
J.setNode(E);
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
||||
|
@ -2981,7 +3018,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
// with an OPC_SwitchOpcode instruction. Populate the table now, since this
|
||||
// is the first time we're selecting an instruction.
|
||||
unsigned Idx = 1;
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Get the size of this case.
|
||||
unsigned CaseSize = MatcherTable[Idx++];
|
||||
if (CaseSize & 128)
|
||||
|
@ -3002,7 +3039,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
MatcherIndex = OpcodeOffset[N.getOpcode()];
|
||||
}
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
assert(MatcherIndex < TableSize && "Invalid index");
|
||||
#ifndef NDEBUG
|
||||
unsigned CurrentOpcodeIndex = MatcherIndex;
|
||||
|
@ -3017,7 +3054,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
// immediately fail, don't even bother pushing a scope for them.
|
||||
unsigned FailIndex;
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
unsigned NumToSkip = MatcherTable[MatcherIndex++];
|
||||
if (NumToSkip & 128)
|
||||
NumToSkip = GetVBR(NumToSkip, MatcherTable, MatcherIndex);
|
||||
|
@ -3178,7 +3215,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
unsigned CurNodeOpcode = N.getOpcode();
|
||||
unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
|
||||
unsigned CaseSize;
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Get the size of this case.
|
||||
CaseSize = MatcherTable[MatcherIndex++];
|
||||
if (CaseSize & 128)
|
||||
|
@ -3209,7 +3246,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
MVT CurNodeVT = N.getSimpleValueType();
|
||||
unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
|
||||
unsigned CaseSize;
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Get the size of this case.
|
||||
CaseSize = MatcherTable[MatcherIndex++];
|
||||
if (CaseSize & 128)
|
||||
|
@ -3533,7 +3570,6 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
RecordedNodes.push_back(std::pair<SDValue,SDNode*>(SDValue(Res, i),
|
||||
nullptr));
|
||||
}
|
||||
|
||||
} else {
|
||||
assert(NodeToMatch->getOpcode() != ISD::DELETED_NODE &&
|
||||
"NodeToMatch was removed partway through selection");
|
||||
|
@ -3670,7 +3706,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||
// find a case to check.
|
||||
DEBUG(dbgs() << " Match failed at index " << CurrentOpcodeIndex << "\n");
|
||||
++NumDAGIselRetries;
|
||||
while (1) {
|
||||
while (true) {
|
||||
if (MatchScopes.empty()) {
|
||||
CannotYetSelect(NodeToMatch);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue