summaryrefslogtreecommitdiffstats
path: root/mlir/examples
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/examples')
-rw-r--r--mlir/examples/Linalg/Linalg3/lib/Transforms.cpp2
-rw-r--r--mlir/examples/toy/Ch1/include/toy/Parser.h40
-rw-r--r--mlir/examples/toy/Ch2/include/toy/Parser.h40
-rw-r--r--mlir/examples/toy/Ch2/mlir/MLIRGen.cpp4
-rw-r--r--mlir/examples/toy/Ch3/include/toy/Parser.h40
-rw-r--r--mlir/examples/toy/Ch3/mlir/MLIRGen.cpp4
-rw-r--r--mlir/examples/toy/Ch4/include/toy/Parser.h40
-rw-r--r--mlir/examples/toy/Ch4/mlir/MLIRGen.cpp4
-rw-r--r--mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp2
-rw-r--r--mlir/examples/toy/Ch5/include/toy/Parser.h40
-rw-r--r--mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp2
-rw-r--r--mlir/examples/toy/Ch5/mlir/LateLowering.cpp2
-rw-r--r--mlir/examples/toy/Ch5/mlir/MLIRGen.cpp4
-rw-r--r--mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp2
14 files changed, 108 insertions, 118 deletions
diff --git a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
index 79fa4ca34f2..8731138bba5 100644
--- a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
+++ b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
@@ -301,5 +301,5 @@ Rewriter<linalg::StoreOp>::matchAndRewrite(linalg::StoreOp store,
} // namespace
std::unique_ptr<FunctionPassBase> linalg::createLowerLinalgLoadStorePass() {
- return llvm::make_unique<LowerLinalgLoadStorePass>();
+ return std::make_unique<LowerLinalgLoadStorePass>();
}
diff --git a/mlir/examples/toy/Ch1/include/toy/Parser.h b/mlir/examples/toy/Ch1/include/toy/Parser.h
index bc7aa520624..75c660b7c78 100644
--- a/mlir/examples/toy/Ch1/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch1/include/toy/Parser.h
@@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
- return llvm::make_unique<ModuleAST>(std::move(functions));
+ return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
- return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
+ return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
- llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
+ std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
- return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
- std::move(dims));
+ return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
+ std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
- return llvm::make_unique<PrintExprAST>(std::move(loc),
- std::move(Args[0]));
+ return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
- return llvm::make_unique<CallExprAST>(std::move(loc), name,
- std::move(Args));
+ return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
- std::move(LHS), std::move(RHS));
+ LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
+ std::move(LHS), std::move(RHS));
}
}
@@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
- auto type = llvm::make_unique<VarType>();
+ auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@@ -341,11 +339,11 @@ private:
}
if (!type)
- type = llvm::make_unique<VarType>();
+ type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
- return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
- std::move(*type), std::move(expr));
+ return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
+ std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
- auto exprList = llvm::make_unique<ExprASTList>();
+ auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
- auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
- return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
- std::move(args));
+ return std::make_unique<PrototypeAST>(std::move(loc), FnName,
+ std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}
diff --git a/mlir/examples/toy/Ch2/include/toy/Parser.h b/mlir/examples/toy/Ch2/include/toy/Parser.h
index bc7aa520624..75c660b7c78 100644
--- a/mlir/examples/toy/Ch2/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch2/include/toy/Parser.h
@@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
- return llvm::make_unique<ModuleAST>(std::move(functions));
+ return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
- return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
+ return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
- llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
+ std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
- return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
- std::move(dims));
+ return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
+ std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
- return llvm::make_unique<PrintExprAST>(std::move(loc),
- std::move(Args[0]));
+ return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
- return llvm::make_unique<CallExprAST>(std::move(loc), name,
- std::move(Args));
+ return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
- std::move(LHS), std::move(RHS));
+ LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
+ std::move(LHS), std::move(RHS));
}
}
@@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
- auto type = llvm::make_unique<VarType>();
+ auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@@ -341,11 +339,11 @@ private:
}
if (!type)
- type = llvm::make_unique<VarType>();
+ type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
- return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
- std::move(*type), std::move(expr));
+ return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
+ std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
- auto exprList = llvm::make_unique<ExprASTList>();
+ auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
- auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
- return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
- std::move(args));
+ return std::make_unique<PrototypeAST>(std::move(loc), FnName,
+ std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}
diff --git a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
index 7b874b92cc4..c09c4ad679c 100644
--- a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
@@ -43,11 +43,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
-using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
+using std::make_unique;
namespace {
@@ -172,7 +172,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
- builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
+ builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {
diff --git a/mlir/examples/toy/Ch3/include/toy/Parser.h b/mlir/examples/toy/Ch3/include/toy/Parser.h
index bc7aa520624..75c660b7c78 100644
--- a/mlir/examples/toy/Ch3/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch3/include/toy/Parser.h
@@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
- return llvm::make_unique<ModuleAST>(std::move(functions));
+ return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
- return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
+ return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
- llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
+ std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
- return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
- std::move(dims));
+ return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
+ std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
- return llvm::make_unique<PrintExprAST>(std::move(loc),
- std::move(Args[0]));
+ return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
- return llvm::make_unique<CallExprAST>(std::move(loc), name,
- std::move(Args));
+ return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
- std::move(LHS), std::move(RHS));
+ LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
+ std::move(LHS), std::move(RHS));
}
}
@@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
- auto type = llvm::make_unique<VarType>();
+ auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@@ -341,11 +339,11 @@ private:
}
if (!type)
- type = llvm::make_unique<VarType>();
+ type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
- return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
- std::move(*type), std::move(expr));
+ return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
+ std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
- auto exprList = llvm::make_unique<ExprASTList>();
+ auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
- auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
- return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
- std::move(args));
+ return std::make_unique<PrototypeAST>(std::move(loc), FnName,
+ std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}
diff --git a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
index e3b06a7f7df..b3ba2f9281c 100644
--- a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
@@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
-using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
+using std::make_unique;
namespace {
@@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
- builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
+ builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {
diff --git a/mlir/examples/toy/Ch4/include/toy/Parser.h b/mlir/examples/toy/Ch4/include/toy/Parser.h
index bc7aa520624..75c660b7c78 100644
--- a/mlir/examples/toy/Ch4/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch4/include/toy/Parser.h
@@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
- return llvm::make_unique<ModuleAST>(std::move(functions));
+ return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
- return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
+ return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
- llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
+ std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
- return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
- std::move(dims));
+ return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
+ std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
- return llvm::make_unique<PrintExprAST>(std::move(loc),
- std::move(Args[0]));
+ return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
- return llvm::make_unique<CallExprAST>(std::move(loc), name,
- std::move(Args));
+ return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
- std::move(LHS), std::move(RHS));
+ LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
+ std::move(LHS), std::move(RHS));
}
}
@@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
- auto type = llvm::make_unique<VarType>();
+ auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@@ -341,11 +339,11 @@ private:
}
if (!type)
- type = llvm::make_unique<VarType>();
+ type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
- return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
- std::move(*type), std::move(expr));
+ return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
+ std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
- auto exprList = llvm::make_unique<ExprASTList>();
+ auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
- auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
- return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
- std::move(args));
+ return std::make_unique<PrototypeAST>(std::move(loc), FnName,
+ std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}
diff --git a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
index e61d1aaa99d..fd385a47004 100644
--- a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
@@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
-using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
+using std::make_unique;
namespace {
@@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
- builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
+ builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {
diff --git a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
index 4a6bf8790e0..793f153291e 100644
--- a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
+++ b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
@@ -376,6 +376,6 @@ public:
namespace toy {
std::unique_ptr<mlir::Pass> createShapeInferencePass() {
- return llvm::make_unique<ShapeInferencePass>();
+ return std::make_unique<ShapeInferencePass>();
}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/include/toy/Parser.h b/mlir/examples/toy/Ch5/include/toy/Parser.h
index bc7aa520624..75c660b7c78 100644
--- a/mlir/examples/toy/Ch5/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch5/include/toy/Parser.h
@@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
- return llvm::make_unique<ModuleAST>(std::move(functions));
+ return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
- return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
+ return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
- llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
+ std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
- return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
- std::move(dims));
+ return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
+ std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
- return llvm::make_unique<PrintExprAST>(std::move(loc),
- std::move(Args[0]));
+ return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
- return llvm::make_unique<CallExprAST>(std::move(loc), name,
- std::move(Args));
+ return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
- std::move(LHS), std::move(RHS));
+ LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
+ std::move(LHS), std::move(RHS));
}
}
@@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
- auto type = llvm::make_unique<VarType>();
+ auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@@ -341,11 +339,11 @@ private:
}
if (!type)
- type = llvm::make_unique<VarType>();
+ type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
- return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
- std::move(*type), std::move(expr));
+ return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
+ std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
- auto exprList = llvm::make_unique<ExprASTList>();
+ auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
- auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
+ auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
- return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
- std::move(args));
+ return std::make_unique<PrototypeAST>(std::move(loc), FnName,
+ std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}
diff --git a/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp b/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
index 96230fdfbea..c55a0dbd949 100644
--- a/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
+++ b/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
@@ -143,6 +143,6 @@ struct EarlyLoweringPass : public FunctionPass<EarlyLoweringPass> {
namespace toy {
std::unique_ptr<mlir::Pass> createEarlyLoweringPass() {
- return llvm::make_unique<EarlyLoweringPass>();
+ return std::make_unique<EarlyLoweringPass>();
}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/mlir/LateLowering.cpp b/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
index 29d83aeb663..8146e763303 100644
--- a/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
+++ b/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
@@ -455,6 +455,6 @@ struct LateLoweringPass : public ModulePass<LateLoweringPass> {
namespace toy {
std::unique_ptr<mlir::Pass> createLateLoweringPass() {
- return llvm::make_unique<LateLoweringPass>();
+ return std::make_unique<LateLoweringPass>();
}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
index 8d7d169c7d2..88fb95048da 100644
--- a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
@@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
-using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
+using std::make_unique;
namespace {
@@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
- builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
+ builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {
diff --git a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
index 6437c0b3f73..b6808d713eb 100644
--- a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
+++ b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
@@ -376,6 +376,6 @@ public:
namespace toy {
std::unique_ptr<mlir::Pass> createShapeInferencePass() {
- return llvm::make_unique<ShapeInferencePass>();
+ return std::make_unique<ShapeInferencePass>();
}
} // namespace toy
OpenPOWER on IntegriCloud