LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CodeGen/Analysis.h
Go to the documentation of this file.
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 
14 #ifndef LLVM_CODEGEN_ANALYSIS_H
15 #define LLVM_CODEGEN_ANALYSIS_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/IR/InlineAsm.h"
22 #include "llvm/IR/Instructions.h"
23 #include "llvm/Support/CallSite.h"
24 
25 namespace llvm {
26 
27 class GlobalVariable;
28 class TargetLowering;
29 class TargetLoweringBase;
30 class SDNode;
31 class SDValue;
32 class SelectionDAG;
33 
34 /// ComputeLinearIndex - Given an LLVM IR aggregate type and a sequence
35 /// of insertvalue or extractvalue indices that identify a member, return
36 /// the linearized index of the start of the member.
37 ///
38 unsigned ComputeLinearIndex(Type *Ty,
39  const unsigned *Indices,
40  const unsigned *IndicesEnd,
41  unsigned CurIndex = 0);
42 
43 inline unsigned ComputeLinearIndex(Type *Ty,
44  ArrayRef<unsigned> Indices,
45  unsigned CurIndex = 0) {
46  return ComputeLinearIndex(Ty, Indices.begin(), Indices.end(), CurIndex);
47 }
48 
49 /// ComputeValueVTs - Given an LLVM IR type, compute a sequence of
50 /// EVTs that represent all the individual underlying
51 /// non-aggregate types that comprise it.
52 ///
53 /// If Offsets is non-null, it points to a vector to be filled in
54 /// with the in-memory offsets of each of the individual values.
55 ///
56 void ComputeValueVTs(const TargetLowering &TLI, Type *Ty,
57  SmallVectorImpl<EVT> &ValueVTs,
58  SmallVectorImpl<uint64_t> *Offsets = 0,
59  uint64_t StartingOffset = 0);
60 
61 /// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
62 GlobalVariable *ExtractTypeInfo(Value *V);
63 
64 /// hasInlineAsmMemConstraint - Return true if the inline asm instruction being
65 /// processed uses a memory 'm' constraint.
67  const TargetLowering &TLI);
68 
69 /// getFCmpCondCode - Return the ISD condition code corresponding to
70 /// the given LLVM IR floating-point condition code. This includes
71 /// consideration of global floating-point math flags.
72 ///
74 
75 /// getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats,
76 /// return the equivalent code if we're allowed to assume that NaNs won't occur.
78 
79 /// getICmpCondCode - Return the ISD condition code corresponding to
80 /// the given LLVM IR integer condition code.
81 ///
83 
84 /// Test if the given instruction is in a position to be optimized
85 /// with a tail-call. This roughly means that it's in a block with
86 /// a return and there's nothing that needs to be scheduled
87 /// between it and the return.
88 ///
89 /// This function only tests target-independent requirements.
90 bool isInTailCallPosition(ImmutableCallSite CS, const TargetLowering &TLI);
91 
92 /// Test if given that the input instruction is in the tail call position if the
93 /// return type or any attributes of the function will inhibit tail call
94 /// optimization.
95 bool returnTypeIsEligibleForTailCall(const Function *F,
96  const Instruction *I,
97  const ReturnInst *Ret,
98  const TargetLoweringBase &TLI);
99 
100 } // End llvm namespace
101 
102 #endif
COFF::RelocationTypeX86 Type
Definition: COFFYAML.cpp:227
ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred)
void ComputeValueVTs(const TargetLowering &TLI, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< uint64_t > *Offsets=0, uint64_t StartingOffset=0)
GlobalVariable * ExtractTypeInfo(Value *V)
ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
iterator end() const
Definition: ArrayRef.h:98
F(f)
bool returnTypeIsEligibleForTailCall(const Function *F, const Instruction *I, const ReturnInst *Ret, const TargetLoweringBase &TLI)
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred)
bool hasInlineAsmMemConstraint(InlineAsm::ConstraintInfoVector &CInfos, const TargetLowering &TLI)
bool isInTailCallPosition(ImmutableCallSite CS, const TargetLowering &TLI)
iterator begin() const
Definition: ArrayRef.h:97
ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC)
#define I(x, y, z)
Definition: MD5.cpp:54
unsigned ComputeLinearIndex(Type *Ty, const unsigned *Indices, const unsigned *IndicesEnd, unsigned CurIndex=0)
std::vector< ConstraintInfo > ConstraintInfoVector
Definition: InlineAsm.h:118