//===-- InstructionPrecedenceTracking.h -------------------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// // Implements a class that is able to define some instructions as "special" // (e.g. as having implicit control flow, or writing memory, or having another // interesting property) and then efficiently answers queries of the types: // 1. Are there any special instructions in the block of interest? // 2. Return first of the special instructions in the given block; // 3. Check if the given instruction is preceeded by the first special // instruction in the same block. // The class provides caching that allows to answer these queries quickly. The // user must make sure that the cached data is invalidated properly whenever // a content of some tracked block is changed. //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_INSTRUCTIONPRECEDENCETRACKING_H #define LLVM_ANALYSIS_INSTRUCTIONPRECEDENCETRACKING_H #include "llvm/ADT/DenseMap.h" namespace llvm { class BasicBlock; class Instruction; class InstructionPrecedenceTracking { … }; /// This class allows to keep track on instructions with implicit control flow. /// These are instructions that may not pass execution to their successors. For /// example, throwing calls and guards do not always do this. If we need to know /// for sure that some instruction is guaranteed to execute if the given block /// is reached, then we need to make sure that there is no implicit control flow /// instruction (ICFI) preceding it. For example, this check is required if we /// perform PRE moving non-speculable instruction to other place. class ImplicitControlFlowTracking : public InstructionPrecedenceTracking { … }; class MemoryWriteTracking : public InstructionPrecedenceTracking { … }; } // llvm #endif // LLVM_ANALYSIS_INSTRUCTIONPRECEDENCETRACKING_H