1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/*========================== begin_copyright_notice ============================
Copyright (C) 2021 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
/**
* @file getCacheOpts.h
*
* @section DESCRIPTION
*
* This file contains declarations of utility functions which return the cache options
* for a given load or store instruction.
*/
#pragma once
#include "visa_igc_common_header.h" // for LSC_L1_L3_CC
#include "common/LLVMWarningsPush.hpp" // for suppressing LLVM warnings
#include "llvm/ADT/Optional.h" // for llvm::Optional
#include "llvm/IR/Instructions.h" // for llvm::StoreInst, llvm::LoadInst
#include "common/LLVMWarningsPop.hpp" // for suppressing LLVM warnings
#include "Compiler/CodeGenPublic.h"
namespace IGC {
/**
* @param Ptr Pointer to memory
* @param Ctx Context
*
* @return Optional containing the cache options for that particular store instruction
* if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
* or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
*/
llvm::Optional<LSC_L1_L3_CC> getCacheOptsStorePolicy(
const llvm::Value* Ptr,
const CodeGenContext &Ctx);
/**
* @param storeInst LLVM IR store instruction
* @param Ctx Context
*
* @return Optional containing the cache options for that particular store instruction
* if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
* or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
*/
llvm::Optional<LSC_L1_L3_CC> getCacheOptsStorePolicy(
const llvm::StoreInst& storeInst,
const CodeGenContext &Ctx);
/**
* @param Ptr Pointer to memory
* @param Ctx Context
*
* @return Optional containing the cache options for that particular load instruction
* if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
* or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
*/
llvm::Optional<LSC_L1_L3_CC> getCacheOptsLoadPolicy(
const llvm::Value* Ptr,
const CodeGenContext &Ctx);
/**
* @param loadInst LLVM IR load instruction
* @param Ctx Context
*
* @return Optional containing the cache options for that particular load instruction
* if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
* or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
*/
llvm::Optional<LSC_L1_L3_CC> getCacheOptsLoadPolicy(
const llvm::LoadInst& loadInst,
const CodeGenContext &Ctx);
/**
* @return the store cache policy for the RTStack
*/
LSC_L1_L3_CC RTStackStorePolicy();
/**
* @return the store cache policy for the SWHotZone
*/
LSC_L1_L3_CC SWHotZoneStorePolicy();
/**
* @return the store cache policy for the SWStack
*/
LSC_L1_L3_CC SWStackStorePolicy(const CodeGenContext &Ctx);
/**
* @return the load cache policy for the RTStack
*/
LSC_L1_L3_CC RTStackLoadPolicy();
/**
* @return the load cache policy for the SWHotZone
*/
LSC_L1_L3_CC SWHotZoneLoadPolicy();
/**
* @return the load cache policy for the SWStack
*/
LSC_L1_L3_CC SWStackLoadPolicy();
} // namespace IGC
|