diff options
author | River Riddle <riverriddle@google.com> | 2019-07-01 10:29:09 -0700 |
---|---|---|
committer | jpienaar <jpienaar@google.com> | 2019-07-01 11:39:00 -0700 |
commit | 54cd6a7e97a226738e2c85b86559918dd9e3cd5d (patch) | |
tree | affa803347d6695be575137d1ad55a055a8021e3 /mlir/lib/Target | |
parent | 84bd67fc4fd116e80f7a66bfadfe9a7fd6fd5e82 (diff) | |
download | bcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.tar.gz bcm5719-llvm-54cd6a7e97a226738e2c85b86559918dd9e3cd5d.zip |
NFC: Refactor Function to be value typed.
Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed).
PiperOrigin-RevId: 255983022
Diffstat (limited to 'mlir/lib/Target')
-rw-r--r-- | mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp | 31 | ||||
-rw-r--r-- | mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 4 |
2 files changed, 18 insertions, 17 deletions
diff --git a/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp index 74ade942fc7..1e8409246ef 100644 --- a/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp +++ b/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp @@ -69,7 +69,7 @@ std::unique_ptr<llvm::Module> mlir::translateModuleToNVVMIR(Module &m) { // Insert the nvvm.annotations kernel so that the NVVM backend recognizes the // function as a kernel. - for (Function &func : m) { + for (Function func : m) { if (!func.getAttrOfType<UnitAttr>(gpu::GPUDialect::getKernelFuncAttrName())) continue; @@ -89,20 +89,21 @@ std::unique_ptr<llvm::Module> mlir::translateModuleToNVVMIR(Module &m) { return llvmModule; } -static TranslateFromMLIRRegistration registration( - "mlir-to-nvvmir", [](Module *module, llvm::StringRef outputFilename) { - if (!module) - return true; +static TranslateFromMLIRRegistration + registration("mlir-to-nvvmir", + [](Module *module, llvm::StringRef outputFilename) { + if (!module) + return true; - auto llvmModule = mlir::translateModuleToNVVMIR(*module); - if (!llvmModule) - return true; + auto llvmModule = mlir::translateModuleToNVVMIR(*module); + if (!llvmModule) + return true; - auto file = openOutputFile(outputFilename); - if (!file) - return true; + auto file = openOutputFile(outputFilename); + if (!file) + return true; - llvmModule->print(file->os(), nullptr); - file->keep(); - return false; - }); + llvmModule->print(file->os(), nullptr); + file->keep(); + return false; + }); diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index ef286cb64fd..4a68ac71ee0 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -375,7 +375,7 @@ bool ModuleTranslation::convertOneFunction(Function &func) { bool ModuleTranslation::convertFunctions() { // Declare all functions first because there may be function calls that form a // call graph with cycles. - for (Function &function : mlirModule) { + for (Function function : mlirModule) { mlir::BoolAttr isVarArgsAttr = function.getAttrOfType<BoolAttr>("std.varargs"); bool isVarArgs = isVarArgsAttr && isVarArgsAttr.getValue(); @@ -392,7 +392,7 @@ bool ModuleTranslation::convertFunctions() { } // Convert functions. - for (Function &function : mlirModule) { + for (Function function : mlirModule) { // Ignore external functions. if (function.isExternal()) continue; |