[mlir][openacc][NFC] move index in processDataOperands

Move the index variable used to track variables inside of the specific
processDataOperands functions.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D103924
This commit is contained in:
Valentin Clement 2021-06-09 10:28:07 -04:00 committed by clementval
parent 765ef4bb2a
commit cf84670579
1 changed files with 21 additions and 23 deletions

View File

@ -187,15 +187,15 @@ processOperands(llvm::IRBuilderBase &builder,
}
/// Process data operands from acc::EnterDataOp
static LogicalResult
processDataOperands(llvm::IRBuilderBase &builder,
LLVM::ModuleTranslation &moduleTranslation,
acc::EnterDataOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, unsigned &index,
llvm::AllocaInst *argsBase, llvm::AllocaInst *args,
llvm::AllocaInst *argSizes) {
static LogicalResult processDataOperands(
llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
acc::EnterDataOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, llvm::AllocaInst *argsBase,
llvm::AllocaInst *args, llvm::AllocaInst *argSizes) {
// TODO add `create_zero` and `attach` operands
unsigned index = 0;
// Create operands are handled as `alloc` call.
if (failed(processOperands(builder, moduleTranslation, op,
op.createOperands(), op.getNumDataOperands(),
@ -214,15 +214,15 @@ processDataOperands(llvm::IRBuilderBase &builder,
}
/// Process data operands from acc::ExitDataOp
static LogicalResult
processDataOperands(llvm::IRBuilderBase &builder,
LLVM::ModuleTranslation &moduleTranslation,
acc::ExitDataOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, unsigned &index,
llvm::AllocaInst *argsBase, llvm::AllocaInst *args,
llvm::AllocaInst *argSizes) {
static LogicalResult processDataOperands(
llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
acc::ExitDataOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, llvm::AllocaInst *argsBase,
llvm::AllocaInst *args, llvm::AllocaInst *argSizes) {
// TODO add `detach` operands
unsigned index = 0;
// Delete operands are handled as `delete` call.
if (failed(processOperands(builder, moduleTranslation, op,
op.deleteOperands(), op.getNumDataOperands(),
@ -241,13 +241,12 @@ processDataOperands(llvm::IRBuilderBase &builder,
}
/// Process data operands from acc::UpdateOp
static LogicalResult
processDataOperands(llvm::IRBuilderBase &builder,
LLVM::ModuleTranslation &moduleTranslation,
acc::UpdateOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, unsigned &index,
llvm::AllocaInst *argsBase, llvm::AllocaInst *args,
llvm::AllocaInst *argSizes) {
static LogicalResult processDataOperands(
llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
acc::UpdateOp op, SmallVector<uint64_t> &flags,
SmallVector<llvm::Constant *> &names, llvm::AllocaInst *argsBase,
llvm::AllocaInst *args, llvm::AllocaInst *argSizes) {
unsigned index = 0;
// Host operands are handled as `from` call.
if (failed(processOperands(builder, moduleTranslation, op, op.hostOperands(),
@ -305,10 +304,9 @@ convertStandaloneDataOp(OpTy &op, llvm::IRBuilderBase &builder,
SmallVector<uint64_t> flags;
SmallVector<llvm::Constant *> names;
unsigned index = 0;
if (failed(processDataOperands(builder, moduleTranslation, op, flags, names,
index, argsBase, args, argSizes)))
argsBase, args, argSizes)))
return failure();
llvm::GlobalVariable *maptypes =