clang API Documentation

Classes | Defines | Enumerations | Functions | Variables
CGBuiltin.cpp File Reference
#include "CodeGenFunction.h"
#include "CGObjCRuntime.h"
#include "CodeGenModule.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
Include dependency graph for CGBuiltin.cpp:

Go to the source code of this file.

Classes

struct  NeonIntrinsicInfo

Defines

#define NEONMAP0(NameBase)   { NEON::BI__builtin_neon_ ## NameBase, 0, 0, #NameBase, 0 }
#define NEONMAP1(NameBase, LLVMIntrinsic, TypeModifier)
#define NEONMAP2(NameBase, LLVMIntrinsic, AltLLVMIntrinsic, TypeModifier)

Enumerations

enum  {
  AddRetType = (1 << 0), Add1ArgType = (1 << 1), Add2ArgTypes = (1 << 2), VectorizeRetType = (1 << 3),
  VectorizeArgTypes = (1 << 4), InventFloatType = (1 << 5), UnsignedAlts = (1 << 6), Use64BitVectors = (1 << 7),
  Use128BitVectors = (1 << 8), Vectorize1ArgType = Add1ArgType | VectorizeArgTypes, VectorRet = AddRetType | VectorizeRetType, VectorRetGetArgs01,
  FpCmpzModifiers
}

Functions

static ValueEmitToInt (CodeGenFunction &CGF, llvm::Value *V, QualType T, llvm::IntegerType *IntType)
static ValueEmitFromInt (CodeGenFunction &CGF, llvm::Value *V, QualType T, llvm::Type *ResultType)
static RValue EmitBinaryAtomic (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E)
static RValue EmitBinaryAtomicPost (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E, Instruction::BinaryOps Op, bool Invert=false)
static ValueEmitFAbs (CodeGenFunction &CGF, Value *V)
 EmitFAbs - Emit a call to .fabs().
static RValue emitLibraryCall (CodeGenFunction &CGF, const FunctionDecl *Fn, const CallExpr *E, llvm::Value *calleeValue)
static llvm::ValueEmitOverflowIntrinsic (CodeGenFunction &CGF, const llvm::Intrinsic::ID IntrinsicID, llvm::Value *X, llvm::Value *Y, llvm::Value *&Carry)
 Emit a call to llvm.{sadd,uadd,ssub,usub,smul,umul}.with.overflow.* depending on IntrinsicID.
static llvm::VectorType * GetNeonType (CodeGenFunction *CGF, NeonTypeFlags TypeFlags, bool V1Ty=false)
static const NeonIntrinsicInfofindNeonIntrinsicInMap (ArrayRef< NeonIntrinsicInfo > IntrinsicMap, unsigned BuiltinID, bool &MapProvenSorted)
static ValueEmitCommonNeonSISDBuiltinExpr (CodeGenFunction &CGF, const NeonIntrinsicInfo &SISDInfo, SmallVectorImpl< Value * > &Ops, const CallExpr *E)
static ValuepackTBLDVectorList (CodeGenFunction &CGF, ArrayRef< Value * > Ops, Value *ExtOp, Value *IndexOp, llvm::Type *ResTy, unsigned IntID, const char *Name)
static ValueEmitAArch64TblBuiltinExpr (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E, SmallVectorImpl< Value * > &Ops)
static ValueemitUnaryFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID)
static ValueemitTernaryFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID)
static ValueemitFPIntBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID)

Variables

static NeonIntrinsicInfo ARMSIMDIntrinsicMap []
static NeonIntrinsicInfo AArch64SIMDIntrinsicMap []
static NeonIntrinsicInfo AArch64SISDIntrinsicMap []
static bool NEONSIMDIntrinsicsProvenSorted = false
static bool AArch64SIMDIntrinsicsProvenSorted = false
static bool AArch64SISDIntrinsicsProvenSorted = false

Define Documentation

#define NEONMAP0 (   NameBase)    { NEON::BI__builtin_neon_ ## NameBase, 0, 0, #NameBase, 0 }

Definition at line 1942 of file CGBuiltin.cpp.

