File: ExtensionFuncsAnalysis.hpp

package info (click to toggle)
intel-graphics-compiler2 2.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 106,644 kB
  • sloc: cpp: 805,640; lisp: 287,672; ansic: 16,414; python: 3,952; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (73 lines) | stat: -rw-r--r-- 2,735 bytes parent folder | download
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
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2022 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#pragma once

#include "Compiler/MetaDataUtilsWrapper.h"

#include "common/LLVMWarningsPush.hpp"
#include <llvm/Pass.h>
#include <llvm/IR/InstVisitor.h>
#include <llvm/ADT/StringRef.h>
#include "common/LLVMWarningsPop.hpp"

namespace IGC {
/// @brief  ExtensionFuncsAnalysis pass used for analyzing if VME functions are used in the
///         different functions in the module and creating metadata that represents
///         the implicit information needed by each function for resolving these function calls

class ExtensionFuncsAnalysis : public llvm::ModulePass, public llvm::InstVisitor<ExtensionFuncsAnalysis> {
public:
  // Pass identification, replacement for typeid
  static char ID;

  /// @brief  Constructor
  ExtensionFuncsAnalysis();

  /// @brief  Destructor
  ~ExtensionFuncsAnalysis() {}

  /// @brief  Provides name of pass
  virtual llvm::StringRef getPassName() const override { return "ExtensionFuncsAnalysis"; }

  void getAnalysisUsage(llvm::AnalysisUsage &AU) const override { AU.addRequired<MetaDataUtilsWrapper>(); }

  /// @brief  Main entry point.
  ///         Runs on all functions defined in the given module, finds all VME function calls,
  ///         analyzes them and creates metadata that represents the implicit information needed
  ///         by each function for resolving these function calls
  /// @param  M The destination module.
  virtual bool runOnModule(llvm::Module &M) override;

  /// @brief  Function entry point.
  ///         Finds all VME function calls in this function, analyzes them and creates
  ///         metadata that represents the implicit information needed by this function
  ///         for resolving these function calls
  /// @param  F The destination function.
  bool runOnFunction(llvm::Function &F);

  /// @brief  Call instructions visitor.
  ///         Checks for VME functions and analyzes it
  /// @param  CI The call instruction.
  void visitCallInst(llvm::CallInst &CI);

  static const llvm::StringRef VME_MB_BLOCK_TYPE;
  static const llvm::StringRef VME_SUBPIXEL_MODE;
  static const llvm::StringRef VME_SAD_ADJUST_MODE;
  static const llvm::StringRef VME_SEARCH_PATH_TYPE;
  static const llvm::StringRef VME_HELPER_GET_HANDLE;
  static const llvm::StringRef VME_HELPER_GET_AS;

private:
  /// @brief  Marks whether VME information is needed by the current function
  bool m_hasVME{};
  /// @brief  MetaData utils used to generate LLVM metadata
  IGCMD::MetaDataUtils *m_pMDUtils = nullptr;
};

} // namespace IGC