Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.4 KiB

  1. //===- CodeGen/Analysis.h - CodeGen LLVM IR Analysis Utilities --*- 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. //
  10. // This file declares several CodeGen-specific LLVM IR analysis utilties.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_CODEGEN_ANALYSIS_H
  14. #define LLVM_CODEGEN_ANALYSIS_H
  15. #include "llvm/ADT/ArrayRef.h"
  16. #include "llvm/ADT/SmallVector.h"
  17. #include "llvm/CodeGen/ISDOpcodes.h"
  18. #include "llvm/CodeGen/ValueTypes.h"
  19. #include "llvm/IR/InlineAsm.h"
  20. #include "llvm/IR/Instructions.h"
  21. #include "llvm/Support/CallSite.h"
  22. namespace llvm {
  23. class GlobalVariable;
  24. class TargetLowering;
  25. class SDNode;
  26. class SDValue;
  27. class SelectionDAG;
  28. /// ComputeLinearIndex - Given an LLVM IR aggregate type and a sequence
  29. /// of insertvalue or extractvalue indices that identify a member, return
  30. /// the linearized index of the start of the member.
  31. ///
  32. unsigned ComputeLinearIndex(Type *Ty,
  33. const unsigned *Indices,
  34. const unsigned *IndicesEnd,
  35. unsigned CurIndex = 0);
  36. inline unsigned ComputeLinearIndex(Type *Ty,
  37. ArrayRef<unsigned> Indices,
  38. unsigned CurIndex = 0) {
  39. return ComputeLinearIndex(Ty, Indices.begin(), Indices.end(), CurIndex);
  40. }
  41. /// ComputeValueVTs - Given an LLVM IR type, compute a sequence of
  42. /// EVTs that represent all the individual underlying
  43. /// non-aggregate types that comprise it.
  44. ///
  45. /// If Offsets is non-null, it points to a vector to be filled in
  46. /// with the in-memory offsets of each of the individual values.
  47. ///
  48. void ComputeValueVTs(const TargetLowering &TLI, Type *Ty,
  49. SmallVectorImpl<EVT> &ValueVTs,
  50. SmallVectorImpl<uint64_t> *Offsets = 0,
  51. uint64_t StartingOffset = 0);
  52. /// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
  53. GlobalVariable *ExtractTypeInfo(Value *V);
  54. /// hasInlineAsmMemConstraint - Return true if the inline asm instruction being
  55. /// processed uses a memory 'm' constraint.
  56. bool hasInlineAsmMemConstraint(InlineAsm::ConstraintInfoVector &CInfos,
  57. const TargetLowering &TLI);
  58. /// getFCmpCondCode - Return the ISD condition code corresponding to
  59. /// the given LLVM IR floating-point condition code. This includes
  60. /// consideration of global floating-point math flags.
  61. ///
  62. ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred);
  63. /// getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats,
  64. /// return the equivalent code if we're allowed to assume that NaNs won't occur.
  65. ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC);
  66. /// getICmpCondCode - Return the ISD condition code corresponding to
  67. /// the given LLVM IR integer condition code.
  68. ///
  69. ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
  70. /// Test if the given instruction is in a position to be optimized
  71. /// with a tail-call. This roughly means that it's in a block with
  72. /// a return and there's nothing that needs to be scheduled
  73. /// between it and the return.
  74. ///
  75. /// This function only tests target-independent requirements.
  76. bool isInTailCallPosition(ImmutableCallSite CS, const TargetLowering &TLI);
  77. } // End llvm namespace
  78. #endif