class ConstantEmitter

Declaration

class ConstantEmitter { /* full declaration omitted */ };

Declared at: clang/lib/CodeGen/ConstantEmitter.h:23

Member Variables

public clang::CodeGen::CodeGenModule& CGM
public clang::CodeGen::CodeGenFunction* const CGF
private bool Abstract = false
private bool InitializedNonAbstract = false
Whether non-abstract components of the emitter have been initialized.
private bool Finalized = false
Whether the emitter has been finalized.
private bool Failed = false
Whether the constant-emission failed.
private bool InConstantContext = false
Whether we're in a constant context.
private clang::LangAS DestAddressSpace
The AST address space where this (non-abstract) initializer is going. Used for generating appropriate placeholders.
private llvm::SmallVector< std::pair<llvm::Constant*, llvm::GlobalVariable*>, 4> PlaceholderAddresses

Method Overview

Methods

ConstantEmitter(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Initialize this emission in the context of the given function. Use this if the expression might contain contextual references like block addresses or PredefinedExprs.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:57

Parameters

clang::CodeGen::CodeGenFunction& CGF

ConstantEmitter(
    const clang::CodeGen::ConstantEmitter& other)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:60

Parameters

const clang::CodeGen::ConstantEmitter& other

ConstantEmitter(
    clang::CodeGen::CodeGenModule& CGM,
    clang::CodeGen::CodeGenFunction* CGF =
        nullptr)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:51

Parameters

clang::CodeGen::CodeGenModule& CGM
clang::CodeGen::CodeGenFunction* CGF = nullptr

llvm::Constant* emitAbstract(
    clang::SourceLocation loc,
    const clang::APValue& value,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:103

Parameters

clang::SourceLocation loc
const clang::APValue& value
clang::QualType T

llvm::Constant* emitAbstract(const clang::Expr* E,
                             clang::QualType T)

Description

Emit the result of the given expression as an abstract constant, asserting that it succeeded. This is only safe to do when the expression is known to be a constant expression with either a fairly simple type or a known simple form.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:102

Parameters

const clang::Expr* E
clang::QualType T

llvm::Constant* emitForInitializer(
    const clang::APValue& value,
    clang::LangAS destAddrSpace,
    clang::QualType destType)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:75

Parameters

const clang::APValue& value
clang::LangAS destAddrSpace
clang::QualType destType

static llvm::Constant* emitForMemory(
    clang::CodeGen::CodeGenModule& CGM,
    llvm::Constant* C,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:123

Parameters

clang::CodeGen::CodeGenModule& CGM
llvm::Constant* C
clang::QualType T

llvm::Constant* emitForMemory(llvm::Constant* C,
                              clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:118

Parameters

llvm::Constant* C
clang::QualType T

static llvm::Constant* emitNullForMemory(
    clang::CodeGen::CodeGenModule& CGM,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:122

Parameters

clang::CodeGen::CodeGenModule& CGM
clang::QualType T

llvm::Constant* emitNullForMemory(
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:115

Parameters

clang::QualType T

void finalize(llvm::GlobalVariable* global)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:78

Parameters

llvm::GlobalVariable* global

llvm::GlobalValue* getCurrentAddrPrivate()

Description

Get the address of the current location. This is a constant that will resolve, after finalization, to the address of the 'signal' value that is registered with the emitter later.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:141

void initializeNonAbstract(clang::LangAS destAS)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:156

Parameters

clang::LangAS destAS

bool isAbstract() const

Description

Is the current emission context abstract?

Declared at: clang/lib/CodeGen/ConstantEmitter.h:66

llvm::Constant* markIfFailed(llvm::Constant* init)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:161

Parameters

llvm::Constant* init

clang::CodeGen::ConstantEmitter::AbstractState
pushAbstract()

Declared at: clang/lib/CodeGen/ConstantEmitter.h:171

void registerCurrentAddrPrivate(
    llvm::Constant* signal,
    llvm::GlobalValue* placeholder)

Description

Register a 'signal' value with the emitter to inform it where to resolve a placeholder. The signal value must be unique in the initializer; it might, for example, be the address of a global that refers to the current-address value in its own initializer. Uses of the placeholder must be properly anchored before finalizing the emitter, e.g. by being installed as the initializer of a global variable. That is, it must be possible to replaceAllUsesWith the placeholder with the proper address of the signal.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:152

Parameters

llvm::Constant* signal
llvm::GlobalValue* placeholder

llvm::Constant* tryEmitAbstract(
    const clang::APValue& value,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:110

Parameters

const clang::APValue& value
clang::QualType T

llvm::Constant* tryEmitAbstract(
    const clang::Expr* E,
    clang::QualType T)

Description

Try to emit the result of the given expression as an abstract constant.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:107

Parameters

const clang::Expr* E
clang::QualType T

llvm::Constant* tryEmitAbstractForInitializer(
    const clang::VarDecl& D)

Description

Try to emit the initializer of the given declaration as an abstract constant.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:96

Parameters

const clang::VarDecl& D

llvm::Constant* tryEmitAbstractForMemory(
    const clang::Expr* E,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:108

Parameters

const clang::Expr* E
clang::QualType T

llvm::Constant* tryEmitAbstractForMemory(
    const clang::APValue& value,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:111

Parameters

const clang::APValue& value
clang::QualType T

llvm::Constant* tryEmitConstantExpr(
    const clang::ConstantExpr* CE)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:113

Parameters

const clang::ConstantExpr* CE

llvm::Constant* tryEmitForInitializer(
    const clang::Expr* E,
    clang::LangAS destAddrSpace,
    clang::QualType destType)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:73

Parameters

const clang::Expr* E
clang::LangAS destAddrSpace
clang::QualType destType

llvm::Constant* tryEmitForInitializer(
    const clang::VarDecl& D)

Description

Try to emit the initiaizer of the given declaration as an abstract constant. If this succeeds, the emission must be finalized.

Declared at: clang/lib/CodeGen/ConstantEmitter.h:72

Parameters

const clang::VarDecl& D

llvm::Constant* tryEmitPrivate(
    const clang::APValue& value,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:135

Parameters

const clang::APValue& value
clang::QualType T

llvm::Constant* tryEmitPrivate(
    const clang::Expr* E,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:132

Parameters

const clang::Expr* E
clang::QualType T

llvm::Constant* tryEmitPrivateForMemory(
    const clang::Expr* E,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:133

Parameters

const clang::Expr* E
clang::QualType T

llvm::Constant* tryEmitPrivateForMemory(
    const clang::APValue& value,
    clang::QualType T)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:136

Parameters

const clang::APValue& value
clang::QualType T

llvm::Constant* tryEmitPrivateForVarInit(
    const clang::VarDecl& D)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:130

Parameters

const clang::VarDecl& D

llvm::Constant* validateAndPopAbstract(
    llvm::Constant* C,
    clang::CodeGen::ConstantEmitter::AbstractState
        save)

Declared at: clang/lib/CodeGen/ConstantEmitter.h:176

Parameters

llvm::Constant* C
clang::CodeGen::ConstantEmitter::AbstractState save

~ConstantEmitter()

Declared at: clang/lib/CodeGen/ConstantEmitter.h:63