RelaxedPrecisionVisitor.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //===--- RelaxedPrecisionVisitor.h - RelaxedPrecision Visitor ----*- C++ -*-==//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef LLVM_CLANG_LIB_SPIRV_RELAXEDPRECISIONVISITOR_H
  10. #define LLVM_CLANG_LIB_SPIRV_RELAXEDPRECISIONVISITOR_H
  11. #include "clang/SPIRV/SpirvContext.h"
  12. #include "clang/SPIRV/SpirvVisitor.h"
  13. namespace clang {
  14. namespace spirv {
  15. class RelaxedPrecisionVisitor : public Visitor {
  16. public:
  17. RelaxedPrecisionVisitor(SpirvContext &spvCtx, const SpirvCodeGenOptions &opts)
  18. : Visitor(opts, spvCtx) {}
  19. bool visit(SpirvFunction *, Phase) override;
  20. bool visit(SpirvVariable *) override;
  21. bool visit(SpirvFunctionParameter *) override;
  22. bool visit(SpirvAccessChain *) override;
  23. bool visit(SpirvAtomic *) override;
  24. bool visit(SpirvBitFieldExtract *) override;
  25. bool visit(SpirvBitFieldInsert *) override;
  26. bool visit(SpirvConstantBoolean *) override;
  27. bool visit(SpirvConstantInteger *) override;
  28. bool visit(SpirvConstantFloat *) override;
  29. bool visit(SpirvConstantComposite *) override;
  30. bool visit(SpirvCompositeConstruct *) override;
  31. bool visit(SpirvCompositeExtract *) override;
  32. bool visit(SpirvCompositeInsert *) override;
  33. bool visit(SpirvExtInst *) override;
  34. bool visit(SpirvFunctionCall *) override;
  35. bool visit(SpirvLoad *) override;
  36. bool visit(SpirvSelect *) override;
  37. bool visit(SpirvStore *) override;
  38. bool visit(SpirvSpecConstantBinaryOp *) override;
  39. bool visit(SpirvSpecConstantUnaryOp *) override;
  40. bool visit(SpirvBinaryOp *) override;
  41. bool visit(SpirvUnaryOp *) override;
  42. bool visit(SpirvVectorShuffle *) override;
  43. bool visit(SpirvImageOp *) override;
  44. using Visitor::visit;
  45. /// The "sink" visit function for all instructions.
  46. ///
  47. /// By default, all other visit instructions redirect to this visit function.
  48. /// So that you want override this visit function to handle all instructions,
  49. /// regardless of their polymorphism.
  50. bool visitInstruction(SpirvInstruction *instr) override { return true; }
  51. };
  52. } // end namespace spirv
  53. } // end namespace clang
  54. #endif // LLVM_CLANG_LIB_SPIRV_RELAXEDPRECISIONVISITOR_H