mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 304839
This commit is contained in:
parent
4f429e895d
commit
5ddbdccf6e
@ -32,7 +32,9 @@
|
||||
namespace llvm {
|
||||
|
||||
class LiveIntervals;
|
||||
class MachineFunction;
|
||||
class MachineInstr;
|
||||
class MachineRegisterInfo;
|
||||
class RegisterClassInfo;
|
||||
|
||||
struct RegisterMaskPair {
|
||||
@ -147,12 +149,14 @@ class PressureDiff {
|
||||
|
||||
PressureChange PressureChanges[MaxPSets];
|
||||
|
||||
typedef PressureChange* iterator;
|
||||
using iterator = PressureChange *;
|
||||
|
||||
iterator nonconst_begin() { return &PressureChanges[0]; }
|
||||
iterator nonconst_end() { return &PressureChanges[MaxPSets]; }
|
||||
|
||||
public:
|
||||
typedef const PressureChange* const_iterator;
|
||||
using const_iterator = const PressureChange *;
|
||||
|
||||
const_iterator begin() const { return &PressureChanges[0]; }
|
||||
const_iterator end() const { return &PressureChanges[MaxPSets]; }
|
||||
|
||||
@ -269,7 +273,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef SparseSet<IndexMaskPair> RegSet;
|
||||
using RegSet = SparseSet<IndexMaskPair>;
|
||||
RegSet Regs;
|
||||
unsigned NumRegUnits;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==- RegisterUsageInfo.h - Register Usage Informartion Storage -*- C++ -*-===//
|
||||
//==- RegisterUsageInfo.h - Register Usage Informartion Storage --*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -20,15 +20,15 @@
|
||||
#define LLVM_CODEGEN_PHYSICALREGISTERUSAGEINFO_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Function;
|
||||
class TargetMachine;
|
||||
|
||||
class PhysicalRegisterUsageInfo : public ImmutablePass {
|
||||
virtual void anchor();
|
||||
|
||||
@ -70,6 +70,7 @@ private:
|
||||
|
||||
const TargetMachine *TM;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_PHYSICALREGISTERUSAGEINFO_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/CodeGen/SchedulerRegistry.h ------------------------*- C++ -*-===//
|
||||
//===- llvm/CodeGen/SchedulerRegistry.h -------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -16,7 +16,7 @@
|
||||
#define LLVM_CODEGEN_SCHEDULERREGISTRY_H
|
||||
|
||||
#include "llvm/CodeGen/MachinePassRegistry.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -26,15 +26,13 @@ namespace llvm {
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class SelectionDAGISel;
|
||||
class ScheduleDAGSDNodes;
|
||||
class SelectionDAG;
|
||||
class MachineBasicBlock;
|
||||
class SelectionDAGISel;
|
||||
|
||||
class RegisterScheduler : public MachinePassRegistryNode {
|
||||
public:
|
||||
typedef ScheduleDAGSDNodes *(*FunctionPassCtor)(SelectionDAGISel*,
|
||||
CodeGenOpt::Level);
|
||||
using FunctionPassCtor = ScheduleDAGSDNodes *(*)(SelectionDAGISel*,
|
||||
CodeGenOpt::Level);
|
||||
|
||||
static MachinePassRegistry Registry;
|
||||
|
||||
@ -45,13 +43,14 @@ public:
|
||||
|
||||
|
||||
// Accessors.
|
||||
//
|
||||
RegisterScheduler *getNext() const {
|
||||
return (RegisterScheduler *)MachinePassRegistryNode::getNext();
|
||||
}
|
||||
|
||||
static RegisterScheduler *getList() {
|
||||
return (RegisterScheduler *)Registry.getList();
|
||||
}
|
||||
|
||||
static void setListener(MachinePassRegistryListener *L) {
|
||||
Registry.setListener(L);
|
||||
}
|
||||
@ -103,4 +102,4 @@ ScheduleDAGSDNodes *createDAGLinearizer(SelectionDAGISel *IS,
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_SCHEDULERREGISTRY_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp --*- C++ -*--===//
|
||||
//===- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,37 +12,80 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeViewDebug.h"
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/TinyPtrVector.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/LexicalScopes.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
|
||||
#include "llvm/DebugInfo/CodeView/Line.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCSectionCOFF.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/BinaryByteStream.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
||||
CodeViewDebug::CodeViewDebug(AsmPrinter *AP)
|
||||
: DebugHandlerBase(AP), OS(*Asm->OutStreamer), Allocator(),
|
||||
TypeTable(Allocator), CurFn(nullptr) {
|
||||
: DebugHandlerBase(AP), OS(*Asm->OutStreamer), TypeTable(Allocator) {
|
||||
// If module doesn't have named metadata anchors or COFF debug section
|
||||
// is not available, skip any debug info related stuff.
|
||||
if (!MMI->getModule()->getNamedMetadata("llvm.dbg.cu") ||
|
||||
@ -178,7 +221,8 @@ static const DISubprogram *getQualifiedNameComponents(
|
||||
static std::string getQualifiedName(ArrayRef<StringRef> QualifiedNameComponents,
|
||||
StringRef TypeName) {
|
||||
std::string FullyQualifiedName;
|
||||
for (StringRef QualifiedNameComponent : reverse(QualifiedNameComponents)) {
|
||||
for (StringRef QualifiedNameComponent :
|
||||
llvm::reverse(QualifiedNameComponents)) {
|
||||
FullyQualifiedName.append(QualifiedNameComponent);
|
||||
FullyQualifiedName.append("::");
|
||||
}
|
||||
@ -571,7 +615,7 @@ static CPUType mapArchToCVCPUType(Triple::ArchType Type) {
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // end anonymous namespace
|
||||
|
||||
void CodeViewDebug::emitCompilerInformation() {
|
||||
MCContext &Context = MMI->getContext();
|
||||
@ -1581,11 +1625,11 @@ struct llvm::ClassInfo {
|
||||
uint64_t BaseOffset;
|
||||
};
|
||||
// [MemberInfo]
|
||||
typedef std::vector<MemberInfo> MemberList;
|
||||
using MemberList = std::vector<MemberInfo>;
|
||||
|
||||
typedef TinyPtrVector<const DISubprogram *> MethodsList;
|
||||
using MethodsList = TinyPtrVector<const DISubprogram *>;
|
||||
// MethodName -> MethodsList
|
||||
typedef MapVector<MDString *, MethodsList> MethodsMap;
|
||||
using MethodsMap = MapVector<MDString *, MethodsList>;
|
||||
|
||||
/// Base classes.
|
||||
std::vector<const DIDerivedType *> Inheritance;
|
||||
@ -1850,7 +1894,7 @@ CodeViewDebug::lowerRecordFieldList(const DICompositeType *Ty) {
|
||||
translateMethodOptionFlags(SP), VFTableOffset, Name));
|
||||
MemberCount++;
|
||||
}
|
||||
assert(Methods.size() > 0 && "Empty methods map entry");
|
||||
assert(!Methods.empty() && "Empty methods map entry");
|
||||
if (Methods.size() == 1)
|
||||
FLBR.writeMemberType(Methods[0]);
|
||||
else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h ----*- C++ -*--===//
|
||||
//===- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,29 +14,44 @@
|
||||
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
|
||||
#define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
|
||||
|
||||
#include "DbgValueHistoryCalculator.h"
|
||||
#include "DebugHandlerBase.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class StringRef;
|
||||
class LexicalScope;
|
||||
struct ClassInfo;
|
||||
class StringRef;
|
||||
class AsmPrinter;
|
||||
class Function;
|
||||
class GlobalVariable;
|
||||
class MCSectionCOFF;
|
||||
class MCStreamer;
|
||||
class MCSymbol;
|
||||
class MachineFunction;
|
||||
|
||||
/// \brief Collects and handles line tables information in a CodeView format.
|
||||
class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
|
||||
MCStreamer &OS;
|
||||
llvm::BumpPtrAllocator Allocator;
|
||||
BumpPtrAllocator Allocator;
|
||||
codeview::TypeTableBuilder TypeTable;
|
||||
|
||||
/// Represents the most general definition range.
|
||||
@ -110,7 +125,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
|
||||
unsigned LastFileId = 0;
|
||||
bool HaveLineInfo = false;
|
||||
};
|
||||
FunctionInfo *CurFn;
|
||||
FunctionInfo *CurFn = nullptr;
|
||||
|
||||
/// The set of comdat .debug$S sections that we've seen so far. Each section
|
||||
/// must start with a magic version number that must only be emitted once.
|
||||
@ -176,8 +191,9 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
|
||||
std::vector<std::pair<std::string, codeview::TypeIndex>> LocalUDTs,
|
||||
GlobalUDTs;
|
||||
|
||||
typedef std::map<const DIFile *, std::string> FileToFilepathMapTy;
|
||||
using FileToFilepathMapTy = std::map<const DIFile *, std::string>;
|
||||
FileToFilepathMapTy FileToFilepathMap;
|
||||
|
||||
StringRef getFullFilepath(const DIFile *S);
|
||||
|
||||
unsigned maybeRecordFile(const DIFile *F);
|
||||
@ -223,7 +239,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
|
||||
void emitInlinedCallSite(const FunctionInfo &FI, const DILocation *InlinedAt,
|
||||
const InlineSite &Site);
|
||||
|
||||
typedef DbgValueHistoryMap::InlinedVariable InlinedVariable;
|
||||
using InlinedVariable = DbgValueHistoryMap::InlinedVariable;
|
||||
|
||||
void collectVariableInfo(const DISubprogram *SP);
|
||||
|
||||
@ -309,7 +325,7 @@ protected:
|
||||
public:
|
||||
CodeViewDebug(AsmPrinter *Asm);
|
||||
|
||||
void setSymbolSize(const llvm::MCSymbol *, uint64_t) override {}
|
||||
void setSymbolSize(const MCSymbol *, uint64_t) override {}
|
||||
|
||||
/// \brief Emit the COFF section that holds the line table information.
|
||||
void endModule() override;
|
||||
@ -317,6 +333,7 @@ public:
|
||||
/// \brief Process beginning of an instruction.
|
||||
void beginInstruction(const MachineInstr *MI) override;
|
||||
};
|
||||
} // End of namespace llvm
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- BranchFolding.cpp - Fold machine code branch instructions ---------===//
|
||||
//===- BranchFolding.cpp - Fold machine code branch instructions ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -18,30 +18,46 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "BranchFolding.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/BitVector.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/CodeGen/Analysis.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
|
||||
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/BlockFrequency.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "branch-folder"
|
||||
@ -69,10 +85,12 @@ TailMergeSize("tail-merge-size",
|
||||
cl::init(3), cl::Hidden);
|
||||
|
||||
namespace {
|
||||
|
||||
/// BranchFolderPass - Wrap branch folder in a machine function pass.
|
||||
class BranchFolderPass : public MachineFunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
explicit BranchFolderPass(): MachineFunctionPass(ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
@ -84,7 +102,8 @@ namespace {
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char BranchFolderPass::ID = 0;
|
||||
char &llvm::BranchFolderPassID = BranchFolderPass::ID;
|
||||
@ -368,7 +387,7 @@ MachineBasicBlock *BranchFolder::SplitMBBAt(MachineBasicBlock &CurMBB,
|
||||
|
||||
// Create the fall-through block.
|
||||
MachineFunction::iterator MBBI = CurMBB.getIterator();
|
||||
MachineBasicBlock *NewMBB =MF.CreateMachineBasicBlock(BB);
|
||||
MachineBasicBlock *NewMBB = MF.CreateMachineBasicBlock(BB);
|
||||
CurMBB.getParent()->insert(++MBBI, NewMBB);
|
||||
|
||||
// Move all the successors of this block to the specified block.
|
||||
@ -506,7 +525,7 @@ static unsigned CountTerminators(MachineBasicBlock *MBB,
|
||||
MachineBasicBlock::iterator &I) {
|
||||
I = MBB->end();
|
||||
unsigned NumTerms = 0;
|
||||
for (;;) {
|
||||
while (true) {
|
||||
if (I == MBB->begin()) {
|
||||
I = MBB->end();
|
||||
break;
|
||||
@ -1601,7 +1620,6 @@ ReoptimizeBlock:
|
||||
// block doesn't fall through into some other block, see if we can find a
|
||||
// place to move this block where a fall-through will happen.
|
||||
if (!PrevBB.canFallThrough()) {
|
||||
|
||||
// Now we know that there was no fall-through into this block, check to
|
||||
// see if it has a fall-through into its successor.
|
||||
bool CurFallsThru = MBB->canFallThrough();
|
||||
|
@ -11,11 +11,19 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MIParser.h"
|
||||
|
||||
#include "MILexer.h"
|
||||
#include "MIParser.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/AsmParser/Parser.h"
|
||||
#include "llvm/AsmParser/SlotMapping.h"
|
||||
#include "llvm/CodeGen/MIRPrinter.h"
|
||||
@ -26,19 +34,48 @@
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/InstrTypes.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/ModuleSlotTracker.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/IR/ValueSymbolTable.h"
|
||||
#include "llvm/MC/LaneBitmask.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Support/AtomicOrdering.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/LowLevelTypeImpl.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetIntrinsicInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -2039,7 +2076,7 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {
|
||||
// The token was already consumed, so use return here instead of break.
|
||||
return false;
|
||||
}
|
||||
case MIToken::kw_call_entry: {
|
||||
case MIToken::kw_call_entry:
|
||||
lex();
|
||||
switch (Token.kind()) {
|
||||
case MIToken::GlobalValue:
|
||||
@ -2059,7 +2096,6 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {
|
||||
"expected a global value or an external symbol after 'call-entry'");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm_unreachable("The current token should be pseudo source value");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- MIParser.h - Machine Instructions Parser ---------------------------===//
|
||||
//===- MIParser.h - Machine Instructions Parser -----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -15,21 +15,19 @@
|
||||
#define LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class StringRef;
|
||||
class BasicBlock;
|
||||
class MachineBasicBlock;
|
||||
class MachineFunction;
|
||||
class MachineInstr;
|
||||
class MachineRegisterInfo;
|
||||
class MDNode;
|
||||
class RegisterBank;
|
||||
struct SlotMapping;
|
||||
class SMDiagnostic;
|
||||
class SourceMgr;
|
||||
class StringRef;
|
||||
class TargetRegisterClass;
|
||||
|
||||
struct VRegInfo {
|
||||
@ -45,8 +43,8 @@ struct VRegInfo {
|
||||
unsigned PreferredReg = 0;
|
||||
};
|
||||
|
||||
typedef StringMap<const TargetRegisterClass*> Name2RegClassMap;
|
||||
typedef StringMap<const RegisterBank*> Name2RegBankMap;
|
||||
using Name2RegClassMap = StringMap<const TargetRegisterClass *>;
|
||||
using Name2RegBankMap = StringMap<const RegisterBank *>;
|
||||
|
||||
struct PerFunctionMIParsingState {
|
||||
BumpPtrAllocator Allocator;
|
||||
@ -122,4 +120,4 @@ bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node, StringRef Src,
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_LIB_CODEGEN_MIRPARSER_MIPARSER_H
|
||||
|
@ -12,36 +12,65 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MIRPrinter.h"
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/SmallBitVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
|
||||
#include "llvm/CodeGen/MIRYamlMapping.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MIRPrinter.h"
|
||||
#include "llvm/CodeGen/MIRYamlMapping.h"
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
#include "llvm/IR/InstrTypes.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/ModuleSlotTracker.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/MC/LaneBitmask.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/AtomicOrdering.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Options.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/Support/LowLevelTypeImpl.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetIntrinsicInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cinttypes>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -148,6 +177,7 @@ template <> struct BlockScalarTraits<Module> {
|
||||
static void output(const Module &Mod, void *Ctxt, raw_ostream &OS) {
|
||||
Mod.print(OS, nullptr);
|
||||
}
|
||||
|
||||
static StringRef input(StringRef Str, void *Ctxt, Module &Mod) {
|
||||
llvm_unreachable("LLVM Module is supposed to be parsed separately");
|
||||
return "";
|
||||
@ -519,7 +549,6 @@ bool MIPrinter::canPredictSuccessors(const MachineBasicBlock &MBB) const {
|
||||
return std::equal(MBB.succ_begin(), MBB.succ_end(), GuessedSuccs.begin());
|
||||
}
|
||||
|
||||
|
||||
void MIPrinter::print(const MachineBasicBlock &MBB) {
|
||||
assert(MBB.getNumber() >= 0 && "Invalid MBB number");
|
||||
OS << "bb." << MBB.getNumber();
|
||||
@ -911,7 +940,7 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI,
|
||||
OS << "%const." << Op.getIndex();
|
||||
printOffset(Op.getOffset());
|
||||
break;
|
||||
case MachineOperand::MO_TargetIndex: {
|
||||
case MachineOperand::MO_TargetIndex:
|
||||
OS << "target-index(";
|
||||
if (const auto *Name = getTargetIndexName(
|
||||
*Op.getParent()->getParent()->getParent(), Op.getIndex()))
|
||||
@ -921,7 +950,6 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI,
|
||||
OS << ')';
|
||||
printOffset(Op.getOffset());
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_JumpTableIndex:
|
||||
OS << "%jump-table." << Op.getIndex();
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- RegAllocGreedy.cpp - greedy register allocator --------------------===//
|
||||
//===- RegAllocGreedy.cpp - greedy register allocator ---------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,36 +19,63 @@
|
||||
#include "SpillPlacement.h"
|
||||
#include "Spiller.h"
|
||||
#include "SplitKit.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/IndexedMap.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/OptimizationDiagnosticInfo.h"
|
||||
#include "llvm/CodeGen/CalcSpillWeights.h"
|
||||
#include "llvm/CodeGen/EdgeBundles.h"
|
||||
#include "llvm/CodeGen/LiveInterval.h"
|
||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||
#include "llvm/CodeGen/LiveIntervalUnion.h"
|
||||
#include "llvm/CodeGen/LiveRangeEdit.h"
|
||||
#include "llvm/CodeGen/LiveRegMatrix.h"
|
||||
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/CodeGen/RegisterClassInfo.h"
|
||||
#include "llvm/CodeGen/SlotIndexes.h"
|
||||
#include "llvm/CodeGen/VirtRegMap.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/PassAnalysisSupport.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/BlockFrequency.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -106,13 +133,14 @@ static RegisterRegAlloc greedyRegAlloc("greedy", "greedy register allocator",
|
||||
createGreedyRegisterAllocator);
|
||||
|
||||
namespace {
|
||||
|
||||
class RAGreedy : public MachineFunctionPass,
|
||||
public RegAllocBase,
|
||||
private LiveRangeEdit::Delegate {
|
||||
// Convenient shortcuts.
|
||||
typedef std::priority_queue<std::pair<unsigned, unsigned> > PQueue;
|
||||
typedef SmallPtrSet<LiveInterval *, 4> SmallLISet;
|
||||
typedef SmallSet<unsigned, 16> SmallVirtRegSet;
|
||||
using PQueue = std::priority_queue<std::pair<unsigned, unsigned>>;
|
||||
using SmallLISet = SmallPtrSet<LiveInterval *, 4>;
|
||||
using SmallVirtRegSet = SmallSet<unsigned, 16>;
|
||||
|
||||
// context
|
||||
MachineFunction *MF;
|
||||
@ -201,12 +229,12 @@ class RAGreedy : public MachineFunctionPass,
|
||||
|
||||
// RegInfo - Keep additional information about each live range.
|
||||
struct RegInfo {
|
||||
LiveRangeStage Stage;
|
||||
LiveRangeStage Stage = RS_New;
|
||||
|
||||
// Cascade - Eviction loop prevention. See canEvictInterference().
|
||||
unsigned Cascade;
|
||||
unsigned Cascade = 0;
|
||||
|
||||
RegInfo() : Stage(RS_New), Cascade(0) {}
|
||||
RegInfo() = default;
|
||||
};
|
||||
|
||||
IndexedMap<RegInfo, VirtReg2IndexFunctor> ExtraRegInfo;
|
||||
@ -232,10 +260,10 @@ class RAGreedy : public MachineFunctionPass,
|
||||
|
||||
/// Cost of evicting interference.
|
||||
struct EvictionCost {
|
||||
unsigned BrokenHints; ///< Total number of broken hints.
|
||||
float MaxWeight; ///< Maximum spill weight evicted.
|
||||
unsigned BrokenHints = 0; ///< Total number of broken hints.
|
||||
float MaxWeight = 0; ///< Maximum spill weight evicted.
|
||||
|
||||
EvictionCost(): BrokenHints(0), MaxWeight(0) {}
|
||||
EvictionCost() = default;
|
||||
|
||||
bool isMax() const { return BrokenHints == ~0u; }
|
||||
|
||||
@ -413,10 +441,12 @@ private:
|
||||
/// Its currently assigned register.
|
||||
/// In case of a physical register Reg == PhysReg.
|
||||
unsigned PhysReg;
|
||||
|
||||
HintInfo(BlockFrequency Freq, unsigned Reg, unsigned PhysReg)
|
||||
: Freq(Freq), Reg(Reg), PhysReg(PhysReg) {}
|
||||
};
|
||||
typedef SmallVector<HintInfo, 4> HintsInfo;
|
||||
using HintsInfo = SmallVector<HintInfo, 4>;
|
||||
|
||||
BlockFrequency getBrokenHintFreq(const HintsInfo &, unsigned);
|
||||
void collectHintInfo(unsigned, HintsInfo &);
|
||||
|
||||
@ -436,6 +466,7 @@ private:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char RAGreedy::ID = 0;
|
||||
@ -475,7 +506,6 @@ const char *const RAGreedy::StageName[] = {
|
||||
// This helps stabilize decisions based on float comparisons.
|
||||
const float Hysteresis = (2007 / 2048.0f); // 0.97998046875
|
||||
|
||||
|
||||
FunctionPass* llvm::createGreedyRegisterAllocator() {
|
||||
return new RAGreedy();
|
||||
}
|
||||
@ -511,7 +541,6 @@ void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// LiveRangeEdit delegate methods
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -634,7 +663,6 @@ LiveInterval *RAGreedy::dequeue(PQueue &CurQueue) {
|
||||
return LI;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Direct Assignment
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -682,7 +710,6 @@ unsigned RAGreedy::tryAssign(LiveInterval &VirtReg,
|
||||
return CheapReg ? CheapReg : PhysReg;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Interference eviction
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -954,7 +981,6 @@ unsigned RAGreedy::tryEvict(LiveInterval &VirtReg,
|
||||
return BestPhys;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Region Splitting
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1025,7 +1051,6 @@ bool RAGreedy::addSplitConstraints(InterferenceCache::Cursor Intf,
|
||||
return SpillPlacer->scanActiveBundles();
|
||||
}
|
||||
|
||||
|
||||
/// addThroughConstraints - Add constraints and links to SpillPlacer from the
|
||||
/// live-through blocks in Blocks.
|
||||
void RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
|
||||
@ -1083,7 +1108,7 @@ void RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
|
||||
unsigned Visited = 0;
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
while (true) {
|
||||
ArrayRef<unsigned> NewBundles = SpillPlacer->getRecentPositive();
|
||||
// Find new through blocks in the periphery of PrefRegBundles.
|
||||
for (int i = 0, e = NewBundles.size(); i != e; ++i) {
|
||||
@ -1197,8 +1222,8 @@ BlockFrequency RAGreedy::calcGlobalSplitCost(GlobalSplitCandidate &Cand) {
|
||||
for (unsigned i = 0; i != UseBlocks.size(); ++i) {
|
||||
const SplitAnalysis::BlockInfo &BI = UseBlocks[i];
|
||||
SpillPlacement::BlockConstraint &BC = SplitConstraints[i];
|
||||
bool RegIn = LiveBundles[Bundles->getBundle(BC.Number, 0)];
|
||||
bool RegOut = LiveBundles[Bundles->getBundle(BC.Number, 1)];
|
||||
bool RegIn = LiveBundles[Bundles->getBundle(BC.Number, false)];
|
||||
bool RegOut = LiveBundles[Bundles->getBundle(BC.Number, true)];
|
||||
unsigned Ins = 0;
|
||||
|
||||
if (BI.LiveIn)
|
||||
@ -1211,8 +1236,8 @@ BlockFrequency RAGreedy::calcGlobalSplitCost(GlobalSplitCandidate &Cand) {
|
||||
|
||||
for (unsigned i = 0, e = Cand.ActiveBlocks.size(); i != e; ++i) {
|
||||
unsigned Number = Cand.ActiveBlocks[i];
|
||||
bool RegIn = LiveBundles[Bundles->getBundle(Number, 0)];
|
||||
bool RegOut = LiveBundles[Bundles->getBundle(Number, 1)];
|
||||
bool RegIn = LiveBundles[Bundles->getBundle(Number, false)];
|
||||
bool RegOut = LiveBundles[Bundles->getBundle(Number, true)];
|
||||
if (!RegIn && !RegOut)
|
||||
continue;
|
||||
if (RegIn && RegOut) {
|
||||
@ -1264,7 +1289,7 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
|
||||
unsigned IntvIn = 0, IntvOut = 0;
|
||||
SlotIndex IntfIn, IntfOut;
|
||||
if (BI.LiveIn) {
|
||||
unsigned CandIn = BundleCand[Bundles->getBundle(Number, 0)];
|
||||
unsigned CandIn = BundleCand[Bundles->getBundle(Number, false)];
|
||||
if (CandIn != NoCand) {
|
||||
GlobalSplitCandidate &Cand = GlobalCand[CandIn];
|
||||
IntvIn = Cand.IntvIdx;
|
||||
@ -1273,7 +1298,7 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
|
||||
}
|
||||
}
|
||||
if (BI.LiveOut) {
|
||||
unsigned CandOut = BundleCand[Bundles->getBundle(Number, 1)];
|
||||
unsigned CandOut = BundleCand[Bundles->getBundle(Number, true)];
|
||||
if (CandOut != NoCand) {
|
||||
GlobalSplitCandidate &Cand = GlobalCand[CandOut];
|
||||
IntvOut = Cand.IntvIdx;
|
||||
@ -1313,7 +1338,7 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
|
||||
unsigned IntvIn = 0, IntvOut = 0;
|
||||
SlotIndex IntfIn, IntfOut;
|
||||
|
||||
unsigned CandIn = BundleCand[Bundles->getBundle(Number, 0)];
|
||||
unsigned CandIn = BundleCand[Bundles->getBundle(Number, false)];
|
||||
if (CandIn != NoCand) {
|
||||
GlobalSplitCandidate &Cand = GlobalCand[CandIn];
|
||||
IntvIn = Cand.IntvIdx;
|
||||
@ -1321,7 +1346,7 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
|
||||
IntfIn = Cand.Intf.first();
|
||||
}
|
||||
|
||||
unsigned CandOut = BundleCand[Bundles->getBundle(Number, 1)];
|
||||
unsigned CandOut = BundleCand[Bundles->getBundle(Number, true)];
|
||||
if (CandOut != NoCand) {
|
||||
GlobalSplitCandidate &Cand = GlobalCand[CandOut];
|
||||
IntvOut = Cand.IntvIdx;
|
||||
@ -1533,7 +1558,6 @@ unsigned RAGreedy::doRegionSplit(LiveInterval &VirtReg, unsigned BestCand,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Per-Block Splitting
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1580,7 +1604,6 @@ unsigned RAGreedy::tryBlockSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Per-Instruction Splitting
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1664,12 +1687,10 @@ RAGreedy::tryInstructionSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Local Splitting
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
/// calcGapWeights - Compute the maximum spill weight that needs to be evicted
|
||||
/// in order to use PhysReg between two entries in SA->UseSlots.
|
||||
///
|
||||
@ -1740,7 +1761,7 @@ void RAGreedy::calcGapWeights(unsigned PhysReg,
|
||||
break;
|
||||
|
||||
for (; Gap != NumGaps; ++Gap) {
|
||||
GapWeight[Gap] = llvm::huge_valf;
|
||||
GapWeight[Gap] = huge_valf;
|
||||
if (Uses[Gap+1].getBaseIndex() >= I->end)
|
||||
break;
|
||||
}
|
||||
@ -1846,7 +1867,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
||||
// Remove any gaps with regmask clobbers.
|
||||
if (Matrix->checkRegMaskInterference(VirtReg, PhysReg))
|
||||
for (unsigned i = 0, e = RegMaskGaps.size(); i != e; ++i)
|
||||
GapWeight[RegMaskGaps[i]] = llvm::huge_valf;
|
||||
GapWeight[RegMaskGaps[i]] = huge_valf;
|
||||
|
||||
// Try to find the best sequence of gaps to close.
|
||||
// The new spill weight must be larger than any gap interference.
|
||||
@ -1858,7 +1879,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
||||
// It is the spill weight that needs to be evicted.
|
||||
float MaxGap = GapWeight[0];
|
||||
|
||||
for (;;) {
|
||||
while (true) {
|
||||
// Live before/after split?
|
||||
const bool LiveBefore = SplitBefore != 0 || BI.LiveIn;
|
||||
const bool LiveAfter = SplitAfter != NumGaps || BI.LiveOut;
|
||||
@ -1881,7 +1902,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
||||
// Legally, without causing looping?
|
||||
bool Legal = !ProgressRequired || NewGaps < NumGaps;
|
||||
|
||||
if (Legal && MaxGap < llvm::huge_valf) {
|
||||
if (Legal && MaxGap < huge_valf) {
|
||||
// Estimate the new spill weight. Each instruction reads or writes the
|
||||
// register. Conservatively assume there are no read-modify-write
|
||||
// instructions.
|
||||
@ -2680,6 +2701,7 @@ void RAGreedy::reportNumberOfSplillsReloads(MachineLoop *L, unsigned &Reloads,
|
||||
|
||||
if (Reloads || FoldedReloads || Spills || FoldedSpills) {
|
||||
using namespace ore;
|
||||
|
||||
MachineOptimizationRemarkMissed R(DEBUG_TYPE, "LoopSpillReload",
|
||||
L->getStartLoc(), L->getHeader());
|
||||
if (Spills)
|
||||
|
@ -12,11 +12,22 @@
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/RegisterUsageInfo.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -63,7 +74,7 @@ PhysicalRegisterUsageInfo::getRegUsageInfo(const Function *FP) {
|
||||
void PhysicalRegisterUsageInfo::print(raw_ostream &OS, const Module *M) const {
|
||||
const TargetRegisterInfo *TRI;
|
||||
|
||||
typedef std::pair<const Function *, std::vector<uint32_t>> FuncPtrRegMaskPair;
|
||||
using FuncPtrRegMaskPair = std::pair<const Function *, std::vector<uint32_t>>;
|
||||
|
||||
SmallVector<const FuncPtrRegMaskPair *, 64> FPRMPairVector;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===----- TargetFrameLoweringImpl.cpp - Implement target frame interface --==//
|
||||
//===- TargetFrameLoweringImpl.cpp - Implement target frame interface ------==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,19 +14,21 @@
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Target/TargetFrameLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
TargetFrameLowering::~TargetFrameLowering() {
|
||||
}
|
||||
TargetFrameLowering::~TargetFrameLowering() = default;
|
||||
|
||||
/// The default implementation just looks at attribute "no-frame-pointer-elim".
|
||||
bool TargetFrameLowering::noFramePointerElim(const MachineFunction &MF) const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- XRayInstrumentation.cpp - Adds XRay instrumentation to functions. -===//
|
||||
//===- XRayInstrumentation.cpp - Adds XRay instrumentation to functions. --===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,20 +14,26 @@
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/Analysis.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
struct XRayInstrumentation : public MachineFunctionPass {
|
||||
static char ID;
|
||||
|
||||
@ -66,7 +72,8 @@ private:
|
||||
void prependRetWithPatchableExit(MachineFunction &MF,
|
||||
const TargetInstrInfo *TII);
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
void XRayInstrumentation::replaceRetWithPatchableRet(
|
||||
MachineFunction &MF, const TargetInstrInfo *TII) {
|
||||
@ -144,8 +151,8 @@ bool XRayInstrumentation::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
// We look for the first non-empty MachineBasicBlock, so that we can insert
|
||||
// the function instrumentation in the appropriate place.
|
||||
auto MBI =
|
||||
find_if(MF, [&](const MachineBasicBlock &MBB) { return !MBB.empty(); });
|
||||
auto MBI = llvm::find_if(
|
||||
MF, [&](const MachineBasicBlock &MBB) { return !MBB.empty(); });
|
||||
if (MBI == MF.end())
|
||||
return false; // The function is empty.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- Thumb2InstrInfo.cpp - Thumb-2 Instruction Information -------------===//
|
||||
//===- Thumb2InstrInfo.cpp - Thumb-2 Instruction Information --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,16 +11,26 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Thumb2InstrInfo.h"
|
||||
#include "ARMConstantPoolValue.h"
|
||||
#include "ARMMachineFunctionInfo.h"
|
||||
#include "MCTargetDesc/ARMAddressingModes.h"
|
||||
#include "Thumb2InstrInfo.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/CodeGen/MachineOperand.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include <cassert>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -30,7 +40,7 @@ OldT2IfCvt("old-thumb2-ifcvt", cl::Hidden,
|
||||
cl::init(false));
|
||||
|
||||
Thumb2InstrInfo::Thumb2InstrInfo(const ARMSubtarget &STI)
|
||||
: ARMBaseInstrInfo(STI), RI() {}
|
||||
: ARMBaseInstrInfo(STI) {}
|
||||
|
||||
/// Return the noop instruction to use for a noop.
|
||||
void Thumb2InstrInfo::getNoop(MCInst &NopInst) const {
|
||||
@ -539,9 +549,7 @@ bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
|
||||
// Add cc_out operand if the original instruction did not have one.
|
||||
if (!HasCCOut)
|
||||
MI.addOperand(MachineOperand::CreateReg(0, false));
|
||||
|
||||
} else {
|
||||
|
||||
// AddrMode4 and AddrMode6 cannot handle any offset.
|
||||
if (AddrMode == ARMII::AddrMode4 || AddrMode == ARMII::AddrMode6)
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user