struct IRPosition

Declaration

struct IRPosition { /* full declaration omitted */ };

Description

Helper to describe and deal with positions in the LLVM-IR. A position in the IR is described by an anchor value and an "offset" that could be the argument number, for call sites and arguments, or an indicator of the "position kind". The kinds, specified in the Kind enum below, include the locations in the attribute list, i.a., function scope and return value, as well as a distinction between call sites and functions. Finally, there are floating values that do not have a corresponding attribute list position.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:145

Member Variables

protected llvm::Value* AnchorVal
The value this position is anchored at.
protected int KindOrArgNo
The argument number, if non-negative, or the position "kind".
public static const llvm::IRPosition EmptyKey
{
public static const llvm::IRPosition TombstoneKey

Method Overview

Methods

IRPosition()

Description

Default constructor available to create invalid positions implicitly. All other positions need to be created explicitly through the appropriate static member function.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:168

static const llvm::IRPosition argument(
    const llvm::Argument& Arg)

Description

Create a position describing the argument \p Arg.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:190

Parameters

const llvm::Argument& Arg

static const llvm::IRPosition callsite_argument(
    const llvm::CallBase& CB,
    unsigned int ArgNo)

Description

Create a position describing the argument of \p CB at position \p ArgNo.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:205

Parameters

const llvm::CallBase& CB
unsigned int ArgNo

static const llvm::IRPosition callsite_argument(
    llvm::ImmutableCallSite ICS,
    unsigned int ArgNo)

Description

Create a position describing the argument of \p ICS at position \p ArgNo.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:221

Parameters

llvm::ImmutableCallSite ICS
unsigned int ArgNo

static const llvm::IRPosition callsite_argument(
    llvm::AbstractCallSite ACS,
    unsigned int ArgNo)

Description

Create a position describing the argument of \p ACS at position \p ArgNo.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:228

Parameters

llvm::AbstractCallSite ACS
unsigned int ArgNo

static const llvm::IRPosition callsite_function(
    const llvm::CallBase& CB)

Description

Create a position describing the function scope of \p CB.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:195

Parameters

const llvm::CallBase& CB

static const llvm::IRPosition callsite_function(
    llvm::ImmutableCallSite ICS)

Description

Create a position describing the function scope of \p ICS.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:211

Parameters

llvm::ImmutableCallSite ICS

static const llvm::IRPosition callsite_returned(
    const llvm::CallBase& CB)

Description

Create a position describing the returned value of \p CB.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:200

Parameters

const llvm::CallBase& CB

static const llvm::IRPosition callsite_returned(
    llvm::ImmutableCallSite ICS)

Description

Create a position describing the returned value of \p ICS.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:216

Parameters

llvm::ImmutableCallSite ICS

static const llvm::IRPosition function(
    const llvm::Function& F)

Description

Create a position describing the function scope of \p F.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:180

Parameters

const llvm::Function& F

static const llvm::IRPosition function_scope(
    const llvm::IRPosition& IRP)

Description

Create a position with function scope matching the "context" of \p IRP. If \p IRP is a call site (see isAnyCallSitePosition()) then the result will be a call site position, otherwise the function position of the associated function.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:241

Parameters

const llvm::IRPosition& IRP

llvm::Function* getAnchorScope() const

Description

Return the Function surrounding the anchor value.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:300

llvm::Value& getAnchorValue() const

Description

Return the value this abstract attribute is anchored with. The anchor value might not be the associated value if the latter is not sufficient to determine where arguments will be manifested. This is, so far, only the case for call site arguments as the value is not sufficient to pinpoint them. Instead, we can use the call site as an anchor.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:261

int getArgNo() const

Description

Return the argument number of the associated value if it is an argument or call site argument, otherwise a negative value.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:337

llvm::Argument* getAssociatedArgument() const

Description

Return the associated argument, if any.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:284

llvm::Function* getAssociatedFunction() const

Description

Return the associated function, if any.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:268

llvm::Value& getAssociatedValue() const

Description

Return the value this abstract attribute is associated with.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:326

llvm::Attribute getAttr(
    Attribute::AttrKind AK) const

Description

Return the attribute of kind \p AK existing in the IR at this position.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:400

Parameters

Attribute::AttrKind AK

unsigned int getAttrIdx() const

Description

Return the index in the attribute list for this position.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:340

void getAttrs(
    ArrayRef<Attribute::AttrKind> AKs,
    SmallVectorImpl<llvm::Attribute>& Attrs,
    bool IgnoreSubsumingPositions = false) const

Description

Return the attributes of any kind in \p AKs existing in the IR at a position that will affect this one. While each position can only have a single attribute of any kind in \p AKs, there are "subsuming" positions that could have an attribute as well. This method returns all attributes found in \p Attrs.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:395

Parameters

ArrayRef<Attribute::AttrKind> AKs
SmallVectorImpl<llvm::Attribute>& Attrs
bool IgnoreSubsumingPositions = false
Flag to determine if subsuming positions, e.g., the function position if this is an argument position, should be ignored.

llvm::Instruction* getCtxI() const

Description

Return the context instruction, if any.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:312

llvm::IRPosition::Kind getPositionKind() const

Description

Return the associated position kind.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:360

bool hasAttr(
    ArrayRef<Attribute::AttrKind> AKs,
    bool IgnoreSubsumingPositions = false) const

Description

Return true if any kind in \p AKs existing in the IR at a position that will affect this one. See also getAttrs(...).

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:384

Parameters

ArrayRef<Attribute::AttrKind> AKs
bool IgnoreSubsumingPositions = false
Flag to determine if subsuming positions, e.g., the function position if this is an argument position, should be ignored.

bool isAnyCallSitePosition() const

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:437

bool isFnInterfaceKind() const

Description

Return true if the position refers to a function interface, that is the function scope, the function return, or an argument.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:288

void removeAttrs(
    ArrayRef<Attribute::AttrKind> AKs) const

Description

Remove the attribute of kind \p AKs existing in the IR at this position.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:416

Parameters

ArrayRef<Attribute::AttrKind> AKs

static const llvm::IRPosition returned(
    const llvm::Function& F)

Description

Create a position describing the returned value of \p F.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:185

Parameters

const llvm::Function& F

static const llvm::IRPosition value(
    const llvm::Value& V)

Description

Create a position describing the value of \p V.

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:171

Parameters

const llvm::Value& V

virtual ~IRPosition()

Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:146