forked from OSchip/llvm-project
Detemplatize ModuleTranslation::lookupValues
This function template has been introduced in the early days of MLIR to work around the absence of common type for ranges of values (operands, block argumeents, vectors, etc). Core IR now provides ValueRange for exactly this purpose. Use it instead of the template parameter. PiperOrigin-RevId: 286431338
This commit is contained in:
parent
50f9be6d2d
commit
efadb6b838
|
@ -87,16 +87,8 @@ protected:
|
|||
llvm::IRBuilder<> &builder);
|
||||
static std::unique_ptr<llvm::Module> prepareLLVMModule(Operation *m);
|
||||
|
||||
// A helper to look up remapped operands in the value remapping table.
|
||||
template <typename Range>
|
||||
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;
|
||||
}
|
||||
/// A helper to look up remapped operands in the value remapping table.
|
||||
SmallVector<llvm::Value *, 8> lookupValues(ValueRange values);
|
||||
|
||||
private:
|
||||
/// Check whether the module contains only supported ops directly in its body.
|
||||
|
|
|
@ -492,6 +492,16 @@ LogicalResult ModuleTranslation::convertFunctions() {
|
|||
return success();
|
||||
}
|
||||
|
||||
/// A helper to look up remapped operands in the value remapping table.`
|
||||
SmallVector<llvm::Value *, 8>
|
||||
ModuleTranslation::lookupValues(ValueRange values) {
|
||||
SmallVector<llvm::Value *, 8> remapped;
|
||||
remapped.reserve(values.size());
|
||||
for (Value *v : values)
|
||||
remapped.push_back(valueMapping.lookup(v));
|
||||
return remapped;
|
||||
}
|
||||
|
||||
std::unique_ptr<llvm::Module>
|
||||
ModuleTranslation::prepareLLVMModule(Operation *m) {
|
||||
auto *dialect = m->getContext()->getRegisteredDialect<LLVM::LLVMDialect>();
|
||||
|
|
Loading…
Reference in New Issue