clang  6.0.0svn
Macros | Enumerations | Functions
CGExprScalar.cpp File Reference
#include "CodeGenFunction.h"
#include "CGCleanup.h"
#include "CGCXXABI.h"
#include "CGDebugInfo.h"
#include "CGObjCRuntime.h"
#include "CodeGenModule.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/ADT/Optional.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include <cstdarg>
Include dependency graph for CGExprScalar.cpp:

Go to the source code of this file.

Macros

#define HANDLEBINOP(OP)
 
#define VISITCOMP(CODE, UI, SI, FP)
 
#define COMPOUND_OP(Op)
 

Enumerations

enum  IntrinsicType { VCMPEQ, VCMPGT }
 

Functions

static llvm::Constant * getMaskElt (llvm::ShuffleVectorInst *SVI, unsigned Idx, unsigned Off, llvm::Type *I32Ty)
 
static llvm::Constant * getAsInt32 (llvm::ConstantInt *C, llvm::Type *I32Ty)
 
static BinOpInfo createBinOpInfoFromIncDec (const UnaryOperator *E, llvm::Value *InVal, bool IsInc)
 
static ValueemitPointerArithmetic (CodeGenFunction &CGF, const BinOpInfo &op, bool isSubtraction)
 Emit pointer + index arithmetic. More...
 
static ValuebuildFMulAdd (llvm::BinaryOperator *MulOp, Value *Addend, const CodeGenFunction &CGF, CGBuilderTy &Builder, bool negMul, bool negAdd)
 
static ValuetryEmitFMulAdd (const BinOpInfo &op, const CodeGenFunction &CGF, CGBuilderTy &Builder, bool isSub=false)
 
static llvm::Intrinsic::ID GetIntrinsic (IntrinsicType IT, BuiltinType::Kind ElemKind)
 
static bool isCheapEnoughToEvaluateUnconditionally (const Expr *E, CodeGenFunction &CGF)
 isCheapEnoughToEvaluateUnconditionally - Return true if the specified expression is cheap enough and side-effect-free enough to evaluate unconditionally instead of conditionally. More...
 
static ValueConvertVec3AndVec4 (CGBuilderTy &Builder, CodeGenFunction &CGF, Value *Src, unsigned NumElementsDst)
 
static ValuecreateCastsForTypeOfSameSize (CGBuilderTy &Builder, const llvm::DataLayout &DL, Value *Src, llvm::Type *DstTy, StringRef Name="")
 

Macro Definition Documentation

◆ COMPOUND_OP

#define COMPOUND_OP (   Op)
Value:
case BO_##Op##Assign: \
return Scalar.EmitCompoundAssignLValue(E, &ScalarExprEmitter::Emit##Op, \
Result)

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

◆ HANDLEBINOP

#define HANDLEBINOP (   OP)
Value:
Value *VisitBin ## OP(const BinaryOperator *E) { \
return Emit ## OP(EmitBinOps(E)); \
} \
Value *VisitBin ## OP ## Assign(const CompoundAssignOperator *E) { \
return EmitCompoundAssign(E, &ScalarExprEmitter::Emit ## OP); \
}
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2986
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3192

Definition at line 698 of file CGExprScalar.cpp.

◆ VISITCOMP

#define VISITCOMP (   CODE,
  UI,
  SI,
  FP 
)
Value:
Value *VisitBin##CODE(const BinaryOperator *E) { \
return EmitCompare(E, llvm::ICmpInst::UI, llvm::ICmpInst::SI, \
llvm::FCmpInst::FP); }
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2986

Definition at line 721 of file CGExprScalar.cpp.

Enumeration Type Documentation

◆ IntrinsicType

Enumerator
VCMPEQ 
VCMPGT 

Definition at line 3102 of file CGExprScalar.cpp.

Function Documentation

◆ buildFMulAdd()

static Value* buildFMulAdd ( llvm::BinaryOperator *  MulOp,
Value Addend,
const CodeGenFunction CGF,
CGBuilderTy Builder,
bool  negMul,
bool  negAdd 
)
static

◆ ConvertVec3AndVec4()

static Value* ConvertVec3AndVec4 ( CGBuilderTy Builder,
CodeGenFunction CGF,
Value Src,
unsigned  NumElementsDst 
)
static

Definition at line 3722 of file CGExprScalar.cpp.

References clang::CodeGen::CodeGenTypeCache::Int32Ty.

◆ createBinOpInfoFromIncDec()

static BinOpInfo createBinOpInfoFromIncDec ( const UnaryOperator E,
llvm::Value InVal,
bool  IsInc 
)
static

