DxilConstantFolding.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //===-- DxilConstantFolding.h - Constant folding for Dxil ------*- 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. // Copyright (C) Microsoft Corporation. All rights reserved.
  9. //===----------------------------------------------------------------------===//
  10. //
  11. // This file declares routines for folding dxil intrinsics into constants when
  12. // all operands are constants.
  13. //
  14. // We hook into the LLVM routines for constant folding so the function
  15. // interfaces are dictated by what llvm provides.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_ANALYSIS_HLSLCONSTANTFOLDING_H
  19. #define LLVM_ANALYSIS_HLSLCONSTANTFOLDING_H
  20. #include "llvm/ADT/StringRef.h"
  21. namespace llvm {
  22. class Constant;
  23. class Function;
  24. class Type;
  25. template<typename T>
  26. class ArrayRef;
  27. }
  28. namespace hlsl {
  29. /// ConstantFoldScalarCall - Try to constant fold the call instruction.
  30. /// If successful, the constant result is returned, if not, null is returned.
  31. llvm::Constant *ConstantFoldScalarCall(llvm::StringRef Name, llvm::Type *Ty, llvm::ArrayRef<llvm::Constant *> Operands);
  32. /// ConstantFoldScalarCallExt
  33. /// Hook point for constant folding of extensions.
  34. llvm::Constant *ConstantFoldScalarCallExt(llvm::StringRef Name, llvm::Type *Ty, llvm::ArrayRef<llvm::Constant *> Operands);
  35. /// CanConstantFoldCallTo - Return true if we can potentially constant
  36. /// fold a call to the given function.
  37. bool CanConstantFoldCallTo(const llvm::Function *F);
  38. /// CanConstantFoldCallToExt
  39. /// Hook point for constant folding of extensions.
  40. bool CanConstantFoldCallToExt(const llvm::Function *F);
  41. }
  42. #endif