//===--- WebAssemblyOptimizeLiveIntervals.cpp - LiveInterval processing ---===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// Optimize LiveIntervals for use in a post-RA context. // /// LiveIntervals normally runs before register allocation when the code is /// only recently lowered out of SSA form, so it's uncommon for registers to /// have multiple defs, and when they do, the defs are usually closely related. /// Later, after coalescing, tail duplication, and other optimizations, it's /// more common to see registers with multiple unrelated defs. This pass /// updates LiveIntervals to distribute the value numbers across separate /// LiveIntervals. /// //===----------------------------------------------------------------------===// #include "WebAssembly.h" #include "WebAssemblyMachineFunctionInfo.h" #include "WebAssemblySubtarget.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/MachineBlockFrequencyInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" usingnamespacellvm; #define DEBUG_TYPE … namespace { class WebAssemblyOptimizeLiveIntervals final : public MachineFunctionPass { … }; } // end anonymous namespace char WebAssemblyOptimizeLiveIntervals::ID = …; INITIALIZE_PASS(…) FunctionPass *llvm::createWebAssemblyOptimizeLiveIntervals() { … } bool WebAssemblyOptimizeLiveIntervals::runOnMachineFunction( MachineFunction &MF) { … }