10b57cec5SDimitry Andric //===- llvm/CodeGen/MachineModuleInfoImpls.cpp ----------------------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file implements object-file format specific implementations of 100b57cec5SDimitry Andric // MachineModuleInfoImpl. 110b57cec5SDimitry Andric // 120b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #include "llvm/CodeGen/MachineModuleInfoImpls.h" 150b57cec5SDimitry Andric #include "llvm/ADT/DenseMap.h" 160b57cec5SDimitry Andric #include "llvm/MC/MCSymbol.h" 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric using namespace llvm; 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 210b57cec5SDimitry Andric // MachineModuleInfoMachO 220b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 230b57cec5SDimitry Andric 240b57cec5SDimitry Andric // Out of line virtual method. 250b57cec5SDimitry Andric void MachineModuleInfoMachO::anchor() {} 260b57cec5SDimitry Andric void MachineModuleInfoELF::anchor() {} 270b57cec5SDimitry Andric void MachineModuleInfoCOFF::anchor() {} 28*fe6060f1SDimitry Andric void MachineModuleInfoWasm::anchor() {} 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>; 310b57cec5SDimitry Andric static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) { 320b57cec5SDimitry Andric return LHS->first->getName().compare(RHS->first->getName()); 330b57cec5SDimitry Andric } 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs( 360b57cec5SDimitry Andric DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) { 370b57cec5SDimitry Andric MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end()); 380b57cec5SDimitry Andric 390b57cec5SDimitry Andric array_pod_sort(List.begin(), List.end(), SortSymbolPair); 400b57cec5SDimitry Andric 410b57cec5SDimitry Andric Map.clear(); 420b57cec5SDimitry Andric return List; 430b57cec5SDimitry Andric } 44