diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCLinkerOptimizationHint.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/ARM64/ARM64AsmPrinter.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Target/ARM64/ARM64MachineFunctionInfo.h | 29 |
3 files changed, 25 insertions, 25 deletions
diff --git a/llvm/lib/MC/MCLinkerOptimizationHint.cpp b/llvm/lib/MC/MCLinkerOptimizationHint.cpp index 628a6156fd8..dceda68433e 100644 --- a/llvm/lib/MC/MCLinkerOptimizationHint.cpp +++ b/llvm/lib/MC/MCLinkerOptimizationHint.cpp @@ -14,8 +14,6 @@ using namespace llvm; -namespace llvm { -template<> void MCLOHDirective::Emit_impl(raw_ostream &OutStream, const MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const { @@ -27,4 +25,3 @@ void MCLOHDirective::Emit_impl(raw_ostream &OutStream, encodeULEB128(ObjWriter.getSymbolAddress(&Asm.getSymbolData(**It), Layout), OutStream); } -} // end namespace llvm diff --git a/llvm/lib/Target/ARM64/ARM64AsmPrinter.cpp b/llvm/lib/Target/ARM64/ARM64AsmPrinter.cpp index d01108d259d..d0aa6af9c0c 100644 --- a/llvm/lib/Target/ARM64/ARM64AsmPrinter.cpp +++ b/llvm/lib/Target/ARM64/ARM64AsmPrinter.cpp @@ -135,26 +135,16 @@ ARM64AsmPrinter::getDebugValueLocation(const MachineInstr *MI) const { } void ARM64AsmPrinter::EmitLOHs() { - const ARM64FunctionInfo::MILOHDirectives &LOHs = - const_cast<const ARM64FunctionInfo *>(ARM64FI) - ->getLOHContainer() - .getDirectives(); SmallVector<MCSymbol *, 3> MCArgs; - for (ARM64FunctionInfo::MILOHDirectives::const_iterator It = LOHs.begin(), - EndIt = LOHs.end(); - It != EndIt; ++It) { - const ARM64FunctionInfo::MILOHArgs &MIArgs = It->getArgs(); - for (ARM64FunctionInfo::MILOHArgs::const_iterator - MIArgsIt = MIArgs.begin(), - EndMIArgsIt = MIArgs.end(); - MIArgsIt != EndMIArgsIt; ++MIArgsIt) { - MInstToMCSymbol::iterator LabelIt = LOHInstToLabel.find(*MIArgsIt); + for (const auto &D : ARM64FI->getLOHContainer()) { + for (const MachineInstr *MI : D.getArgs()) { + MInstToMCSymbol::iterator LabelIt = LOHInstToLabel.find(MI); assert(LabelIt != LOHInstToLabel.end() && "Label hasn't been inserted for LOH related instruction"); MCArgs.push_back(LabelIt->second); } - OutStreamer.EmitLOHDirective(It->getKind(), MCArgs); + OutStreamer.EmitLOHDirective(D.getKind(), MCArgs); MCArgs.clear(); } } diff --git a/llvm/lib/Target/ARM64/ARM64MachineFunctionInfo.h b/llvm/lib/Target/ARM64/ARM64MachineFunctionInfo.h index 59538ea40e9..02bf7cf6fd0 100644 --- a/llvm/lib/Target/ARM64/ARM64MachineFunctionInfo.h +++ b/llvm/lib/Target/ARM64/ARM64MachineFunctionInfo.h @@ -100,20 +100,33 @@ public: const SetOfInstructions &getLOHRelated() const { return LOHRelated; } // Shortcuts for LOH related types. - typedef LOHDirective<const MachineInstr> MILOHDirective; - typedef MILOHDirective::LOHArgs MILOHArgs; + class MILOHDirective { + MCLOHType Kind; + + /// Arguments of this directive. Order matters. + SmallVector<const MachineInstr *, 3> Args; + + public: + typedef SmallVectorImpl<const MachineInstr *> LOHArgs; - typedef LOHContainer<const MachineInstr> MILOHContainer; - typedef MILOHContainer::LOHDirectives MILOHDirectives; + MILOHDirective(MCLOHType Kind, const LOHArgs &Args) + : Kind(Kind), Args(Args.begin(), Args.end()) { + assert(isValidMCLOHType(Kind) && "Invalid LOH directive type!"); + } + + MCLOHType getKind() const { return Kind; } + const LOHArgs &getArgs() const { return Args; } + }; + + typedef MILOHDirective::LOHArgs MILOHArgs; + typedef SmallVector<MILOHDirective, 32> MILOHContainer; const MILOHContainer &getLOHContainer() const { return LOHContainerSet; } /// Add a LOH directive of this @p Kind and this @p Args. void addLOHDirective(MCLOHType Kind, const MILOHArgs &Args) { - LOHContainerSet.addDirective(Kind, Args); - for (MILOHArgs::const_iterator It = Args.begin(), EndIt = Args.end(); - It != EndIt; ++It) - LOHRelated.insert(*It); + LOHContainerSet.push_back(MILOHDirective(Kind, Args)); + LOHRelated.insert(Args.begin(), Args.end()); } private: |