//===-- StackFrameLayoutAnalysisPass.cpp //------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // StackFrameLayoutAnalysisPass implementation. Outputs information about the // layout of the stack frame, using the remarks interface. On the CLI it prints // a textual representation of the stack frame. When possible it prints the // values that occupy a stack slot using any available debug information. Since // output is remarks based, it is also available in a machine readable file // format, such as YAML. // //===----------------------------------------------------------------------===// #include "llvm/ADT/SetVector.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/StackProtector.h" #include "llvm/CodeGen/TargetFrameLowering.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/PrintPasses.h" #include "llvm/InitializePasses.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/raw_ostream.h" #include <sstream> usingnamespacellvm; #define DEBUG_TYPE … namespace { /// StackFrameLayoutAnalysisPass - This is a pass to dump the stack frame of a /// MachineFunction. /// struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { … }; char StackFrameLayoutAnalysisPass::ID = …; } // namespace char &llvm::StackFrameLayoutAnalysisPassID = …; INITIALIZE_PASS(…) namespace llvm { /// Returns a newly-created StackFrameLayout pass. MachineFunctionPass *createStackFrameLayoutAnalysisPass() { … } } // namespace llvm