2010-04-21 01:22:34 +00:00
|
|
|
//===- CodeGen/Analysis.h - CodeGen LLVM IR Analysis Utilities --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares several CodeGen-specific LLVM IR analysis utilties.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_ANALYSIS_H
|
|
|
|
#define LLVM_CODEGEN_ANALYSIS_H
|
|
|
|
|
|
|
|
#include "llvm/Instructions.h"
|
|
|
|
#include "llvm/InlineAsm.h"
|
2011-07-13 10:26:04 +00:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2010-04-21 01:22:34 +00:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
|
|
|
#include "llvm/CodeGen/ISDOpcodes.h"
|
|
|
|
#include "llvm/Support/CallSite.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class GlobalVariable;
|
2010-11-30 23:55:39 +00:00
|
|
|
class TargetLowering;
|
|
|
|
class SDNode;
|
|
|
|
class SelectionDAG;
|
2010-04-21 01:22:34 +00:00
|
|
|
|
|
|
|
/// ComputeLinearIndex - Given an LLVM IR aggregate type and a sequence
|
|
|
|
/// of insertvalue or extractvalue indices that identify a member, return
|
|
|
|
/// the linearized index of the start of the member.
|
|
|
|
///
|
2011-07-18 04:54:35 +00:00
|
|
|
unsigned ComputeLinearIndex(Type *Ty,
|
2010-04-21 01:22:34 +00:00
|
|
|
const unsigned *Indices,
|
|
|
|
const unsigned *IndicesEnd,
|
|
|
|
unsigned CurIndex = 0);
|
|
|
|
|
2011-07-18 04:54:35 +00:00
|
|
|
inline unsigned ComputeLinearIndex(Type *Ty,
|
2011-07-13 10:26:04 +00:00
|
|
|
ArrayRef<unsigned> Indices,
|
|
|
|
unsigned CurIndex = 0) {
|
|
|
|
return ComputeLinearIndex(Ty, Indices.begin(), Indices.end(), CurIndex);
|
|
|
|
}
|
|
|
|
|
2010-04-21 01:22:34 +00:00
|
|
|
/// ComputeValueVTs - Given an LLVM IR type, compute a sequence of
|
|
|
|
/// EVTs that represent all the individual underlying
|
|
|
|
/// non-aggregate types that comprise it.
|
|
|
|
///
|
|
|
|
/// If Offsets is non-null, it points to a vector to be filled in
|
|
|
|
/// with the in-memory offsets of each of the individual values.
|
|
|
|
///
|
2011-07-18 04:54:35 +00:00
|
|
|
void ComputeValueVTs(const TargetLowering &TLI, Type *Ty,
|
2010-04-21 01:22:34 +00:00
|
|
|
SmallVectorImpl<EVT> &ValueVTs,
|
|
|
|
SmallVectorImpl<uint64_t> *Offsets = 0,
|
|
|
|
uint64_t StartingOffset = 0);
|
|
|
|
|
|
|
|
/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
|
|
|
|
GlobalVariable *ExtractTypeInfo(Value *V);
|
|
|
|
|
|
|
|
/// hasInlineAsmMemConstraint - Return true if the inline asm instruction being
|
|
|
|
/// processed uses a memory 'm' constraint.
|
2010-10-29 17:29:13 +00:00
|
|
|
bool hasInlineAsmMemConstraint(InlineAsm::ConstraintInfoVector &CInfos,
|
2010-04-21 01:22:34 +00:00
|
|
|
const TargetLowering &TLI);
|
|
|
|
|
|
|
|
/// getFCmpCondCode - Return the ISD condition code corresponding to
|
|
|
|
/// the given LLVM IR floating-point condition code. This includes
|
|
|
|
/// consideration of global floating-point math flags.
|
|
|
|
///
|
|
|
|
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred);
|
|
|
|
|
2011-12-02 22:16:29 +00:00
|
|
|
/// getFCmpCodeWithoutNaN - Given an ISD condition code comparing floats,
|
|
|
|
/// return the equivalent code if we're allowed to assume that NaNs won't occur.
|
|
|
|
ISD::CondCode getFCmpCodeWithoutNaN(ISD::CondCode CC);
|
|
|
|
|
2010-04-21 01:22:34 +00:00
|
|
|
/// getICmpCondCode - Return the ISD condition code corresponding to
|
|
|
|
/// the given LLVM IR integer condition code.
|
|
|
|
///
|
|
|
|
ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
|
|
|
|
|
|
|
|
/// Test if the given instruction is in a position to be optimized
|
|
|
|
/// with a tail-call. This roughly means that it's in a block with
|
|
|
|
/// a return and there's nothing that needs to be scheduled
|
|
|
|
/// between it and the return.
|
|
|
|
///
|
|
|
|
/// This function only tests target-independent requirements.
|
|
|
|
bool isInTailCallPosition(ImmutableCallSite CS, Attributes CalleeRetAttr,
|
|
|
|
const TargetLowering &TLI);
|
|
|
|
|
2010-11-30 23:55:39 +00:00
|
|
|
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
|
|
|
|
const TargetLowering &TLI);
|
|
|
|
|
2010-04-21 01:22:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|