Definition at line 1851 of file CGExprScalar.cpp.

References clang::Expr::getType().

◆ createCastsForTypeOfSameSize()

static Value* createCastsForTypeOfSameSize ( CGBuilderTy Builder,
const llvm::DataLayout &  DL,
Value Src,
llvm::Type *  DstTy,
StringRef  Name = "" 
)
static

Definition at line 3751 of file CGExprScalar.cpp.

◆ emitPointerArithmetic()

static Value* emitPointerArithmetic ( CodeGenFunction CGF,
const BinOpInfo &  op,
bool  isSubtraction 
)
static

◆ getAsInt32()

static llvm::Constant* getAsInt32 ( llvm::ConstantInt *  C,
llvm::Type *  I32Ty 
)
static

◆ GetIntrinsic()

static llvm::Intrinsic::ID GetIntrinsic ( IntrinsicType  IT,
BuiltinType::Kind  ElemKind 
)
static

Definition at line 3104 of file CGExprScalar.cpp.

References clang::prec::And, clang::CodeGen::CodeGenFunction::ConditionalEvaluation::begin(), clang::ASTContext::BoolTy, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::CodeGen::CodeGenFunction::ContainsLabel(), clang::Create(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CodeGenFunction::EmitARCStoreAutoreleasing(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitARCStoreUnsafeUnretained(), clang::CodeGen::CodeGenFunction::EmitARCStoreWeak(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), clang::CodeGen::CodeGenFunction::EmitComplexExpr(), clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(), clang::CodeGen::CGCXXABI::EmitMemberPointerComparison(), clang::CodeGen::CodeGenFunction::EmitNullabilityCheck(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreThroughBitfieldLValue(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::ConditionalEvaluation::end(), clang::CodeGen::CodeGenFunction::EnsureInsertPoint(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CodeGen::RValue::get(), clang::Type::getAs(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getCurrentProfileCount(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::BinaryOperator::getExprLoc(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::BuiltinType::getKind(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::BinaryOperator::getLHS(), clang::QualType::getObjCLifetime(), clang::BinaryOperator::getOpcode(), clang::CodeGen::CodeGenFunction::getProfileCount(), clang::BinaryOperator::getRHS(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::hasSignedIntegerRepresentation(), clang::CodeGen::CodeGenFunction::incrementProfileCounter(), clang::Type::isAnyComplexType(), clang::Type::isRealFloatingType(), clang::Type::isVectorType(), clang::CodeGen::LValue::isVolatileQualified(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::CodeGen::CodeGenFunction::TCK_Store, clang::CodeGen::Type, and VCMPEQ.

◆ getMaskElt()

static llvm::Constant* getMaskElt ( llvm::ShuffleVectorInst *  SVI,
unsigned  Idx,
unsigned  Off,
llvm::Type *  I32Ty 
)
static

Definition at line 1375 of file CGExprScalar.cpp.

Referenced by getAsInt32().

◆ isCheapEnoughToEvaluateUnconditionally()

static bool isCheapEnoughToEvaluateUnconditionally ( const Expr E,
CodeGenFunction CGF 
)
static

isCheapEnoughToEvaluateUnconditionally - Return true if the specified expression is cheap enough and side-effect-free enough to evaluate unconditionally instead of conditionally.

This is used to convert control flow into selects in some cases.

Definition at line 3532 of file CGExprScalar.cpp.

References clang::CodeGen::CodeGenFunction::ConditionalEvaluation::begin(), clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::CodeGen::CodeGenFunction::ContainsLabel(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBlockLiteral(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitVAArg(), clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), clang::CodeGen::CodeGenFunction::ConditionalEvaluation::end(), clang::CodeGen::CodeGenFunction::ErrorUnsupported(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::ChooseExpr::getChosenSubExpr(), clang::AbstractConditionalOperator::getCond(), clang::CodeGen::CodeGenFunction::getContext(), clang::AbstractConditionalOperator::getFalseExpr(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenFunction::getProfileCount(), clang::AbstractConditionalOperator::getTrueExpr(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::CodeGen::CodeGenFunction::incrementProfileCounter(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::Address::invalid(), clang::Expr::isEvaluatable(), clang::CodeGen::Address::isValid(), clang::Type::isVariablyModifiedType(), clang::Type::isVectorType(), clang::Type::isVoidType(), and clang::CodeGen::Type.

◆ tryEmitFMulAdd()

static Value* tryEmitFMulAdd ( const BinOpInfo &  op,
const CodeGenFunction CGF,
CGBuilderTy Builder,
bool  isSub = false 
)
static