HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Android 10
|
10.0.0_r6
下载
查看原文件
收藏
根目录
prebuilts
clang
host
darwin-x86
clang-r346389c
include
llvm
CodeGen
ReachingDefAnalysis.h
//==--- llvm/CodeGen/ReachingDefAnalysis.h - Reaching Def Analysis -*- C++ -*---==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // /// \file Reaching Defs Analysis pass. /// /// This pass tracks for each instruction what is the closest reaching def of /// a given register. It is used by BreakFalseDeps (for clearance calculation) /// and ExecutionDomainFix (for arbitrating conflicting domains). /// /// Note that this is different from the usual definition notion of liveness. /// The CPU doesn't care whether or not we consider a register killed. /// // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_REACHINGDEFSANALYSIS_H #define LLVM_CODEGEN_REACHINGDEFSANALYSIS_H #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/LoopTraversal.h" #include "llvm/CodeGen/MachineFunctionPass.h" namespace llvm { class MachineBasicBlock; class MachineInstr; /// This class provides the reaching def analysis. class ReachingDefAnalysis : public MachineFunctionPass { private: MachineFunction *MF; const TargetRegisterInfo *TRI; unsigned NumRegUnits; /// Instruction that defined each register, relative to the beginning of the /// current basic block. When a LiveRegsDefInfo is used to represent a /// live-out register, this value is relative to the end of the basic block, /// so it will be a negative number. using LiveRegsDefInfo = std::vector
; LiveRegsDefInfo LiveRegs; /// Keeps clearance information for all registers. Note that this /// is different from the usual definition notion of liveness. The CPU /// doesn't care whether or not we consider a register killed. using OutRegsInfoMap = SmallVector
; OutRegsInfoMap MBBOutRegsInfos; /// Current instruction number. /// The first instruction in each basic block is 0. int CurInstr; /// Maps instructions to their instruction Ids, relative to the begining of /// their basic blocks. DenseMap
InstIds; /// All reaching defs of a given RegUnit for a given MBB. using MBBRegUnitDefs = SmallVector
; /// All reaching defs of all reg units for a given MBB using MBBDefsInfo = std::vector
; /// All reaching defs of all reg units for a all MBBs using MBBReachingDefsInfo = SmallVector
; MBBReachingDefsInfo MBBReachingDefs; /// Default values are 'nothing happened a long time ago'. const int ReachingDefDefaultVal = -(1 << 20); public: static char ID; // Pass identification, replacement for typeid ReachingDefAnalysis() : MachineFunctionPass(ID) { initializeReachingDefAnalysisPass(*PassRegistry::getPassRegistry()); } void releaseMemory() override; void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); } bool runOnMachineFunction(MachineFunction &MF) override; MachineFunctionProperties getRequiredProperties() const override { return MachineFunctionProperties().set( MachineFunctionProperties::Property::NoVRegs); } /// Provides the instruction id of the closest reaching def instruction of /// PhysReg that reaches MI, relative to the begining of MI's basic block. int getReachingDef(MachineInstr *MI, int PhysReg); /// Provides the clearance - the number of instructions since the closest /// reaching def instuction of PhysReg that reaches MI. int getClearance(MachineInstr *MI, MCPhysReg PhysReg); private: /// Set up LiveRegs by merging predecessor live-out values. void enterBasicBlock(const LoopTraversal::TraversedMBBInfo &TraversedMBB); /// Update live-out values. void leaveBasicBlock(const LoopTraversal::TraversedMBBInfo &TraversedMBB); /// Process he given basic block. void processBasicBlock(const LoopTraversal::TraversedMBBInfo &TraversedMBB); /// Update def-ages for registers defined by MI. /// Also break dependencies on partial defs and undef uses. void processDefs(MachineInstr *); }; } // namespace llvm #endif // LLVM_CODEGEN_REACHINGDEFSANALYSIS_H
C++程序
|
119行
|
4.23 KB
原始内容
高亮显示
复制内容
×
已收藏
收藏成功,您可以在我收藏的代码页面中查看,其地址为:
https://www.androidos.net.cn/my/collect/code
。
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册