//===- SIInsertHardClauses.cpp - Insert Hard Clauses ----------------------===// // // 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 /// Insert s_clause instructions to form hard clauses. /// /// Clausing load instructions can give cache coherency benefits. Before gfx10, /// the hardware automatically detected "soft clauses", which were sequences of /// memory instructions of the same type. In gfx10 this detection was removed, /// and the s_clause instruction was introduced to explicitly mark "hard /// clauses". /// /// It's the scheduler's job to form the clauses by putting similar memory /// instructions next to each other. Our job is just to insert an s_clause /// instruction to mark the start of each clause. /// /// Note that hard clauses are very similar to, but logically distinct from, the /// groups of instructions that have to be restartable when XNACK is enabled. /// The rules are slightly different in each case. For example an s_nop /// instruction breaks a restartable group, but can appear in the middle of a /// hard clause. (Before gfx10 there wasn't a distinction, and both were called /// "soft clauses" or just "clauses".) /// /// The SIFormMemoryClauses pass and GCNHazardRecognizer deal with restartable /// groups, not hard clauses. // //===----------------------------------------------------------------------===// #include "AMDGPU.h" #include "GCNSubtarget.h" #include "MCTargetDesc/AMDGPUMCTargetDesc.h" #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" usingnamespacellvm; #define DEBUG_TYPE … namespace { enum HardClauseType { … }; class SIInsertHardClauses : public MachineFunctionPass { … }; } // namespace char SIInsertHardClauses::ID = …; char &llvm::SIInsertHardClausesID = …; INITIALIZE_PASS(…)