File: GenXAnalysis.h

package info (click to toggle)
intel-graphics-compiler 1.0.12504.6-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 83,912 kB
  • sloc: cpp: 910,147; lisp: 202,655; ansic: 15,197; python: 4,025; yacc: 2,241; lex: 1,570; pascal: 244; sh: 104; makefile: 25
file content (81 lines) | stat: -rw-r--r-- 2,961 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
74
75
76
77
78
79
80
81
/*========================== begin_copyright_notice ============================

Copyright (C) 2019-2022 Intel Corporation

SPDX-License-Identifier: MIT

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

//
// This file declares some hooks that are injected into llvm analysis library
// files to make them work with genx related stuff.
//
//===----------------------------------------------------------------------===//


#ifndef VC_GENXOPTS_GENXANALYSIS_H
#define VC_GENXOPTS_GENXANALYSIS_H

namespace llvm {

template <typename T> class ArrayRef;
class CallInst;
class Constant;
class DataLayout;
class Instruction;
class ImmutableCallSite;
class Type;
class Use;
class Value;
class Function;

/// canConstantFoldGenXIntrinsic - Return true if it is even possible to fold
/// a call to the specified GenX intrinsic.
bool canConstantFoldGenXIntrinsic(unsigned IID);

/// ConstantFoldGenXIntrinsic - Attempt to constant fold a call to the
/// specified GenX intrinsic with the specified arguments, returning null if
/// unsuccessful.
Constant *ConstantFoldGenXIntrinsic(unsigned IID, Type *RetTy,
                                    ArrayRef<Constant *> Operands,
                                    Instruction *CSInst, const DataLayout &DL);

/// ConstantFoldGenX - Attempt to constant fold genx-related instruction (intrinsic).
/// This function tries to fold operands and then tries to fold instruction
/// itself. Returns nullptr if folding was unsuccessful.
Constant *ConstantFoldGenX(Instruction *I, const DataLayout &DL);

/// Given a GenX intrinsic and a set of arguments, see if we can fold the
/// result.
///
/// If this call could not be simplified returns null.
Value *SimplifyGenXIntrinsic(unsigned IID, Type *RetTy, Use *ArgBegin,
                             Use *ArgEnd, const DataLayout &DL);

/// Given a GenX related instruction, see if we can fold the
/// result. This function tries simplification and then constant folding.
///
/// If this instruction could not be simplified returns null.
Value *SimplifyGenX(CallInst *I, const DataLayout &DL);

// simplifyWritesWithUndefInput - removes write instrinsics (currently wrregion,
// wrpredregion) that have undef as input value, replaces all uses with the old
// value. If this replacement produced new context (write intrinsic's input
// value was replaced with undef), those writes are cleaned up too. No writes
// with undef input should be left in the function \p F as the result.
//
// Returns whether the function was modified.
bool simplifyWritesWithUndefInput(Function &F);

//===----------------------------------------------------------------------===//
//
// getValueAlignmentInBytes - calculate alignment of value
// used in CMKernelArgOffset and GenXLiveness analysis
// defined in CMKernelArgOffset
//

unsigned getValueAlignmentInBytes(const Value &Val, const DataLayout &DL);

} // end namespace llvm

#endif // VC_GENXOPTS_GENXANALYSIS_H