LLVM  6.0.0svn
Macros | Functions | Variables
InterleavedAccessPass.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <utility>
Include dependency graph for InterleavedAccessPass.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "interleaved-access"
 

Functions

 INITIALIZE_PASS_BEGIN (InterleavedAccess, DEBUG_TYPE, "Lower interleaved memory accesses to target specific intrinsics", false, false) INITIALIZE_PASS_END(InterleavedAccess
 
static bool isDeInterleaveMaskOfFactor (ArrayRef< int > Mask, unsigned Factor, unsigned &Index)
 Check if the mask is a DE-interleave mask of the given factor Factor like: <Index, Index+Factor, ..., Index+(NumElts-1)*Factor> More...
 
static bool isDeInterleaveMask (ArrayRef< int > Mask, unsigned &Factor, unsigned &Index, unsigned MaxFactor)
 Check if the mask is a DE-interleave mask for an interleaved load. More...
 
static bool isReInterleaveMask (ArrayRef< int > Mask, unsigned &Factor, unsigned MaxFactor, unsigned OpNumElts)
 Check if the mask can be used in an interleaved store. More...
 

Variables

static cl::opt< boolLowerInterleavedAccesses ("lower-interleaved-accesses", cl::desc("Enable lowering interleaved accesses to intrinsics"), cl::init(true), cl::Hidden)
 
 DEBUG_TYPE
 
Lower interleaved memory accesses to target specific intrinsics
 
Lower interleaved memory accesses to target specific false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "interleaved-access"

Definition at line 74 of file InterleavedAccessPass.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( InterleavedAccess  ,
DEBUG_TYPE  ,
"Lower interleaved memory accesses to target specific intrinsics ,
false  ,
false   
)

◆ isDeInterleaveMask()

static bool isDeInterleaveMask ( ArrayRef< int >  Mask,
unsigned Factor,
unsigned Index,
unsigned  MaxFactor 
)
static

Check if the mask is a DE-interleave mask for an interleaved load.

E.g. DE-interleave masks (Factor = 2) could be: <0, 2, 4, 6> (mask of index 0 to extract even elements) <1, 3, 5, 7> (mask of index 1 to extract odd elements)

Definition at line 166 of file InterleavedAccessPass.cpp.

References isDeInterleaveMaskOfFactor(), and llvm::ArrayRef< T >::size().

Referenced by isReInterleaveMask().

◆ isDeInterleaveMaskOfFactor()

static bool isDeInterleaveMaskOfFactor ( ArrayRef< int >  Mask,
unsigned  Factor,
unsigned Index 
)
static

Check if the mask is a DE-interleave mask of the given factor Factor like: <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>

Definition at line 142 of file InterleavedAccessPass.cpp.

References llvm::ArrayRef< T >::size().

Referenced by isDeInterleaveMask(), and isReInterleaveMask().

◆ isReInterleaveMask()

static bool isReInterleaveMask ( ArrayRef< int >  Mask,
unsigned Factor,
unsigned  MaxFactor,
unsigned  OpNumElts 
)
static

Check if the mask can be used in an interleaved store.

It checks for a more general pattern than the RE-interleave mask. I.e. <x, y, ... z, x+1, y+1, ...z+1, x+2, y+2, ...z+2, ...> E.g. For a Factor of 2 (LaneLen=4): <4, 32, 5, 33, 6, 34, 7, 35> E.g. For a Factor of 3 (LaneLen=4): <4, 32, 16, 5, 33, 17, 6, 34, 18, 7, 35, 19> E.g. For a Factor of 4 (LaneLen=2): <8, 2, 12, 4, 9, 3, 13, 5>

The particular case of an RE-interleave mask is: I.e. <0, LaneLen, ... , LaneLen*(Factor - 1), 1, LaneLen + 1, ...> E.g. For a Factor of 2 (LaneLen=4): <0, 4, 1, 5, 2, 6, 3, 7>

Definition at line 190 of file InterleavedAccessPass.cpp.

References assert(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::IRBuilder< T, Inserter >::CreateExtractElement(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), E, llvm::SmallVectorBase::empty(), llvm::ArrayRef< T >::empty(), F(), llvm::Value::getName(), llvm::User::getOperand(), llvm::ShuffleVectorInst::getShuffleMask(), getType(), llvm::Value::getType(), llvm::StoreInst::getValueOperand(), llvm::Type::getVectorNumElements(), llvm::Value::hasOneUse(), I, llvm::instructions(), isDeInterleaveMask(), isDeInterleaveMaskOfFactor(), llvm::isPowerOf2_32(), llvm::LoadInst::isSimple(), llvm::StoreInst::isSimple(), LowerInterleavedAccesses, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), runOnFunction(), llvm::IRBuilderBase::SetInsertPoint(), SI, llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::ArrayRef< T >::size(), llvm::SystemZISD::TM, llvm::Value::user_begin(), and llvm::Value::user_end().

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 131 of file InterleavedAccessPass.cpp.

◆ false

Lower interleaved memory accesses to target specific false

Definition at line 131 of file InterleavedAccessPass.cpp.

◆ intrinsics

Lower interleaved memory accesses to target specific intrinsics

Definition at line 131 of file InterleavedAccessPass.cpp.

◆ LowerInterleavedAccesses

cl::opt<bool> LowerInterleavedAccesses("lower-interleaved-accesses", cl::desc("Enable lowering interleaved accesses to intrinsics"), cl::init(true), cl::Hidden)
static

Referenced by isReInterleaveMask().