File: TypesLegalizationPass.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 (46 lines) | stat: -rw-r--r-- 1,924 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
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2021 Intel Corporation

SPDX-License-Identifier: MIT

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

#pragma once

#include "common/LLVMWarningsPush.hpp"
#include <llvm/IR/InstVisitor.h>
#include <llvmWrapper/IR/IRBuilder.h>
#include "common/LLVMWarningsPop.hpp"
#include "Compiler/IGCPassSupport.h"

class TypesLegalizationPass : public llvm::FunctionPass, public llvm::InstVisitor<TypesLegalizationPass> {

public:
  TypesLegalizationPass();
  ~TypesLegalizationPass() {}

  virtual llvm::StringRef getPassName() const override { return "Types Legalization Pass"; }

  bool LegalizeTypes();
  virtual bool runOnFunction(llvm::Function &function) override;
  void visitStoreInst(llvm::StoreInst &I);
  void visitExtractValueInst(llvm::ExtractValueInst &I);
  void visitPHINode(llvm::PHINode &I);
  void ResolveStoreInst(llvm::StoreInst *st);
  void ResolvePhiNode(llvm::PHINode *phi);
  void ResolveExtractValue(llvm::ExtractValueInst *extractVal);
  void ResolveStoreInst(llvm::StoreInst *st, llvm::Type *ty, llvm::SmallVector<unsigned, 8> &index);
  bool CheckNullArray(llvm::Instruction *storeInst);
  llvm::Value *ResolveValue(llvm::Instruction *st, llvm::Value *arg, llvm::SmallVector<unsigned, 8> &index);
  llvm::Value *CreateGEP(IGCLLVM::IRBuilder<> &builder, llvm::Type *Ty, llvm::Value *ptr,
                         llvm::SmallVector<unsigned, 8> &indices);
  llvm::Value *CreateGEP(IGCLLVM::IRBuilder<> &builder, llvm::Value *ptr, llvm::SmallVector<unsigned, 8> &indices);
  llvm::AllocaInst *CreateAlloca(llvm::Instruction *phi);

  static char ID;
  llvm::SmallVector<llvm::StoreInst *, 10> m_StoreInst;
  llvm::SmallVector<llvm::ExtractValueInst *, 10> m_ExtractValueInst;
  llvm::SmallVector<llvm::PHINode *, 10> m_PhiNodes;
  llvm::SmallVector<unsigned, 8> Indicies;
};