#define NEONMAP1 (   NameBase,
  LLVMIntrinsic,
  TypeModifier 
)
Value:
{ NEON:: BI__builtin_neon_ ## NameBase, \
      Intrinsic::LLVMIntrinsic, 0, #NameBase, TypeModifier }

Definition at line 1945 of file CGBuiltin.cpp.

#define NEONMAP2 (   NameBase,
  LLVMIntrinsic,
  AltLLVMIntrinsic,
  TypeModifier 
)
Value:
{ NEON:: BI__builtin_neon_ ## NameBase, \
      Intrinsic::LLVMIntrinsic, Intrinsic::AltLLVMIntrinsic, \
      #NameBase, TypeModifier }

Definition at line 1949 of file CGBuiltin.cpp.


Enumeration Type Documentation

anonymous enum
Enumerator:
AddRetType 
Add1ArgType 
Add2ArgTypes 
VectorizeRetType 
VectorizeArgTypes 
InventFloatType 
UnsignedAlts 
Use64BitVectors 
Use128BitVectors 
Vectorize1ArgType 
VectorRet 
VectorRetGetArgs01 
FpCmpzModifiers 

Definition at line 1908 of file CGBuiltin.cpp.


Function Documentation

static Value* EmitAArch64TblBuiltinExpr ( CodeGenFunction CGF,
unsigned  BuiltinID,
const CallExpr E,
SmallVectorImpl< Value * > &  Ops 
) [static]
static RValue EmitBinaryAtomic ( CodeGenFunction CGF,
llvm::AtomicRMWInst::BinOp  Kind,
const CallExpr E 
) [static]
static RValue EmitBinaryAtomicPost ( CodeGenFunction CGF,
llvm::AtomicRMWInst::BinOp  Kind,
const CallExpr E,
Instruction::BinaryOps  Op,
bool  Invert = false 
) [static]
static Value* EmitCommonNeonSISDBuiltinExpr ( CodeGenFunction CGF,
const NeonIntrinsicInfo SISDInfo,
SmallVectorImpl< Value * > &  Ops,
const CallExpr E 
) [static]
static Value* EmitFAbs ( CodeGenFunction CGF,
Value V 
) [static]
static Value* emitFPIntBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID 
) [static]
static Value* EmitFromInt ( CodeGenFunction CGF,
llvm::Value V,
QualType  T,
llvm::Type *  ResultType 
) [static]
static RValue emitLibraryCall ( CodeGenFunction CGF,
const FunctionDecl Fn,
const CallExpr E,
llvm::Value calleeValue 
) [static]
static llvm::Value* EmitOverflowIntrinsic ( CodeGenFunction CGF,
const llvm::Intrinsic::ID  IntrinsicID,
llvm::Value X,
llvm::Value Y,
llvm::Value *&  Carry 
) [static]

Emit a call to llvm.{sadd,uadd,ssub,usub,smul,umul}.with.overflow.* depending on IntrinsicID.

  • CGF The current codegen function.
  • IntrinsicID The ID for the Intrinsic we wish to generate.
  • X The first argument to the llvm.*.with.overflow.*.
  • Y The second argument to the llvm.*.with.overflow.*.
  • Carry The carry returned by the llvm.*.with.overflow.*.
    Returns:
    The result (i.e. sum/product) returned by the intrinsic.

Definition at line 172 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, and clang::CodeGen::CodeGenModule::getIntrinsic().

Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().

static Value* emitTernaryFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID 
) [static]
static Value* EmitToInt ( CodeGenFunction CGF,
llvm::Value V,
QualType  T,
llvm::IntegerType *  IntType 
) [static]

Emit the conversions required to turn the given value into an integer of the given size.

Definition at line 56 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and clang::CodeGen::CodeGenFunction::EmitToMemory().

Referenced by EmitBinaryAtomic(), EmitBinaryAtomicPost(), and clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().

static Value* emitUnaryFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID 
) [static]
static const NeonIntrinsicInfo* findNeonIntrinsicInMap ( ArrayRef< NeonIntrinsicInfo IntrinsicMap,
unsigned  BuiltinID,
bool MapProvenSorted 
) [static]
static llvm::VectorType* GetNeonType ( CodeGenFunction CGF,
NeonTypeFlags  TypeFlags,
bool  V1Ty = false 
) [static]
static Value* packTBLDVectorList ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
Value ExtOp,
Value IndexOp,
llvm::Type *  ResTy,
unsigned  IntID,
const char *  Name 
) [static]

Variable Documentation

Definition at line 2171 of file CGBuiltin.cpp.

Definition at line 2487 of file CGBuiltin.cpp.

Definition at line 2286 of file CGBuiltin.cpp.

Definition at line 2488 of file CGBuiltin.cpp.

Definition at line 1954 of file CGBuiltin.cpp.

Definition at line 2485 of file CGBuiltin.cpp.