class Negator

Declaration

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

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:765

Member Variables

private SmallVector<llvm::Instruction*, NegatorMaxNodesSSO> NewInstructions
Top-to-bottom, def-to-use negated instruction tree we produced.
private llvm::Negator::BuilderTy Builder
private const llvm::DataLayout& DL
private llvm::AssumptionCache& AC
private const llvm::DominatorTree& DT
private const bool IsTrulyNegation
private SmallDenseMap<llvm::Value*, llvm::Value*> NegationsCache
private unsigned int NumValuesVisitedInThisNegator = 0

Method Overview

  • public static llvm::Value * Negate(bool LHSIsZero, llvm::Value * Root, llvm::InstCombinerImpl & IC)
  • private Negator(llvm::LLVMContext & C, const llvm::DataLayout & DL, llvm::AssumptionCache & AC, const llvm::DominatorTree & DT, bool IsTrulyNegation)
  • private Negator(const llvm::Negator &)
  • private Negator(llvm::Negator &&)
  • private std::array<Value *, 2> getSortedOperandsOfBinOp(llvm::Instruction * I)
  • private llvm::Value * negate(llvm::Value * V, unsigned int Depth)
  • private Optional<llvm::Negator::Result> run(llvm::Value * Root)
  • private llvm::Value * visitImpl(llvm::Value * V, unsigned int Depth)
  • private ~Negator()

Methods

static llvm::Value* Negate(
    bool LHSIsZero,
    llvm::Value* Root,
    llvm::InstCombinerImpl& IC)

Description

Attempt to negate \p Root. Retuns nullptr if negation can't be performed, otherwise returns negated value.

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:809

Parameters

bool LHSIsZero
llvm::Value* Root
llvm::InstCombinerImpl& IC

Negator(llvm::LLVMContext& C,
        const llvm::DataLayout& DL,
        llvm::AssumptionCache& AC,
        const llvm::DominatorTree& DT,
        bool IsTrulyNegation)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:780

Parameters

llvm::LLVMContext& C
const llvm::DataLayout& DL
llvm::AssumptionCache& AC
const llvm::DominatorTree& DT
bool IsTrulyNegation

Negator(const llvm::Negator&)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:801

Parameters

const llvm::Negator&

Negator(llvm::Negator&&)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:802

Parameters

llvm::Negator&&

std::array<Value*, 2> getSortedOperandsOfBinOp(
    llvm::Instruction* I)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:791

Parameters

llvm::Instruction* I

llvm::Value* negate(llvm::Value* V,
                    unsigned int Depth)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:795

Parameters

llvm::Value* V
unsigned int Depth

Optional<llvm::Negator::Result> run(
    llvm::Value* Root)

Description

Recurse depth-first and attempt to sink the negation. FIXME: use worklist?

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:799

Parameters

llvm::Value* Root

llvm::Value* visitImpl(llvm::Value* V,
                       unsigned int Depth)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:793

Parameters

llvm::Value* V
unsigned int Depth

~Negator()

Declared at: llvm/lib/Transforms/InstCombine/InstCombineInternal.h:785