LLVM  14.0.0git
Classes | Namespaces | Macros | Functions | Variables
NVPTXLowerArgs.cpp File Reference
#include "NVPTX.h"
#include "NVPTXTargetMachine.h"
#include "NVPTXUtilities.h"
#include "MCTargetDesc/NVPTXBaseInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Pass.h"
Include dependency graph for NVPTXLowerArgs.cpp:

Go to the source code of this file.

Classes

struct  IP
 

Namespaces

 llvm
 ---------------------— PointerInfo ------------------------------------—
 

Macros

#define DEBUG_TYPE   "nvptx-lower-args"
 

Functions

void llvm::initializeNVPTXLowerArgsPass (PassRegistry &)
 
 INITIALIZE_PASS (NVPTXLowerArgs, "nvptx-lower-args", "Lower arguments (NVPTX)", false, false) static void convertToParamAS(Value *OldUser
 
 assert (I &&"OldUser must be an instruction")
 
 while (!ItemsToConvert.empty())
 

Variables

ValueParam
 
SmallVector< IPItemsToConvert = {{I, Param}}
 
SmallVector< Instruction * > InstructionsToDelete
 
auto CloneInstInParamAS
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "nvptx-lower-args"

Definition at line 102 of file NVPTXLowerArgs.cpp.

Function Documentation

◆ assert()

assert ( I &&"OldUser must be an instruction )

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( NVPTXLowerArgs  ,
"nvptx-lower-args"  ,
"Lower arguments (NVPTX)"  ,
false  ,
false   
)

◆ while()

while ( !ItemsToConvert.  empty())

Variable Documentation

◆ CloneInstInParamAS

auto CloneInstInParamAS
Initial value:
= [](const IP &I) -> Value * {
if (auto *LI = dyn_cast<LoadInst>(I.OldInstruction)) {
LI->setOperand(0, I.NewParam);
return LI;
}
if (auto *GEP = dyn_cast<GetElementPtrInst>(I.OldInstruction)) {
SmallVector<Value *, 4> Indices(GEP->indices());
auto *NewGEP = GetElementPtrInst::Create(GEP->getSourceElementType(),
I.NewParam, Indices,
GEP->getName(), GEP);
NewGEP->setIsInBounds(GEP->isInBounds());
return NewGEP;
}
if (auto *BC = dyn_cast<BitCastInst>(I.OldInstruction)) {
auto *NewBCType = PointerType::getWithSamePointeeType(
cast<PointerType>(BC->getType()), ADDRESS_SPACE_PARAM);
return BitCastInst::Create(BC->getOpcode(), I.NewParam, NewBCType,
BC->getName(), BC);
}
if (auto *ASC = dyn_cast<AddrSpaceCastInst>(I.OldInstruction)) {
assert(ASC->getDestAddressSpace() == ADDRESS_SPACE_PARAM);
(void)ASC;
return I.NewParam;
}
llvm_unreachable("Unsupported instruction");
}

Definition at line 173 of file NVPTXLowerArgs.cpp.

Referenced by while().

◆ InstructionsToDelete

SmallVector<Instruction *> InstructionsToDelete

Definition at line 171 of file NVPTXLowerArgs.cpp.

Referenced by while().

◆ ItemsToConvert

SmallVector<IP> ItemsToConvert = {{I, Param}}

Definition at line 170 of file NVPTXLowerArgs.cpp.

Referenced by while().

◆ Param

Value* Param
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::ADDRESS_SPACE_PARAM
@ ADDRESS_SPACE_PARAM
Definition: NVPTXBaseInfo.h:29
assert
assert(I &&"OldUser must be an instruction")
IP
Definition: NVPTXLowerArgs.cpp:166
llvm::Instruction
Definition: Instruction.h:45
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
GEP
Hexagon Common GEP
Definition: HexagonCommonGEP.cpp:172
llvm::Value
LLVM Value Representation.
Definition: Value.h:75