summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-07-01 10:29:09 -0700
committerjpienaar <jpienaar@google.com>2019-07-01 11:39:00 -0700
commit54cd6a7e97a226738e2c85b86559918dd9e3cd5d (patch)
treeaffa803347d6695be575137d1ad55a055a8021e3 /mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
parent84bd67fc4fd116e80f7a66bfadfe9a7fd6fd5e82 (diff)
downloadbcm5719-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/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp')
-rw-r--r--mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
index 872707842d7..e849f6fd023 100644
--- a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
@@ -441,13 +441,14 @@ struct AllocOpLowering : public LLVMLegalizationPattern<AllocOp> {
createIndexConstant(rewriter, op->getLoc(), elementSize)});
// Insert the `malloc` declaration if it is not already present.
- Function *mallocFunc =
- op->getFunction()->getModule()->getNamedFunction("malloc");
+ Function mallocFunc =
+ op->getFunction().getModule()->getNamedFunction("malloc");
if (!mallocFunc) {
auto mallocType =
rewriter.getFunctionType(getIndexType(), getVoidPtrType());
- mallocFunc = new Function(rewriter.getUnknownLoc(), "malloc", mallocType);
- op->getFunction()->getModule()->getFunctions().push_back(mallocFunc);
+ mallocFunc =
+ Function::create(rewriter.getUnknownLoc(), "malloc", mallocType);
+ op->getFunction().getModule()->push_back(mallocFunc);
}
// Allocate the underlying buffer and store a pointer to it in the MemRef
@@ -502,12 +503,11 @@ struct DeallocOpLowering : public LLVMLegalizationPattern<DeallocOp> {
OperandAdaptor<DeallocOp> transformed(operands);
// Insert the `free` declaration if it is not already present.
- Function *freeFunc =
- op->getFunction()->getModule()->getNamedFunction("free");
+ Function freeFunc = op->getFunction().getModule()->getNamedFunction("free");
if (!freeFunc) {
auto freeType = rewriter.getFunctionType(getVoidPtrType(), {});
- freeFunc = new Function(rewriter.getUnknownLoc(), "free", freeType);
- op->getFunction()->getModule()->getFunctions().push_back(freeFunc);
+ freeFunc = Function::create(rewriter.getUnknownLoc(), "free", freeType);
+ op->getFunction().getModule()->push_back(freeFunc);
}
auto type = transformed.memref()->getType().cast<LLVM::LLVMType>();
@@ -937,7 +937,7 @@ static void ensureDistinctSuccessors(Block &bb) {
}
void mlir::LLVM::ensureDistinctSuccessors(Module *m) {
- for (auto &f : *m) {
+ for (auto f : *m) {
for (auto &bb : f.getBlocks()) {
::ensureDistinctSuccessors(bb);
}
OpenPOWER on IntegriCloud