Move function template definition to the header file. NFC

The definition of the function template LLVM::ModuleTranslation::lookupValues
has been located in a source file. As long as it has been the only file that
actually called into the function, this did not cause any problem. However, it
creates linking issues if the function is used from other translation units.

PiperOrigin-RevId: 286203078
This commit is contained in:
Alex Zinenko 2019-12-18 09:04:42 -08:00 committed by A. Unique TensorFlower
parent abcf5ff0cc
commit 24ab8362f2
2 changed files with 9 additions and 12 deletions

View File

@ -87,8 +87,16 @@ protected:
llvm::IRBuilder<> &builder); llvm::IRBuilder<> &builder);
static std::unique_ptr<llvm::Module> prepareLLVMModule(Operation *m); static std::unique_ptr<llvm::Module> prepareLLVMModule(Operation *m);
// A helper to look up remapped operands in the value remapping table.
template <typename Range> template <typename Range>
SmallVector<llvm::Value *, 8> lookupValues(Range &&values); SmallVector<llvm::Value *, 8> lookupValues(Range &&values) {
SmallVector<llvm::Value *, 8> remapped;
remapped.reserve(llvm::size(values));
for (Value *v : values) {
remapped.push_back(valueMapping.lookup(v));
}
return remapped;
}
private: private:
/// Check whether the module contains only supported ops directly in its body. /// Check whether the module contains only supported ops directly in its body.

View File

@ -159,17 +159,6 @@ static llvm::CmpInst::Predicate getLLVMCmpPredicate(FCmpPredicate p) {
llvm_unreachable("incorrect comparison predicate"); llvm_unreachable("incorrect comparison predicate");
} }
// A helper to look up remapped operands in the value remapping table.
template <typename Range>
SmallVector<llvm::Value *, 8> ModuleTranslation::lookupValues(Range &&values) {
SmallVector<llvm::Value *, 8> remapped;
remapped.reserve(llvm::size(values));
for (Value *v : values) {
remapped.push_back(valueMapping.lookup(v));
}
return remapped;
}
// Given a single MLIR operation, create the corresponding LLVM IR operation // Given a single MLIR operation, create the corresponding LLVM IR operation
// using the `builder`. LLVM IR Builder does not have a generic interface so // using the `builder`. LLVM IR Builder does not have a generic interface so
// this has to be a long chain of `if`s calling different functions with a // this has to be a long chain of `if`s calling different functions with a