mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
[llvm] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
This commit is contained in:
parent
2cf884bb0b
commit
2c693415b7
@ -174,7 +174,7 @@ checking omitted for brevity) as:
|
||||
|
||||
ExecutionSession ES;
|
||||
RTDyldObjectLinkingLayer ObjLinkingLayer(
|
||||
ES, []() { return llvm::make_unique<SectionMemoryManager>(); });
|
||||
ES, []() { return std::make_unique<SectionMemoryManager>(); });
|
||||
CXXCompileLayer CXXLayer(ES, ObjLinkingLayer);
|
||||
|
||||
// Create JITDylib "A" and add code to it using the CXX layer.
|
||||
@ -453,7 +453,7 @@ std::unique_ptr<LLVMContext>:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
|
||||
ThreadSafeContext TSCtx(std::make_unique<LLVMContext>());
|
||||
|
||||
ThreadSafeModules can be constructed from a pair of a std::unique_ptr<Module>
|
||||
and a ThreadSafeContext value. ThreadSafeContext values may be shared between
|
||||
@ -462,10 +462,10 @@ multiple ThreadSafeModules:
|
||||
.. code-block:: c++
|
||||
|
||||
ThreadSafeModule TSM1(
|
||||
llvm::make_unique<Module>("M1", *TSCtx.getContext()), TSCtx);
|
||||
std::make_unique<Module>("M1", *TSCtx.getContext()), TSCtx);
|
||||
|
||||
ThreadSafeModule TSM2(
|
||||
llvm::make_unique<Module>("M2", *TSCtx.getContext()), TSCtx);
|
||||
std::make_unique<Module>("M2", *TSCtx.getContext()), TSCtx);
|
||||
|
||||
Before using a ThreadSafeContext, clients should ensure that either the context
|
||||
is only accessible on the current thread, or that the context is locked. In the
|
||||
@ -476,7 +476,7 @@ or creating any Modules attached to it. E.g.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
|
||||
ThreadSafeContext TSCtx(std::make_unique<LLVMContext>());
|
||||
|
||||
ThreadPool TP(NumThreads);
|
||||
JITStack J;
|
||||
@ -519,8 +519,8 @@ constructs a new ThreadSafeContext value from a std::unique_ptr<LLVMContext>:
|
||||
// Maximize concurrency opportunities by loading every module on a
|
||||
// separate context.
|
||||
for (const auto &IRPath : IRPaths) {
|
||||
auto Ctx = llvm::make_unique<LLVMContext>();
|
||||
auto M = llvm::make_unique<LLVMContext>("M", *Ctx);
|
||||
auto Ctx = std::make_unique<LLVMContext>();
|
||||
auto M = std::make_unique<LLVMContext>("M", *Ctx);
|
||||
CompileLayer.add(ES.getMainJITDylib(),
|
||||
ThreadSafeModule(std::move(M), std::move(Ctx)));
|
||||
}
|
||||
@ -531,7 +531,7 @@ all modules on the same context:
|
||||
.. code-block:: c++
|
||||
|
||||
// Save memory by using one context for all Modules:
|
||||
ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
|
||||
ThreadSafeContext TSCtx(std::make_unique<LLVMContext>());
|
||||
for (const auto &IRPath : IRPaths) {
|
||||
ThreadSafeModule TSM(parsePath(IRPath, *TSCtx.getContext()), TSCtx);
|
||||
CompileLayer.add(ES.getMainJITDylib(), ThreadSafeModule(std::move(TSM));
|
||||
|
@ -138,10 +138,10 @@ usual include guards and #includes [2]_, we get to the definition of our class:
|
||||
public:
|
||||
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
|
||||
: ObjectLayer(ES,
|
||||
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
|
||||
[]() { return std::make_unique<SectionMemoryManager>(); }),
|
||||
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
|
||||
DL(std::move(DL)), Mangle(ES, this->DL),
|
||||
Ctx(llvm::make_unique<LLVMContext>()) {
|
||||
Ctx(std::make_unique<LLVMContext>()) {
|
||||
ES.getMainJITDylib().setGenerator(
|
||||
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
|
||||
}
|
||||
@ -195,7 +195,7 @@ REPL process as well. We do this by attaching a
|
||||
if (!DL)
|
||||
return DL.takeError();
|
||||
|
||||
return llvm::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
return std::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
}
|
||||
|
||||
const DataLayout &getDataLayout() const { return DL; }
|
||||
|
@ -71,11 +71,11 @@ apply to each Module that is added via addModule:
|
||||
|
||||
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
|
||||
: ObjectLayer(ES,
|
||||
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
|
||||
[]() { return std::make_unique<SectionMemoryManager>(); }),
|
||||
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
|
||||
TransformLayer(ES, CompileLayer, optimizeModule),
|
||||
DL(std::move(DL)), Mangle(ES, this->DL),
|
||||
Ctx(llvm::make_unique<LLVMContext>()) {
|
||||
Ctx(std::make_unique<LLVMContext>()) {
|
||||
ES.getMainJITDylib().setGenerator(
|
||||
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
|
||||
}
|
||||
@ -102,7 +102,7 @@ Next we need to update our addModule method to replace the call to
|
||||
static Expected<ThreadSafeModule>
|
||||
optimizeModule(ThreadSafeModule M, const MaterializationResponsibility &R) {
|
||||
// Create a function pass manager.
|
||||
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
|
||||
// Add some optimizations.
|
||||
FPM->add(createInstructionCombiningPass());
|
||||
@ -213,7 +213,7 @@ class:
|
||||
.. code-block:: c++
|
||||
|
||||
Error IRLayer::add(JITDylib &JD, ThreadSafeModule TSM, VModuleKey K) {
|
||||
return JD.define(llvm::make_unique<BasicIRLayerMaterializationUnit>(
|
||||
return JD.define(std::make_unique<BasicIRLayerMaterializationUnit>(
|
||||
*this, std::move(K), std::move(TSM)));
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,8 @@ be generated with calls like this:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
auto LHS = llvm::make_unique<VariableExprAST>("x");
|
||||
auto RHS = llvm::make_unique<VariableExprAST>("y");
|
||||
auto LHS = std::make_unique<VariableExprAST>("x");
|
||||
auto RHS = std::make_unique<VariableExprAST>("y");
|
||||
auto Result = std::make_unique<BinaryExprAST>('+', std::move(LHS),
|
||||
std::move(RHS));
|
||||
|
||||
@ -210,7 +210,7 @@ which parses that production. For numeric literals, we have:
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -276,7 +276,7 @@ function calls:
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -300,7 +300,7 @@ function calls:
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
This routine follows the same style as the other routines. (It expects
|
||||
@ -503,7 +503,7 @@ then continue parsing:
|
||||
}
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS = llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
LHS = std::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
std::move(RHS));
|
||||
} // loop around to the top of the while loop.
|
||||
}
|
||||
@ -533,7 +533,7 @@ above two blocks duplicated for context):
|
||||
return nullptr;
|
||||
}
|
||||
// Merge LHS/RHS.
|
||||
LHS = llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
LHS = std::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
std::move(RHS));
|
||||
} // loop around to the top of the while loop.
|
||||
}
|
||||
@ -593,7 +593,7 @@ expressions):
|
||||
// success.
|
||||
getNextToken(); // eat ')'.
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
}
|
||||
|
||||
Given this, a function definition is very simple, just a prototype plus
|
||||
@ -608,7 +608,7 @@ an expression to implement the body:
|
||||
if (!Proto) return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -634,8 +634,8 @@ nullary (zero argument) functions for them:
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("", std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
auto Proto = std::make_unique<PrototypeAST>("", std::vector<std::string>());
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -141,10 +141,10 @@ for us:
|
||||
|
||||
void InitializeModuleAndPassManager(void) {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<FunctionPassManager>(TheModule.get());
|
||||
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
TheFPM->add(createInstructionCombiningPass());
|
||||
@ -259,7 +259,7 @@ adding a global variable ``TheJIT``, and initializing it in
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
// Run the main "interpreter loop" now.
|
||||
MainLoop();
|
||||
@ -273,11 +273,11 @@ We also need to setup the data layout for the JIT:
|
||||
|
||||
void InitializeModuleAndPassManager(void) {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<FunctionPassManager>(TheModule.get());
|
||||
...
|
||||
|
||||
The KaleidoscopeJIT class is a simple JIT built specifically for these
|
||||
|
@ -146,7 +146,7 @@ First we define a new parsing function:
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ value to null in the AST node:
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start),
|
||||
std::move(End), std::move(Step),
|
||||
std::move(Body));
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ user-defined operator, we need to parse it:
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames), Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames), Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ simple: we'll add a new function to do it:
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,7 @@ AST node:
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames),
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames),
|
||||
std::move(Body));
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,8 @@ statement be our "main":
|
||||
|
||||
.. code-block:: udiff
|
||||
|
||||
- auto Proto = llvm::make_unique<PrototypeAST>("", std::vector<std::string>());
|
||||
+ auto Proto = llvm::make_unique<PrototypeAST>("main", std::vector<std::string>());
|
||||
- auto Proto = std::make_unique<PrototypeAST>("", std::vector<std::string>());
|
||||
+ auto Proto = std::make_unique<PrototypeAST>("main", std::vector<std::string>());
|
||||
|
||||
just with the simple change of giving it a name.
|
||||
|
||||
@ -325,7 +325,7 @@ that we pass down through when we create a new expression:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
LHS = llvm::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
|
||||
LHS = std::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
|
||||
std::move(RHS));
|
||||
|
||||
giving us locations for each of our expressions and variables.
|
||||
|
@ -1904,7 +1904,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Make the module, which holds all the code.
|
||||
std::unique_ptr<llvm::Module> Owner =
|
||||
llvm::make_unique<llvm::Module>("my cool jit", Context);
|
||||
std::make_unique<llvm::Module>("my cool jit", Context);
|
||||
llvm::Module *module = Owner.get();
|
||||
|
||||
std::unique_ptr<llvm::RTDyldMemoryManager> MemMgr(new llvm::SectionMemoryManager());
|
||||
|
@ -63,7 +63,7 @@ int main() {
|
||||
LLVMContext Context;
|
||||
|
||||
// Create some module to put our function into it.
|
||||
std::unique_ptr<Module> Owner = make_unique<Module>("test", Context);
|
||||
std::unique_ptr<Module> Owner = std::make_unique<Module>("test", Context);
|
||||
Module *M = Owner.get();
|
||||
|
||||
// Create the add1 function entry and insert this entry into module M. The
|
||||
|
@ -20,8 +20,8 @@ using namespace llvm::orc;
|
||||
ExitOnError ExitOnErr;
|
||||
|
||||
ThreadSafeModule createDemoModule() {
|
||||
auto Context = llvm::make_unique<LLVMContext>();
|
||||
auto M = make_unique<Module>("test", *Context);
|
||||
auto Context = std::make_unique<LLVMContext>();
|
||||
auto M = std::make_unique<Module>("test", *Context);
|
||||
|
||||
// Create the add1 function entry and insert this entry into module M. The
|
||||
// function will have a return type of "int" and take an argument of "int".
|
||||
|
@ -42,10 +42,10 @@ private:
|
||||
public:
|
||||
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
|
||||
: ObjectLayer(ES,
|
||||
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
|
||||
[]() { return std::make_unique<SectionMemoryManager>(); }),
|
||||
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
|
||||
DL(std::move(DL)), Mangle(ES, this->DL),
|
||||
Ctx(llvm::make_unique<LLVMContext>()) {
|
||||
Ctx(std::make_unique<LLVMContext>()) {
|
||||
ES.getMainJITDylib().addGenerator(
|
||||
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
|
||||
DL.getGlobalPrefix())));
|
||||
@ -61,7 +61,7 @@ public:
|
||||
if (!DL)
|
||||
return DL.takeError();
|
||||
|
||||
return llvm::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
return std::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
}
|
||||
|
||||
const DataLayout &getDataLayout() const { return DL; }
|
||||
|
@ -329,7 +329,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -356,7 +356,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -380,7 +380,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -409,7 +409,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -545,7 +545,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -582,7 +582,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -679,9 +679,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>
|
||||
auto Proto = std::make_unique<PrototypeAST>
|
||||
(("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1103,11 +1103,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", *TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", *TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getDataLayout());
|
||||
|
||||
// Create a new builder for the module.
|
||||
Builder = llvm::make_unique<IRBuilder<>>(*TheContext);
|
||||
Builder = std::make_unique<IRBuilder<>>(*TheContext);
|
||||
}
|
||||
|
||||
static void HandleDefinition() {
|
||||
|
@ -48,11 +48,11 @@ private:
|
||||
public:
|
||||
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
|
||||
: ObjectLayer(ES,
|
||||
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
|
||||
[]() { return std::make_unique<SectionMemoryManager>(); }),
|
||||
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
|
||||
OptimizeLayer(ES, CompileLayer, optimizeModule),
|
||||
DL(std::move(DL)), Mangle(ES, this->DL),
|
||||
Ctx(llvm::make_unique<LLVMContext>()) {
|
||||
Ctx(std::make_unique<LLVMContext>()) {
|
||||
ES.getMainJITDylib().addGenerator(
|
||||
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
|
||||
DL.getGlobalPrefix())));
|
||||
@ -72,7 +72,7 @@ public:
|
||||
if (!DL)
|
||||
return DL.takeError();
|
||||
|
||||
return llvm::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
return std::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL));
|
||||
}
|
||||
|
||||
Error addModule(std::unique_ptr<Module> M) {
|
||||
@ -89,7 +89,7 @@ private:
|
||||
optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) {
|
||||
TSM.withModuleDo([](Module &M) {
|
||||
// Create a function pass manager.
|
||||
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(&M);
|
||||
auto FPM = std::make_unique<legacy::FunctionPassManager>(&M);
|
||||
|
||||
// Add some optimizations.
|
||||
FPM->add(createInstructionCombiningPass());
|
||||
|
@ -329,7 +329,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -356,7 +356,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -380,7 +380,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -409,7 +409,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -545,7 +545,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -582,7 +582,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -679,9 +679,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>(
|
||||
auto Proto = std::make_unique<PrototypeAST>(
|
||||
("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1103,11 +1103,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", *TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", *TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getDataLayout());
|
||||
|
||||
// Create a new builder for the module.
|
||||
Builder = llvm::make_unique<IRBuilder<>>(*TheContext);
|
||||
Builder = std::make_unique<IRBuilder<>>(*TheContext);
|
||||
}
|
||||
|
||||
static void HandleDefinition() {
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
private:
|
||||
std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) {
|
||||
// Create a function pass manager.
|
||||
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
|
||||
// Add some optimizations.
|
||||
FPM->add(createInstructionCombiningPass());
|
||||
|
@ -329,7 +329,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -356,7 +356,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -380,7 +380,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -409,7 +409,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -545,7 +545,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -582,7 +582,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -679,9 +679,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
}
|
||||
|
||||
@ -1222,7 +1222,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModule();
|
||||
|
||||
|
@ -207,7 +207,7 @@ private:
|
||||
|
||||
std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) {
|
||||
// Create a function pass manager.
|
||||
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
|
||||
// Add some optimizations.
|
||||
FPM->add(createInstructionCombiningPass());
|
||||
|
@ -314,7 +314,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -341,7 +341,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -365,7 +365,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -394,7 +394,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -530,7 +530,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -567,7 +567,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -664,9 +664,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1095,7 +1095,7 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
}
|
||||
|
||||
@ -1114,7 +1114,7 @@ irgenAndTakeOwnership(FunctionAST &FnAST, const std::string &Suffix) {
|
||||
static void HandleDefinition() {
|
||||
if (auto FnAST = ParseDefinition()) {
|
||||
FunctionProtos[FnAST->getProto().getName()] =
|
||||
llvm::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
std::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST)));
|
||||
} else {
|
||||
// Skip token for error recovery.
|
||||
@ -1140,7 +1140,7 @@ static void HandleTopLevelExpression() {
|
||||
// Evaluate a top-level expression into an anonymous function.
|
||||
if (auto FnAST = ParseTopLevelExpr()) {
|
||||
FunctionProtos[FnAST->getName()] =
|
||||
llvm::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
std::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
if (FnAST->codegen()) {
|
||||
// JIT the module containing the anonymous expression, keeping a handle so
|
||||
// we can free it later.
|
||||
@ -1227,7 +1227,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModule();
|
||||
|
||||
|
@ -224,7 +224,7 @@ private:
|
||||
|
||||
std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) {
|
||||
// Create a function pass manager.
|
||||
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get());
|
||||
|
||||
// Add some optimizations.
|
||||
FPM->add(createInstructionCombiningPass());
|
||||
|
@ -331,7 +331,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -358,7 +358,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -382,7 +382,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -411,7 +411,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -547,7 +547,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,7 +661,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -684,12 +684,12 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
auto PEArgs = std::vector<std::unique_ptr<ExprAST>>();
|
||||
PEArgs.push_back(std::move(E));
|
||||
auto PrintExpr =
|
||||
llvm::make_unique<CallExprAST>("printExprResult", std::move(PEArgs));
|
||||
std::make_unique<CallExprAST>("printExprResult", std::move(PEArgs));
|
||||
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto),
|
||||
return std::make_unique<FunctionAST>(std::move(Proto),
|
||||
std::move(PrintExpr));
|
||||
}
|
||||
return nullptr;
|
||||
@ -1119,7 +1119,7 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
}
|
||||
|
||||
@ -1138,7 +1138,7 @@ irgenAndTakeOwnership(FunctionAST &FnAST, const std::string &Suffix) {
|
||||
static void HandleDefinition() {
|
||||
if (auto FnAST = ParseDefinition()) {
|
||||
FunctionProtos[FnAST->getProto().getName()] =
|
||||
llvm::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
std::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST)));
|
||||
} else {
|
||||
// Skip token for error recovery.
|
||||
@ -1164,7 +1164,7 @@ static void HandleTopLevelExpression() {
|
||||
// Evaluate a top-level expression into an anonymous function.
|
||||
if (auto FnAST = ParseTopLevelExpr()) {
|
||||
FunctionProtos[FnAST->getName()] =
|
||||
llvm::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
std::make_unique<PrototypeAST>(FnAST->getProto());
|
||||
if (FnAST->codegen()) {
|
||||
// JIT the module containing the anonymous expression, keeping a handle so
|
||||
// we can free it later.
|
||||
@ -1253,7 +1253,7 @@ std::unique_ptr<FDRPCChannel> connect() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return llvm::make_unique<FDRPCChannel>(sockfd, sockfd);
|
||||
return std::make_unique<FDRPCChannel>(sockfd, sockfd);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1281,11 +1281,11 @@ int main(int argc, char *argv[]) {
|
||||
ExecutionSession ES;
|
||||
auto TCPChannel = connect();
|
||||
auto Remote = ExitOnErr(MyRemote::Create(*TCPChannel, ES));
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>(ES, *Remote);
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>(ES, *Remote);
|
||||
|
||||
// Automatically inject a definition for 'printExprResult'.
|
||||
FunctionProtos["printExprResult"] =
|
||||
llvm::make_unique<PrototypeAST>("printExprResult",
|
||||
std::make_unique<PrototypeAST>("printExprResult",
|
||||
std::vector<std::string>({"Val"}));
|
||||
|
||||
// Prime the first token.
|
||||
|
@ -197,7 +197,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -224,7 +224,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -248,7 +248,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -300,7 +300,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
}
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS = llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
LHS = std::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
|
||||
std::move(RHS));
|
||||
}
|
||||
}
|
||||
@ -337,7 +337,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
// success.
|
||||
getNextToken(); // eat ')'.
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
}
|
||||
|
||||
/// definition ::= 'def' prototype expression
|
||||
@ -348,7 +348,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -356,9 +356,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -250,7 +250,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -274,7 +274,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -327,7 +327,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
// success.
|
||||
getNextToken(); // eat ')'.
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
}
|
||||
|
||||
/// definition ::= 'def' prototype expression
|
||||
@ -374,7 +374,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -382,9 +382,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -598,7 +598,7 @@ int main() {
|
||||
getNextToken();
|
||||
|
||||
// Make the module, which holds all the code.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
|
||||
// Run the main "interpreter loop" now.
|
||||
MainLoop();
|
||||
|
@ -233,7 +233,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -260,7 +260,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -284,7 +284,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -337,7 +337,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
// success.
|
||||
getNextToken(); // eat ')'.
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
}
|
||||
|
||||
/// definition ::= 'def' prototype expression
|
||||
@ -384,7 +384,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -392,9 +392,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -550,11 +550,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModuleAndPassManager() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
TheFPM->add(createInstructionCombiningPass());
|
||||
@ -689,7 +689,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModuleAndPassManager();
|
||||
|
||||
|
@ -278,7 +278,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -305,7 +305,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -329,7 +329,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -358,7 +358,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
// success.
|
||||
getNextToken(); // eat ')'.
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
|
||||
}
|
||||
|
||||
/// definition ::= 'def' prototype expression
|
||||
@ -511,7 +511,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -519,9 +519,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -824,11 +824,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModuleAndPassManager() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
TheFPM->add(createInstructionCombiningPass());
|
||||
@ -963,7 +963,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModuleAndPassManager();
|
||||
|
||||
|
@ -312,7 +312,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -339,7 +339,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -363,7 +363,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -392,7 +392,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -611,9 +611,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -943,11 +943,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModuleAndPassManager() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
TheFPM->add(createInstructionCombiningPass());
|
||||
@ -1082,7 +1082,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModuleAndPassManager();
|
||||
|
||||
|
@ -334,7 +334,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -361,7 +361,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -385,7 +385,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -414,7 +414,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -550,7 +550,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,7 +664,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -676,7 +676,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -684,9 +684,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1111,11 +1111,11 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModuleAndPassManager() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
|
||||
// Create a new pass manager attached to it.
|
||||
TheFPM = llvm::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
TheFPM = std::make_unique<legacy::FunctionPassManager>(TheModule.get());
|
||||
|
||||
// Promote allocas to registers.
|
||||
TheFPM->add(createPromoteMemoryToRegisterPass());
|
||||
@ -1253,7 +1253,7 @@ int main() {
|
||||
fprintf(stderr, "ready> ");
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModuleAndPassManager();
|
||||
|
||||
|
@ -335,7 +335,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -362,7 +362,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(IdName);
|
||||
return std::make_unique<VariableExprAST>(IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -386,7 +386,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -415,7 +415,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -461,7 +461,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -510,7 +510,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -551,7 +551,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS =
|
||||
llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,7 +665,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -677,7 +677,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -685,9 +685,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1107,7 +1107,7 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModuleAndPassManager() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
}
|
||||
|
||||
static void HandleDefinition() {
|
||||
|
@ -442,7 +442,7 @@ static std::unique_ptr<ExprAST> ParseExpression();
|
||||
|
||||
/// numberexpr ::= number
|
||||
static std::unique_ptr<ExprAST> ParseNumberExpr() {
|
||||
auto Result = llvm::make_unique<NumberExprAST>(NumVal);
|
||||
auto Result = std::make_unique<NumberExprAST>(NumVal);
|
||||
getNextToken(); // consume the number
|
||||
return std::move(Result);
|
||||
}
|
||||
@ -471,7 +471,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
getNextToken(); // eat identifier.
|
||||
|
||||
if (CurTok != '(') // Simple variable ref.
|
||||
return llvm::make_unique<VariableExprAST>(LitLoc, IdName);
|
||||
return std::make_unique<VariableExprAST>(LitLoc, IdName);
|
||||
|
||||
// Call.
|
||||
getNextToken(); // eat (
|
||||
@ -495,7 +495,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() {
|
||||
// Eat the ')'.
|
||||
getNextToken();
|
||||
|
||||
return llvm::make_unique<CallExprAST>(LitLoc, IdName, std::move(Args));
|
||||
return std::make_unique<CallExprAST>(LitLoc, IdName, std::move(Args));
|
||||
}
|
||||
|
||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||
@ -526,7 +526,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() {
|
||||
if (!Else)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<IfExprAST>(IfLoc, std::move(Cond), std::move(Then),
|
||||
return std::make_unique<IfExprAST>(IfLoc, std::move(Cond), std::move(Then),
|
||||
std::move(Else));
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
|
||||
std::move(Step), std::move(Body));
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() {
|
||||
if (!Body)
|
||||
return nullptr;
|
||||
|
||||
return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body));
|
||||
}
|
||||
|
||||
/// primary
|
||||
@ -662,7 +662,7 @@ static std::unique_ptr<ExprAST> ParseUnary() {
|
||||
int Opc = CurTok;
|
||||
getNextToken();
|
||||
if (auto Operand = ParseUnary())
|
||||
return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
|
||||
}
|
||||
|
||||
// Merge LHS/RHS.
|
||||
LHS = llvm::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
|
||||
LHS = std::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
|
||||
std::move(RHS));
|
||||
}
|
||||
}
|
||||
@ -779,7 +779,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() {
|
||||
if (Kind && ArgNames.size() != Kind)
|
||||
return LogErrorP("Invalid number of operands for operator");
|
||||
|
||||
return llvm::make_unique<PrototypeAST>(FnLoc, FnName, ArgNames, Kind != 0,
|
||||
return std::make_unique<PrototypeAST>(FnLoc, FnName, ArgNames, Kind != 0,
|
||||
BinaryPrecedence);
|
||||
}
|
||||
|
||||
@ -791,7 +791,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
|
||||
return nullptr;
|
||||
|
||||
if (auto E = ParseExpression())
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -800,9 +800,9 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
|
||||
SourceLocation FnLoc = CurLoc;
|
||||
if (auto E = ParseExpression()) {
|
||||
// Make an anonymous proto.
|
||||
auto Proto = llvm::make_unique<PrototypeAST>(FnLoc, "__anon_expr",
|
||||
auto Proto = std::make_unique<PrototypeAST>(FnLoc, "__anon_expr",
|
||||
std::vector<std::string>());
|
||||
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1314,7 +1314,7 @@ Function *FunctionAST::codegen() {
|
||||
|
||||
static void InitializeModule() {
|
||||
// Open a new module.
|
||||
TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule = std::make_unique<Module>("my cool jit", TheContext);
|
||||
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
|
||||
}
|
||||
|
||||
@ -1416,7 +1416,7 @@ int main() {
|
||||
// Prime the first token.
|
||||
getNextToken();
|
||||
|
||||
TheJIT = llvm::make_unique<KaleidoscopeJIT>();
|
||||
TheJIT = std::make_unique<KaleidoscopeJIT>();
|
||||
|
||||
InitializeModule();
|
||||
|
||||
@ -1429,7 +1429,7 @@ int main() {
|
||||
TheModule->addModuleFlag(llvm::Module::Warning, "Dwarf Version", 2);
|
||||
|
||||
// Construct the DIBuilder, we do this here because we need the module.
|
||||
DBuilder = llvm::make_unique<DIBuilder>(*TheModule);
|
||||
DBuilder = std::make_unique<DIBuilder>(*TheModule);
|
||||
|
||||
// Create the compile unit for the module.
|
||||
// Currently down as "fib.ks" as a filename since we're redirecting stdin
|
||||
|
@ -35,7 +35,7 @@ parseExampleModule(llvm::StringRef Source, llvm::StringRef Name) {
|
||||
using namespace llvm;
|
||||
using namespace llvm::orc;
|
||||
|
||||
auto Ctx = llvm::make_unique<LLVMContext>();
|
||||
auto Ctx = std::make_unique<LLVMContext>();
|
||||
SMDiagnostic Err;
|
||||
auto M = parseIR(MemoryBufferRef(Source, Name), Err, *Ctx);
|
||||
|
||||
|
@ -259,7 +259,7 @@ int main() {
|
||||
LLVMContext Context;
|
||||
|
||||
// Create some module to put our function into it.
|
||||
std::unique_ptr<Module> Owner = make_unique<Module>("test", Context);
|
||||
std::unique_ptr<Module> Owner = std::make_unique<Module>("test", Context);
|
||||
Module *M = Owner.get();
|
||||
|
||||
Function* add1F = createAdd1( M );
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
if (!DL)
|
||||
return DL.takeError();
|
||||
|
||||
auto ES = llvm::make_unique<ExecutionSession>();
|
||||
auto ES = std::make_unique<ExecutionSession>();
|
||||
|
||||
auto LCTMgr = createLocalLazyCallThroughManager(
|
||||
JTMB->getTargetTriple(), *ES,
|
||||
@ -128,7 +128,7 @@ private:
|
||||
}
|
||||
|
||||
static std::unique_ptr<SectionMemoryManager> createMemMgr() {
|
||||
return llvm::make_unique<SectionMemoryManager>();
|
||||
return std::make_unique<SectionMemoryManager>();
|
||||
}
|
||||
|
||||
std::unique_ptr<ExecutionSession> ES;
|
||||
@ -168,7 +168,7 @@ int main(int argc, char *argv[]) {
|
||||
// Load the IR inputs.
|
||||
for (const auto &InputFile : InputFiles) {
|
||||
SMDiagnostic Err;
|
||||
auto Ctx = llvm::make_unique<LLVMContext>();
|
||||
auto Ctx = std::make_unique<LLVMContext>();
|
||||
auto M = parseIRFile(InputFile, Err, *Ctx);
|
||||
if (!M) {
|
||||
Err.print(argv[0], errs());
|
||||
|
@ -38,7 +38,7 @@ class Any {
|
||||
explicit StorageImpl(T &&Value) : Value(std::move(Value)) {}
|
||||
|
||||
std::unique_ptr<StorageBase> clone() const override {
|
||||
return llvm::make_unique<StorageImpl<T>>(Value);
|
||||
return std::make_unique<StorageImpl<T>>(Value);
|
||||
}
|
||||
|
||||
const void *id() const override { return &TypeId<T>::Id; }
|
||||
@ -78,7 +78,7 @@ public:
|
||||
int>::type = 0>
|
||||
Any(T &&Value) {
|
||||
using U = typename std::decay<T>::type;
|
||||
Storage = llvm::make_unique<StorageImpl<U>>(std::forward<T>(Value));
|
||||
Storage = std::make_unique<StorageImpl<U>>(std::forward<T>(Value));
|
||||
}
|
||||
|
||||
Any(Any &&Other) : Storage(std::move(Other.Storage)) {}
|
||||
|
@ -365,7 +365,7 @@ typename Tr::RegionNodeT *RegionBase<Tr>::getBBNode(BlockT *BB) const {
|
||||
auto Deconst = const_cast<RegionBase<Tr> *>(this);
|
||||
typename BBNodeMapT::value_type V = {
|
||||
BB,
|
||||
llvm::make_unique<RegionNodeT>(static_cast<RegionT *>(Deconst), BB)};
|
||||
std::make_unique<RegionNodeT>(static_cast<RegionT *>(Deconst), BB)};
|
||||
at = BBNodeMap.insert(std::move(V)).first;
|
||||
}
|
||||
return at->second.get();
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
}
|
||||
GISelKnownBits &get(MachineFunction &MF) {
|
||||
if (!Info)
|
||||
Info = make_unique<GISelKnownBits>(MF);
|
||||
Info = std::make_unique<GISelKnownBits>(MF);
|
||||
return *Info.get();
|
||||
}
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
|
@ -224,7 +224,7 @@ namespace llvm {
|
||||
|
||||
/// Constructs a new LiveRange object.
|
||||
LiveRange(bool UseSegmentSet = false)
|
||||
: segmentSet(UseSegmentSet ? llvm::make_unique<SegmentSet>()
|
||||
: segmentSet(UseSegmentSet ? std::make_unique<SegmentSet>()
|
||||
: nullptr) {}
|
||||
|
||||
/// Constructs a new LiveRange object by copying segments and valnos from
|
||||
|
@ -200,7 +200,7 @@ public:
|
||||
RegClassInfo(rci), II_setByPragma(II), Topo(SUnits, &ExitSU) {
|
||||
P.MF->getSubtarget().getSMSMutations(Mutations);
|
||||
if (SwpEnableCopyToPhi)
|
||||
Mutations.push_back(llvm::make_unique<CopyToPhiMutation>());
|
||||
Mutations.push_back(std::make_unique<CopyToPhiMutation>());
|
||||
}
|
||||
|
||||
void schedule() override;
|
||||
|
@ -28,17 +28,17 @@ class Vector {
|
||||
public:
|
||||
/// Construct a PBQP vector of the given size.
|
||||
explicit Vector(unsigned Length)
|
||||
: Length(Length), Data(llvm::make_unique<PBQPNum []>(Length)) {}
|
||||
: Length(Length), Data(std::make_unique<PBQPNum []>(Length)) {}
|
||||
|
||||
/// Construct a PBQP vector with initializer.
|
||||
Vector(unsigned Length, PBQPNum InitVal)
|
||||
: Length(Length), Data(llvm::make_unique<PBQPNum []>(Length)) {
|
||||
: Length(Length), Data(std::make_unique<PBQPNum []>(Length)) {
|
||||
std::fill(Data.get(), Data.get() + Length, InitVal);
|
||||
}
|
||||
|
||||
/// Copy construct a PBQP vector.
|
||||
Vector(const Vector &V)
|
||||
: Length(V.Length), Data(llvm::make_unique<PBQPNum []>(Length)) {
|
||||
: Length(V.Length), Data(std::make_unique<PBQPNum []>(Length)) {
|
||||
std::copy(V.Data.get(), V.Data.get() + Length, Data.get());
|
||||
}
|
||||
|
||||
@ -125,21 +125,21 @@ private:
|
||||
public:
|
||||
/// Construct a PBQP Matrix with the given dimensions.
|
||||
Matrix(unsigned Rows, unsigned Cols) :
|
||||
Rows(Rows), Cols(Cols), Data(llvm::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
Rows(Rows), Cols(Cols), Data(std::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
}
|
||||
|
||||
/// Construct a PBQP Matrix with the given dimensions and initial
|
||||
/// value.
|
||||
Matrix(unsigned Rows, unsigned Cols, PBQPNum InitVal)
|
||||
: Rows(Rows), Cols(Cols),
|
||||
Data(llvm::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
Data(std::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
std::fill(Data.get(), Data.get() + (Rows * Cols), InitVal);
|
||||
}
|
||||
|
||||
/// Copy construct a PBQP matrix.
|
||||
Matrix(const Matrix &M)
|
||||
: Rows(M.Rows), Cols(M.Cols),
|
||||
Data(llvm::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
Data(std::make_unique<PBQPNum []>(Rows * Cols)) {
|
||||
std::copy(M.Data.get(), M.Data.get() + (Rows * Cols), Data.get());
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ public:
|
||||
///
|
||||
/// This can also be used to plug a new MachineSchedStrategy into an instance
|
||||
/// of the standard ScheduleDAGMI:
|
||||
/// return new ScheduleDAGMI(C, make_unique<MyStrategy>(C), /*RemoveKillFlags=*/false)
|
||||
/// return new ScheduleDAGMI(C, std::make_unique<MyStrategy>(C), /*RemoveKillFlags=*/false)
|
||||
///
|
||||
/// Return NULL to select the default (generic) machine scheduler.
|
||||
virtual ScheduleDAGInstrs *
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
Error visitSymbolBegin(CVSymbol &Record) override {
|
||||
assert(!Mapping && "Already in a symbol mapping!");
|
||||
Mapping = llvm::make_unique<MappingInfo>(Record.content(), Container);
|
||||
Mapping = std::make_unique<MappingInfo>(Record.content(), Container);
|
||||
return Mapping->Mapping.visitSymbolBegin(Record);
|
||||
}
|
||||
Error visitSymbolEnd(CVSymbol &Record) override {
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
|
||||
Error visitTypeBegin(CVType &Record) override {
|
||||
assert(!Mapping && "Already in a type mapping!");
|
||||
Mapping = llvm::make_unique<MappingInfo>(Record.content());
|
||||
Mapping = std::make_unique<MappingInfo>(Record.content());
|
||||
return Mapping->Mapping.visitTypeBegin(Record);
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ public:
|
||||
LoadedObjectInfoHelper(Ts &&... Args) : Base(std::forward<Ts>(Args)...) {}
|
||||
|
||||
std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
|
||||
return llvm::make_unique<Derived>(static_cast<const Derived &>(*this));
|
||||
return std::make_unique<Derived>(static_cast<const Derived &>(*this));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
// Initial construction must not access the cache, since it must be done
|
||||
// atomically.
|
||||
auto Result = llvm::make_unique<ConcreteSymbolT>(
|
||||
auto Result = std::make_unique<ConcreteSymbolT>(
|
||||
Session, Id, std::forward<Args>(ConstructorArgs)...);
|
||||
Result->SymbolId = Id;
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
auto BaseIter = RawSymbol->findChildren(T::Tag);
|
||||
if (!BaseIter)
|
||||
return nullptr;
|
||||
return llvm::make_unique<ConcreteSymbolEnumerator<T>>(std::move(BaseIter));
|
||||
return std::make_unique<ConcreteSymbolEnumerator<T>>(std::move(BaseIter));
|
||||
}
|
||||
std::unique_ptr<IPDBEnumSymbols> findAllChildren(PDB_SymType Type) const;
|
||||
std::unique_ptr<IPDBEnumSymbols> findAllChildren() const;
|
||||
|
@ -191,7 +191,7 @@ private:
|
||||
std::unique_ptr<ResourceOwner<ResourceT>>
|
||||
wrapOwnership(ResourcePtrT ResourcePtr) {
|
||||
using RO = ResourceOwnerImpl<ResourceT, ResourcePtrT>;
|
||||
return llvm::make_unique<RO>(std::move(ResourcePtr));
|
||||
return std::make_unique<RO>(std::move(ResourcePtr));
|
||||
}
|
||||
|
||||
struct LogicalDylib {
|
||||
@ -444,7 +444,7 @@ private:
|
||||
return Error::success();
|
||||
|
||||
// Create the GlobalValues module.
|
||||
auto GVsM = llvm::make_unique<Module>((SrcM.getName() + ".globals").str(),
|
||||
auto GVsM = std::make_unique<Module>((SrcM.getName() + ".globals").str(),
|
||||
SrcM.getContext());
|
||||
GVsM->setDataLayout(DL);
|
||||
|
||||
@ -637,7 +637,7 @@ private:
|
||||
NewName += F->getName();
|
||||
}
|
||||
|
||||
auto M = llvm::make_unique<Module>(NewName, SrcM.getContext());
|
||||
auto M = std::make_unique<Module>(NewName, SrcM.getContext());
|
||||
M->setDataLayout(SrcM.getDataLayout());
|
||||
ValueToValueMapTy VMap;
|
||||
|
||||
|
@ -346,7 +346,7 @@ private:
|
||||
///
|
||||
inline std::unique_ptr<AbsoluteSymbolsMaterializationUnit>
|
||||
absoluteSymbols(SymbolMap Symbols, VModuleKey K = VModuleKey()) {
|
||||
return llvm::make_unique<AbsoluteSymbolsMaterializationUnit>(
|
||||
return std::make_unique<AbsoluteSymbolsMaterializationUnit>(
|
||||
std::move(Symbols), std::move(K));
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ private:
|
||||
/// \endcode
|
||||
inline std::unique_ptr<ReExportsMaterializationUnit>
|
||||
symbolAliases(SymbolAliasMap Aliases, VModuleKey K = VModuleKey()) {
|
||||
return llvm::make_unique<ReExportsMaterializationUnit>(
|
||||
return std::make_unique<ReExportsMaterializationUnit>(
|
||||
nullptr, true, std::move(Aliases), std::move(K));
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ symbolAliases(SymbolAliasMap Aliases, VModuleKey K = VModuleKey()) {
|
||||
inline std::unique_ptr<ReExportsMaterializationUnit>
|
||||
reexports(JITDylib &SourceJD, SymbolAliasMap Aliases,
|
||||
bool MatchNonExported = false, VModuleKey K = VModuleKey()) {
|
||||
return llvm::make_unique<ReExportsMaterializationUnit>(
|
||||
return std::make_unique<ReExportsMaterializationUnit>(
|
||||
&SourceJD, MatchNonExported, std::move(Aliases), std::move(K));
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ std::shared_ptr<LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>>
|
||||
createLambdaResolver(DylibLookupFtorT DylibLookupFtor,
|
||||
ExternalLookupFtorT ExternalLookupFtor) {
|
||||
using LR = LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>;
|
||||
return make_unique<LR>(std::move(DylibLookupFtor),
|
||||
return std::make_unique<LR>(std::move(DylibLookupFtor),
|
||||
std::move(ExternalLookupFtor));
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ createLambdaResolver(ORCv1DeprecationAcknowledgement,
|
||||
DylibLookupFtorT DylibLookupFtor,
|
||||
ExternalLookupFtorT ExternalLookupFtor) {
|
||||
using LR = LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>;
|
||||
return make_unique<LR>(AcknowledgeORCv1Deprecation,
|
||||
return std::make_unique<LR>(AcknowledgeORCv1Deprecation,
|
||||
std::move(DylibLookupFtor),
|
||||
std::move(ExternalLookupFtor));
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ private:
|
||||
bool ExportedSymbolsOnly) const {
|
||||
assert(!MangledSymbols && "Mangled symbols map already exists?");
|
||||
|
||||
auto Symbols = llvm::make_unique<StringMap<const GlobalValue*>>();
|
||||
auto Symbols = std::make_unique<StringMap<const GlobalValue*>>();
|
||||
|
||||
Mangler Mang;
|
||||
|
||||
@ -209,7 +209,7 @@ public:
|
||||
Error addModule(VModuleKey K, std::unique_ptr<Module> M) {
|
||||
assert(!ModuleMap.count(K) && "VModuleKey K already in use");
|
||||
ModuleMap[K] =
|
||||
llvm::make_unique<EmissionDeferredModule>(std::move(K), std::move(M));
|
||||
std::make_unique<EmissionDeferredModule>(std::move(K), std::move(M));
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
template <typename NotifyResolvedImpl>
|
||||
static std::unique_ptr<NotifyResolvedFunction>
|
||||
createNotifyResolvedFunction(NotifyResolvedImpl NotifyResolved) {
|
||||
return llvm::make_unique<NotifyResolvedFunctionImpl<NotifyResolvedImpl>>(
|
||||
return std::make_unique<NotifyResolvedFunctionImpl<NotifyResolvedImpl>>(
|
||||
std::move(NotifyResolved));
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ lazyReexports(LazyCallThroughManager &LCTManager,
|
||||
IndirectStubsManager &ISManager, JITDylib &SourceJD,
|
||||
SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc = nullptr,
|
||||
VModuleKey K = VModuleKey()) {
|
||||
return llvm::make_unique<LazyReexportsMaterializationUnit>(
|
||||
return std::make_unique<LazyReexportsMaterializationUnit>(
|
||||
LCTManager, ISManager, SourceJD, std::move(CallableAliases), SrcJDLoc,
|
||||
std::move(K));
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ createSymbolResolver(GetResponsibilitySetFn &&GetResponsibilitySet,
|
||||
typename std::remove_reference<GetResponsibilitySetFn>::type>::type,
|
||||
typename std::remove_cv<
|
||||
typename std::remove_reference<LookupFn>::type>::type>;
|
||||
return llvm::make_unique<LambdaSymbolResolverImpl>(
|
||||
return std::make_unique<LambdaSymbolResolverImpl>(
|
||||
std::forward<GetResponsibilitySetFn>(GetResponsibilitySet),
|
||||
std::forward<LookupFn>(Lookup));
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ public:
|
||||
ExecutionSession &ES,
|
||||
JITTargetAddress ErrorHandlerAddress)
|
||||
: JITCompileCallbackManager(
|
||||
llvm::make_unique<RemoteTrampolinePool>(Client), ES,
|
||||
std::make_unique<RemoteTrampolinePool>(Client), ES,
|
||||
ErrorHandlerAddress) {}
|
||||
};
|
||||
|
||||
@ -553,7 +553,7 @@ public:
|
||||
auto Id = IndirectStubOwnerIds.getNext();
|
||||
if (auto Err = callB<stubs::CreateIndirectStubsOwner>(Id))
|
||||
return std::move(Err);
|
||||
return llvm::make_unique<RemoteIndirectStubsManager>(*this, Id);
|
||||
return std::make_unique<RemoteIndirectStubsManager>(*this, Id);
|
||||
}
|
||||
|
||||
Expected<RemoteCompileCallbackManager &>
|
||||
|
@ -764,7 +764,7 @@ private:
|
||||
// Create a ResponseHandler from a given user handler.
|
||||
template <typename ChannelT, typename FuncRetT, typename HandlerT>
|
||||
std::unique_ptr<ResponseHandler<ChannelT>> createResponseHandler(HandlerT H) {
|
||||
return llvm::make_unique<ResponseHandlerImpl<ChannelT, FuncRetT, HandlerT>>(
|
||||
return std::make_unique<ResponseHandlerImpl<ChannelT, FuncRetT, HandlerT>>(
|
||||
std::move(H));
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ private:
|
||||
: K(std::move(K)),
|
||||
Parent(Parent),
|
||||
MemMgr(std::move(MemMgr)),
|
||||
PFC(llvm::make_unique<PreFinalizeContents>(
|
||||
PFC(std::make_unique<PreFinalizeContents>(
|
||||
std::move(Obj), std::move(Resolver),
|
||||
ProcessAllSections)) {
|
||||
buildInitialSymbolTable(PFC->Obj);
|
||||
@ -234,7 +234,7 @@ private:
|
||||
|
||||
JITSymbolResolverAdapter ResolverAdapter(Parent.ES, *PFC->Resolver,
|
||||
nullptr);
|
||||
PFC->RTDyld = llvm::make_unique<RuntimeDyld>(*MemMgr, ResolverAdapter);
|
||||
PFC->RTDyld = std::make_unique<RuntimeDyld>(*MemMgr, ResolverAdapter);
|
||||
PFC->RTDyld->setProcessAllSections(PFC->ProcessAllSections);
|
||||
|
||||
Finalized = true;
|
||||
@ -338,7 +338,7 @@ private:
|
||||
std::shared_ptr<SymbolResolver> Resolver,
|
||||
bool ProcessAllSections) {
|
||||
using LOS = ConcreteLinkedObject<MemoryManagerPtrT>;
|
||||
return llvm::make_unique<LOS>(Parent, std::move(K), std::move(Obj),
|
||||
return std::make_unique<LOS>(Parent, std::move(K), std::move(Obj),
|
||||
std::move(MemMgr), std::move(Resolver),
|
||||
ProcessAllSections);
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ private:
|
||||
}
|
||||
|
||||
Expected<ObjHandleT> addObject(std::string ObjBuffer) {
|
||||
auto Buffer = llvm::make_unique<StringMemoryBuffer>(std::move(ObjBuffer));
|
||||
auto Buffer = std::make_unique<StringMemoryBuffer>(std::move(ObjBuffer));
|
||||
auto Id = HandleIdMgr.getNext();
|
||||
assert(!BaseLayerHandles.count(Id) && "Id already in use?");
|
||||
|
||||
|
@ -806,7 +806,7 @@ public:
|
||||
/// Ensure that this has RAUW support, and then return it.
|
||||
ReplaceableMetadataImpl *getOrCreateReplaceableUses() {
|
||||
if (!hasReplaceableUses())
|
||||
makeReplaceable(llvm::make_unique<ReplaceableMetadataImpl>(getContext()));
|
||||
makeReplaceable(std::make_unique<ReplaceableMetadataImpl>(getContext()));
|
||||
return getReplaceableUses();
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ public:
|
||||
if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
|
||||
!TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
|
||||
!TypeCheckedLoadConstVCalls.empty())
|
||||
TIdInfo = llvm::make_unique<TypeIdInfo>(TypeIdInfo{
|
||||
TIdInfo = std::make_unique<TypeIdInfo>(TypeIdInfo{
|
||||
std::move(TypeTests), std::move(TypeTestAssumeVCalls),
|
||||
std::move(TypeCheckedLoadVCalls),
|
||||
std::move(TypeTestAssumeConstVCalls),
|
||||
@ -682,7 +682,7 @@ public:
|
||||
/// were unable to devirtualize a checked call.
|
||||
void addTypeTest(GlobalValue::GUID Guid) {
|
||||
if (!TIdInfo)
|
||||
TIdInfo = llvm::make_unique<TypeIdInfo>();
|
||||
TIdInfo = std::make_unique<TypeIdInfo>();
|
||||
TIdInfo->TypeTests.push_back(Guid);
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ public:
|
||||
|
||||
void setVTableFuncs(VTableFuncList Funcs) {
|
||||
assert(!VTableFuncs);
|
||||
VTableFuncs = llvm::make_unique<VTableFuncList>(std::move(Funcs));
|
||||
VTableFuncs = std::make_unique<VTableFuncList>(std::move(Funcs));
|
||||
}
|
||||
|
||||
ArrayRef<VirtFuncOffset> vTableFuncs() const {
|
||||
@ -1419,7 +1419,7 @@ template <>
|
||||
struct GraphTraits<ModuleSummaryIndex *> : public GraphTraits<ValueInfo> {
|
||||
static NodeRef getEntryNode(ModuleSummaryIndex *I) {
|
||||
std::unique_ptr<GlobalValueSummary> Root =
|
||||
make_unique<FunctionSummary>(I->calculateCallGraphRoot());
|
||||
std::make_unique<FunctionSummary>(I->calculateCallGraphRoot());
|
||||
GlobalValueSummaryInfo G(I->haveGVs());
|
||||
G.SummaryList.push_back(std::move(Root));
|
||||
static auto P =
|
||||
|
@ -220,7 +220,7 @@ template <> struct CustomMappingTraits<GlobalValueSummaryMapTy> {
|
||||
V.emplace(RefGUID, /*IsAnalysis=*/false);
|
||||
Refs.push_back(ValueInfo(/*IsAnalysis=*/false, &*V.find(RefGUID)));
|
||||
}
|
||||
Elem.SummaryList.push_back(llvm::make_unique<FunctionSummary>(
|
||||
Elem.SummaryList.push_back(std::make_unique<FunctionSummary>(
|
||||
GlobalValueSummary::GVFlags(
|
||||
static_cast<GlobalValue::LinkageTypes>(FSum.Linkage),
|
||||
FSum.NotEligibleToImport, FSum.Live, FSum.IsLocal, FSum.CanAutoHide),
|
||||
|
@ -289,7 +289,7 @@ struct AnalysisPassModel : AnalysisPassConcept<IRUnitT, PreservedAnalysesT,
|
||||
AnalysisResultConcept<IRUnitT, PreservedAnalysesT, InvalidatorT>>
|
||||
run(IRUnitT &IR, AnalysisManager<IRUnitT, ExtraArgTs...> &AM,
|
||||
ExtraArgTs... ExtraArgs) override {
|
||||
return llvm::make_unique<ResultModelT>(
|
||||
return std::make_unique<ResultModelT>(
|
||||
Pass.run(IR, AM, std::forward<ExtraArgTs>(ExtraArgs)...));
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ struct LTOLLVMContext : LLVMContext {
|
||||
setDiscardValueNames(C.ShouldDiscardValueNames);
|
||||
enableDebugTypeODRUniquing();
|
||||
setDiagnosticHandler(
|
||||
llvm::make_unique<LTOLLVMDiagnosticHandler>(&DiagHandler), true);
|
||||
std::make_unique<LTOLLVMDiagnosticHandler>(&DiagHandler), true);
|
||||
}
|
||||
DiagnosticHandlerFunction DiagHandler;
|
||||
};
|
||||
|
@ -285,7 +285,7 @@ public:
|
||||
|
||||
unsigned createMemoryGroup() {
|
||||
Groups.insert(
|
||||
std::make_pair(NextGroupID, llvm::make_unique<MemoryGroup>()));
|
||||
std::make_pair(NextGroupID, std::make_unique<MemoryGroup>()));
|
||||
return NextGroupID++;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
|
||||
Scheduler(const MCSchedModel &Model, LSUnit &Lsu,
|
||||
std::unique_ptr<SchedulerStrategy> SelectStrategy)
|
||||
: Scheduler(make_unique<ResourceManager>(Model), Lsu,
|
||||
: Scheduler(std::make_unique<ResourceManager>(Model), Lsu,
|
||||
std::move(SelectStrategy)) {}
|
||||
|
||||
Scheduler(std::unique_ptr<ResourceManager> RM, LSUnit &Lsu,
|
||||
|
@ -695,7 +695,7 @@ struct InstrProfRecord {
|
||||
InstrProfRecord(const InstrProfRecord &RHS)
|
||||
: Counts(RHS.Counts),
|
||||
ValueData(RHS.ValueData
|
||||
? llvm::make_unique<ValueProfData>(*RHS.ValueData)
|
||||
? std::make_unique<ValueProfData>(*RHS.ValueData)
|
||||
: nullptr) {}
|
||||
InstrProfRecord &operator=(InstrProfRecord &&) = default;
|
||||
InstrProfRecord &operator=(const InstrProfRecord &RHS) {
|
||||
@ -705,7 +705,7 @@ struct InstrProfRecord {
|
||||
return *this;
|
||||
}
|
||||
if (!ValueData)
|
||||
ValueData = llvm::make_unique<ValueProfData>(*RHS.ValueData);
|
||||
ValueData = std::make_unique<ValueProfData>(*RHS.ValueData);
|
||||
else
|
||||
*ValueData = *RHS.ValueData;
|
||||
return *this;
|
||||
@ -817,7 +817,7 @@ private:
|
||||
std::vector<InstrProfValueSiteRecord> &
|
||||
getOrCreateValueSitesForKind(uint32_t ValueKind) {
|
||||
if (!ValueData)
|
||||
ValueData = llvm::make_unique<ValueProfData>();
|
||||
ValueData = std::make_unique<ValueProfData>();
|
||||
switch (ValueKind) {
|
||||
case IPVK_IndirectCallTarget:
|
||||
return ValueData->IndirectCallSites;
|
||||
@ -897,7 +897,7 @@ InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site,
|
||||
return std::unique_ptr<InstrProfValueData[]>(nullptr);
|
||||
}
|
||||
|
||||
auto VD = llvm::make_unique<InstrProfValueData[]>(N);
|
||||
auto VD = std::make_unique<InstrProfValueData[]>(N);
|
||||
TotalCount = getValueForSite(VD.get(), ValueKind, Site);
|
||||
|
||||
return VD;
|
||||
|
@ -328,7 +328,7 @@ inline ErrorSuccess Error::success() { return ErrorSuccess(); }
|
||||
/// Make a Error instance representing failure using the given error info
|
||||
/// type.
|
||||
template <typename ErrT, typename... ArgTs> Error make_error(ArgTs &&... Args) {
|
||||
return Error(llvm::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
|
||||
return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
|
||||
}
|
||||
|
||||
/// Base class for user error types. Users should declare their error types
|
||||
|
@ -571,7 +571,7 @@ protected:
|
||||
assert(IDomNode && "Not immediate dominator specified for block!");
|
||||
DFSInfoValid = false;
|
||||
return (DomTreeNodes[BB] = IDomNode->addChild(
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode))).get();
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode))).get();
|
||||
}
|
||||
|
||||
/// Add a new node to the forward dominator tree and make it a new root.
|
||||
@ -585,7 +585,7 @@ protected:
|
||||
"Cannot change root of post-dominator tree");
|
||||
DFSInfoValid = false;
|
||||
DomTreeNodeBase<NodeT> *NewNode = (DomTreeNodes[BB] =
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, nullptr)).get();
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(BB, nullptr)).get();
|
||||
if (Roots.empty()) {
|
||||
addRoot(BB);
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ struct SemiNCAInfo {
|
||||
// Add a new tree node for this NodeT, and link it as a child of
|
||||
// IDomNode
|
||||
return (DT.DomTreeNodes[BB] = IDomNode->addChild(
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
|
||||
.get();
|
||||
}
|
||||
|
||||
@ -586,7 +586,7 @@ struct SemiNCAInfo {
|
||||
NodePtr Root = IsPostDom ? nullptr : DT.Roots[0];
|
||||
|
||||
DT.RootNode = (DT.DomTreeNodes[Root] =
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
|
||||
.get();
|
||||
SNCA.attachNewSubtree(DT, DT.RootNode);
|
||||
}
|
||||
@ -611,7 +611,7 @@ struct SemiNCAInfo {
|
||||
// Add a new tree node for this BasicBlock, and link it as a child of
|
||||
// IDomNode.
|
||||
DT.DomTreeNodes[W] = IDomNode->addChild(
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ struct SemiNCAInfo {
|
||||
TreeNodePtr VirtualRoot = DT.getNode(nullptr);
|
||||
FromTN =
|
||||
(DT.DomTreeNodes[From] = VirtualRoot->addChild(
|
||||
llvm::make_unique<DomTreeNodeBase<NodeT>>(From, VirtualRoot)))
|
||||
std::make_unique<DomTreeNodeBase<NodeT>>(From, VirtualRoot)))
|
||||
.get();
|
||||
DT.Roots.push_back(From);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ namespace llvm {
|
||||
entry Entry;
|
||||
node Node;
|
||||
|
||||
static std::unique_ptr<T> CtorFn() { return make_unique<V>(); }
|
||||
static std::unique_ptr<T> CtorFn() { return std::make_unique<V>(); }
|
||||
|
||||
public:
|
||||
Add(StringRef Name, StringRef Desc)
|
||||
|
@ -252,7 +252,7 @@ AssumptionCache &AssumptionCacheTracker::getAssumptionCache(Function &F) {
|
||||
// Ok, build a new cache by scanning the function, insert it and the value
|
||||
// handle into our map, and return the newly populated cache.
|
||||
auto IP = AssumptionCaches.insert(std::make_pair(
|
||||
FunctionCallbackVH(&F, this), llvm::make_unique<AssumptionCache>(F)));
|
||||
FunctionCallbackVH(&F, this), std::make_unique<AssumptionCache>(F)));
|
||||
assert(IP.second && "Scanning function already in the map?");
|
||||
return *IP.first->second;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ using namespace llvm;
|
||||
|
||||
CallGraph::CallGraph(Module &M)
|
||||
: M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
|
||||
CallsExternalNode(llvm::make_unique<CallGraphNode>(nullptr)) {
|
||||
CallsExternalNode(std::make_unique<CallGraphNode>(nullptr)) {
|
||||
// Add every function to the call graph.
|
||||
for (Function &F : M)
|
||||
addToCallGraph(&F);
|
||||
@ -150,7 +150,7 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
|
||||
return CGN.get();
|
||||
|
||||
assert((!F || F->getParent() == &M) && "Function not in current module!");
|
||||
CGN = llvm::make_unique<CallGraphNode>(const_cast<Function *>(F));
|
||||
CGN = std::make_unique<CallGraphNode>(const_cast<Function *>(F));
|
||||
return CGN.get();
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ FullDependence::FullDependence(Instruction *Source, Instruction *Destination,
|
||||
LoopIndependent(PossiblyLoopIndependent) {
|
||||
Consistent = true;
|
||||
if (CommonLevels)
|
||||
DV = make_unique<DVEntry[]>(CommonLevels);
|
||||
DV = std::make_unique<DVEntry[]>(CommonLevels);
|
||||
}
|
||||
|
||||
// The rest are simple getters that hide the implementation.
|
||||
@ -3415,7 +3415,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
|
||||
if (!isLoadOrStore(Src) || !isLoadOrStore(Dst)) {
|
||||
// can only analyze simple loads and stores, i.e., no calls, invokes, etc.
|
||||
LLVM_DEBUG(dbgs() << "can only handle simple loads and stores\n");
|
||||
return make_unique<Dependence>(Src, Dst);
|
||||
return std::make_unique<Dependence>(Src, Dst);
|
||||
}
|
||||
|
||||
assert(isLoadOrStore(Src) && "instruction is not load or store");
|
||||
@ -3430,7 +3430,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
|
||||
case PartialAlias:
|
||||
// cannot analyse objects if we don't understand their aliasing.
|
||||
LLVM_DEBUG(dbgs() << "can't analyze may or partial alias\n");
|
||||
return make_unique<Dependence>(Src, Dst);
|
||||
return std::make_unique<Dependence>(Src, Dst);
|
||||
case NoAlias:
|
||||
// If the objects noalias, they are distinct, accesses are independent.
|
||||
LLVM_DEBUG(dbgs() << "no alias\n");
|
||||
@ -3777,7 +3777,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return make_unique<FullDependence>(std::move(Result));
|
||||
return std::make_unique<FullDependence>(std::move(Result));
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ static cl::opt<unsigned>
|
||||
"call callsite"));
|
||||
|
||||
ICallPromotionAnalysis::ICallPromotionAnalysis() {
|
||||
ValueDataArray = llvm::make_unique<InstrProfValueData[]>(MaxNumPromotions);
|
||||
ValueDataArray = std::make_unique<InstrProfValueData[]>(MaxNumPromotions);
|
||||
}
|
||||
|
||||
bool ICallPromotionAnalysis::isPromotionProfitable(uint64_t Count,
|
||||
|
@ -56,7 +56,7 @@ void LazyBranchProbabilityInfoPass::releaseMemory() { LBPI.reset(); }
|
||||
bool LazyBranchProbabilityInfoPass::runOnFunction(Function &F) {
|
||||
LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
|
||||
TargetLibraryInfo &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||
LBPI = llvm::make_unique<LazyBranchProbabilityInfo>(&F, &LI, &TLI);
|
||||
LBPI = std::make_unique<LazyBranchProbabilityInfo>(&F, &LI, &TLI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace {
|
||||
else {
|
||||
auto It = ValueCache.find_as(Val);
|
||||
if (It == ValueCache.end()) {
|
||||
ValueCache[Val] = make_unique<ValueCacheEntryTy>(Val, this);
|
||||
ValueCache[Val] = std::make_unique<ValueCacheEntryTy>(Val, this);
|
||||
It = ValueCache.find_as(Val);
|
||||
assert(It != ValueCache.end() && "Val was just added to the map!");
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ bool LegacyDivergenceAnalysis::runOnFunction(Function &F) {
|
||||
if (shouldUseGPUDivergenceAnalysis(F)) {
|
||||
// run the new GPU divergence analysis
|
||||
auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
|
||||
gpuDA = llvm::make_unique<GPUDivergenceAnalysis>(F, DT, PDT, LI, TTI);
|
||||
gpuDA = std::make_unique<GPUDivergenceAnalysis>(F, DT, PDT, LI, TTI);
|
||||
|
||||
} else {
|
||||
// run LLVM's existing DivergenceAnalysis
|
||||
|
@ -2099,7 +2099,7 @@ OptimizationRemarkAnalysis &LoopAccessInfo::recordAnalysis(StringRef RemarkName,
|
||||
DL = I->getDebugLoc();
|
||||
}
|
||||
|
||||
Report = make_unique<OptimizationRemarkAnalysis>(DEBUG_TYPE, RemarkName, DL,
|
||||
Report = std::make_unique<OptimizationRemarkAnalysis>(DEBUG_TYPE, RemarkName, DL,
|
||||
CodeRegion);
|
||||
return *Report;
|
||||
}
|
||||
@ -2344,9 +2344,9 @@ void LoopAccessInfo::collectStridedAccess(Value *MemAccess) {
|
||||
LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
|
||||
const TargetLibraryInfo *TLI, AliasAnalysis *AA,
|
||||
DominatorTree *DT, LoopInfo *LI)
|
||||
: PSE(llvm::make_unique<PredicatedScalarEvolution>(*SE, *L)),
|
||||
PtrRtChecking(llvm::make_unique<RuntimePointerChecking>(SE)),
|
||||
DepChecker(llvm::make_unique<MemoryDepChecker>(*PSE, L)), TheLoop(L),
|
||||
: PSE(std::make_unique<PredicatedScalarEvolution>(*SE, *L)),
|
||||
PtrRtChecking(std::make_unique<RuntimePointerChecking>(SE)),
|
||||
DepChecker(std::make_unique<MemoryDepChecker>(*PSE, L)), TheLoop(L),
|
||||
NumLoads(0), NumStores(0), MaxSafeDepDistBytes(-1), CanVecMem(false),
|
||||
HasConvergentOp(false),
|
||||
HasDependenceInvolvingLoopInvariantAddress(false) {
|
||||
@ -2401,7 +2401,7 @@ const LoopAccessInfo &LoopAccessLegacyAnalysis::getInfo(Loop *L) {
|
||||
auto &LAI = LoopAccessInfoMap[L];
|
||||
|
||||
if (!LAI)
|
||||
LAI = llvm::make_unique<LoopAccessInfo>(L, SE, TLI, AA, DT, LI);
|
||||
LAI = std::make_unique<LoopAccessInfo>(L, SE, TLI, AA, DT, LI);
|
||||
|
||||
return *LAI.get();
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ CacheCost::getCacheCost(Loop &Root, LoopStandardAnalysisResults &AR,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return make_unique<CacheCost>(Loops, AR.LI, AR.SE, AR.TTI, AR.AA, DI, TRT);
|
||||
return std::make_unique<CacheCost>(Loops, AR.LI, AR.SE, AR.TTI, AR.AA, DI, TRT);
|
||||
}
|
||||
|
||||
void CacheCost::calculateCacheFootprint() {
|
||||
|
@ -1238,7 +1238,7 @@ MemorySSA::AccessList *MemorySSA::getOrCreateAccessList(const BasicBlock *BB) {
|
||||
auto Res = PerBlockAccesses.insert(std::make_pair(BB, nullptr));
|
||||
|
||||
if (Res.second)
|
||||
Res.first->second = llvm::make_unique<AccessList>();
|
||||
Res.first->second = std::make_unique<AccessList>();
|
||||
return Res.first->second.get();
|
||||
}
|
||||
|
||||
@ -1246,7 +1246,7 @@ MemorySSA::DefsList *MemorySSA::getOrCreateDefsList(const BasicBlock *BB) {
|
||||
auto Res = PerBlockDefs.insert(std::make_pair(BB, nullptr));
|
||||
|
||||
if (Res.second)
|
||||
Res.first->second = llvm::make_unique<DefsList>();
|
||||
Res.first->second = std::make_unique<DefsList>();
|
||||
return Res.first->second.get();
|
||||
}
|
||||
|
||||
@ -1555,10 +1555,10 @@ MemorySSA::CachingWalker<AliasAnalysis> *MemorySSA::getWalkerImpl() {
|
||||
|
||||
if (!WalkerBase)
|
||||
WalkerBase =
|
||||
llvm::make_unique<ClobberWalkerBase<AliasAnalysis>>(this, AA, DT);
|
||||
std::make_unique<ClobberWalkerBase<AliasAnalysis>>(this, AA, DT);
|
||||
|
||||
Walker =
|
||||
llvm::make_unique<CachingWalker<AliasAnalysis>>(this, WalkerBase.get());
|
||||
std::make_unique<CachingWalker<AliasAnalysis>>(this, WalkerBase.get());
|
||||
return Walker.get();
|
||||
}
|
||||
|
||||
@ -1568,10 +1568,10 @@ MemorySSAWalker *MemorySSA::getSkipSelfWalker() {
|
||||
|
||||
if (!WalkerBase)
|
||||
WalkerBase =
|
||||
llvm::make_unique<ClobberWalkerBase<AliasAnalysis>>(this, AA, DT);
|
||||
std::make_unique<ClobberWalkerBase<AliasAnalysis>>(this, AA, DT);
|
||||
|
||||
SkipWalker =
|
||||
llvm::make_unique<SkipSelfWalker<AliasAnalysis>>(this, WalkerBase.get());
|
||||
std::make_unique<SkipSelfWalker<AliasAnalysis>>(this, WalkerBase.get());
|
||||
return SkipWalker.get();
|
||||
}
|
||||
|
||||
@ -2256,7 +2256,7 @@ MemorySSAAnalysis::Result MemorySSAAnalysis::run(Function &F,
|
||||
FunctionAnalysisManager &AM) {
|
||||
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
|
||||
auto &AA = AM.getResult<AAManager>(F);
|
||||
return MemorySSAAnalysis::Result(llvm::make_unique<MemorySSA>(F, &AA, &DT));
|
||||
return MemorySSAAnalysis::Result(std::make_unique<MemorySSA>(F, &AA, &DT));
|
||||
}
|
||||
|
||||
bool MemorySSAAnalysis::Result::invalidate(
|
||||
|
@ -467,7 +467,7 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
|
||||
// FIXME: refactor this to use the same code that inliner is using.
|
||||
// Don't try to import functions with noinline attribute.
|
||||
F.getAttributes().hasFnAttribute(Attribute::NoInline)};
|
||||
auto FuncSummary = llvm::make_unique<FunctionSummary>(
|
||||
auto FuncSummary = std::make_unique<FunctionSummary>(
|
||||
Flags, NumInsts, FunFlags, /*EntryCount=*/0, std::move(Refs),
|
||||
CallGraphEdges.takeVector(), TypeTests.takeVector(),
|
||||
TypeTestAssumeVCalls.takeVector(), TypeCheckedLoadVCalls.takeVector(),
|
||||
@ -598,7 +598,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
|
||||
!V.hasComdat() && !V.hasAppendingLinkage() && !V.isInterposable() &&
|
||||
!V.hasAvailableExternallyLinkage() && !V.hasDLLExportStorageClass();
|
||||
GlobalVarSummary::GVarFlags VarFlags(CanBeInternalized, CanBeInternalized);
|
||||
auto GVarSummary = llvm::make_unique<GlobalVarSummary>(Flags, VarFlags,
|
||||
auto GVarSummary = std::make_unique<GlobalVarSummary>(Flags, VarFlags,
|
||||
RefEdges.takeVector());
|
||||
if (NonRenamableLocal)
|
||||
CantBePromoted.insert(V.getGUID());
|
||||
@ -616,7 +616,7 @@ computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A,
|
||||
GlobalValueSummary::GVFlags Flags(A.getLinkage(), NonRenamableLocal,
|
||||
/* Live = */ false, A.isDSOLocal(),
|
||||
A.hasLinkOnceODRLinkage() && A.hasGlobalUnnamedAddr());
|
||||
auto AS = llvm::make_unique<AliasSummary>(Flags);
|
||||
auto AS = std::make_unique<AliasSummary>(Flags);
|
||||
auto *Aliasee = A.getBaseObject();
|
||||
auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
|
||||
assert(AliaseeVI && "Alias expects aliasee summary to be available");
|
||||
@ -696,7 +696,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
// Create the appropriate summary type.
|
||||
if (Function *F = dyn_cast<Function>(GV)) {
|
||||
std::unique_ptr<FunctionSummary> Summary =
|
||||
llvm::make_unique<FunctionSummary>(
|
||||
std::make_unique<FunctionSummary>(
|
||||
GVFlags, /*InstCount=*/0,
|
||||
FunctionSummary::FFlags{
|
||||
F->hasFnAttribute(Attribute::ReadNone),
|
||||
@ -714,7 +714,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
Index.addGlobalValueSummary(*GV, std::move(Summary));
|
||||
} else {
|
||||
std::unique_ptr<GlobalVarSummary> Summary =
|
||||
llvm::make_unique<GlobalVarSummary>(
|
||||
std::make_unique<GlobalVarSummary>(
|
||||
GVFlags, GlobalVarSummary::GVarFlags(false, false),
|
||||
ArrayRef<ValueInfo>{});
|
||||
Index.addGlobalValueSummary(*GV, std::move(Summary));
|
||||
@ -741,7 +741,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
else if (F.hasProfileData()) {
|
||||
LoopInfo LI{DT};
|
||||
BranchProbabilityInfo BPI{F, LI};
|
||||
BFIPtr = llvm::make_unique<BlockFrequencyInfo>(F, BPI, LI);
|
||||
BFIPtr = std::make_unique<BlockFrequencyInfo>(F, BPI, LI);
|
||||
BFI = BFIPtr.get();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ OptimizationRemarkEmitter::OptimizationRemarkEmitter(const Function *F)
|
||||
BPI.calculate(*F, LI);
|
||||
|
||||
// Finally compute BFI.
|
||||
OwnedBFI = llvm::make_unique<BlockFrequencyInfo>(*F, BPI, LI);
|
||||
OwnedBFI = std::make_unique<BlockFrequencyInfo>(*F, BPI, LI);
|
||||
BFI = OwnedBFI.get();
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ bool OptimizationRemarkEmitterWrapperPass::runOnFunction(Function &Fn) {
|
||||
else
|
||||
BFI = nullptr;
|
||||
|
||||
ORE = llvm::make_unique<OptimizationRemarkEmitter>(&Fn, BFI);
|
||||
ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn, BFI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ bool OrderedInstructions::localDominates(const Instruction *InstA,
|
||||
const BasicBlock *IBB = InstA->getParent();
|
||||
auto OBB = OBBMap.find(IBB);
|
||||
if (OBB == OBBMap.end())
|
||||
OBB = OBBMap.insert({IBB, make_unique<OrderedBasicBlock>(IBB)}).first;
|
||||
OBB = OBBMap.insert({IBB, std::make_unique<OrderedBasicBlock>(IBB)}).first;
|
||||
return OBB->second->dominates(InstA, InstB);
|
||||
}
|
||||
|
||||
|
@ -3107,7 +3107,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
ParseToken(lltok::rbrace, "expected end of struct constant"))
|
||||
return true;
|
||||
|
||||
ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
|
||||
ID.ConstantStructElts = std::make_unique<Constant *[]>(Elts.size());
|
||||
ID.UIntVal = Elts.size();
|
||||
memcpy(ID.ConstantStructElts.get(), Elts.data(),
|
||||
Elts.size() * sizeof(Elts[0]));
|
||||
@ -3129,7 +3129,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
return true;
|
||||
|
||||
if (isPackedStruct) {
|
||||
ID.ConstantStructElts = make_unique<Constant *[]>(Elts.size());
|
||||
ID.ConstantStructElts = std::make_unique<Constant *[]>(Elts.size());
|
||||
memcpy(ID.ConstantStructElts.get(), Elts.data(),
|
||||
Elts.size() * sizeof(Elts[0]));
|
||||
ID.UIntVal = Elts.size();
|
||||
@ -8088,7 +8088,7 @@ bool LLParser::ParseFunctionSummary(std::string Name, GlobalValue::GUID GUID,
|
||||
if (ParseToken(lltok::rparen, "expected ')' here"))
|
||||
return true;
|
||||
|
||||
auto FS = llvm::make_unique<FunctionSummary>(
|
||||
auto FS = std::make_unique<FunctionSummary>(
|
||||
GVFlags, InstCount, FFlags, /*EntryCount=*/0, std::move(Refs),
|
||||
std::move(Calls), std::move(TypeIdInfo.TypeTests),
|
||||
std::move(TypeIdInfo.TypeTestAssumeVCalls),
|
||||
@ -8148,7 +8148,7 @@ bool LLParser::ParseVariableSummary(std::string Name, GlobalValue::GUID GUID,
|
||||
return true;
|
||||
|
||||
auto GS =
|
||||
llvm::make_unique<GlobalVarSummary>(GVFlags, GVarFlags, std::move(Refs));
|
||||
std::make_unique<GlobalVarSummary>(GVFlags, GVarFlags, std::move(Refs));
|
||||
|
||||
GS->setModulePath(ModulePath);
|
||||
GS->setVTableFuncs(std::move(VTableFuncs));
|
||||
@ -8189,7 +8189,7 @@ bool LLParser::ParseAliasSummary(std::string Name, GlobalValue::GUID GUID,
|
||||
if (ParseToken(lltok::rparen, "expected ')' here"))
|
||||
return true;
|
||||
|
||||
auto AS = llvm::make_unique<AliasSummary>(GVFlags);
|
||||
auto AS = std::make_unique<AliasSummary>(GVFlags);
|
||||
|
||||
AS->setModulePath(ModulePath);
|
||||
|
||||
|
@ -42,7 +42,7 @@ llvm::parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
|
||||
SlotMapping *Slots, bool UpgradeDebugInfo,
|
||||
StringRef DataLayoutString) {
|
||||
std::unique_ptr<Module> M =
|
||||
make_unique<Module>(F.getBufferIdentifier(), Context);
|
||||
std::make_unique<Module>(F.getBufferIdentifier(), Context);
|
||||
|
||||
if (parseAssemblyInto(F, M.get(), nullptr, Err, Slots, UpgradeDebugInfo,
|
||||
DataLayoutString))
|
||||
@ -71,9 +71,9 @@ ParsedModuleAndIndex llvm::parseAssemblyWithIndex(
|
||||
MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
|
||||
SlotMapping *Slots, bool UpgradeDebugInfo, StringRef DataLayoutString) {
|
||||
std::unique_ptr<Module> M =
|
||||
make_unique<Module>(F.getBufferIdentifier(), Context);
|
||||
std::make_unique<Module>(F.getBufferIdentifier(), Context);
|
||||
std::unique_ptr<ModuleSummaryIndex> Index =
|
||||
make_unique<ModuleSummaryIndex>(/*HaveGVs=*/true);
|
||||
std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/true);
|
||||
|
||||
if (parseAssemblyInto(F, M.get(), Index.get(), Err, Slots, UpgradeDebugInfo,
|
||||
DataLayoutString))
|
||||
@ -123,7 +123,7 @@ static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F,
|
||||
std::unique_ptr<ModuleSummaryIndex>
|
||||
llvm::parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err) {
|
||||
std::unique_ptr<ModuleSummaryIndex> Index =
|
||||
make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
|
||||
std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
|
||||
|
||||
if (parseSummaryIndexAssemblyInto(F, *Index, Err))
|
||||
return nullptr;
|
||||
|
@ -5874,7 +5874,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
ArrayRef<uint64_t>(Record).slice(CallGraphEdgeStartIndex),
|
||||
IsOldProfileFormat, HasProfile, HasRelBF);
|
||||
setSpecialRefs(Refs, NumRORefs, NumWORefs);
|
||||
auto FS = llvm::make_unique<FunctionSummary>(
|
||||
auto FS = std::make_unique<FunctionSummary>(
|
||||
Flags, InstCount, getDecodedFFlags(RawFunFlags), /*EntryCount=*/0,
|
||||
std::move(Refs), std::move(Calls), std::move(PendingTypeTests),
|
||||
std::move(PendingTypeTestAssumeVCalls),
|
||||
@ -5900,7 +5900,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
uint64_t RawFlags = Record[1];
|
||||
unsigned AliaseeID = Record[2];
|
||||
auto Flags = getDecodedGVSummaryFlags(RawFlags, Version);
|
||||
auto AS = llvm::make_unique<AliasSummary>(Flags);
|
||||
auto AS = std::make_unique<AliasSummary>(Flags);
|
||||
// The module path string ref set in the summary must be owned by the
|
||||
// index's module string table. Since we don't have a module path
|
||||
// string table section in the per-module index, we create a single
|
||||
@ -5934,7 +5934,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
std::vector<ValueInfo> Refs =
|
||||
makeRefList(ArrayRef<uint64_t>(Record).slice(RefArrayStart));
|
||||
auto FS =
|
||||
llvm::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
std::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
FS->setModulePath(getThisModule()->first());
|
||||
auto GUID = getValueInfoFromValueId(ValueID);
|
||||
FS->setOriginalName(GUID.second);
|
||||
@ -5961,7 +5961,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
VTableFuncs.push_back({Callee, Offset});
|
||||
}
|
||||
auto VS =
|
||||
llvm::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
std::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
VS->setModulePath(getThisModule()->first());
|
||||
VS->setVTableFuncs(VTableFuncs);
|
||||
auto GUID = getValueInfoFromValueId(ValueID);
|
||||
@ -6019,7 +6019,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
IsOldProfileFormat, HasProfile, false);
|
||||
ValueInfo VI = getValueInfoFromValueId(ValueID).first;
|
||||
setSpecialRefs(Refs, NumRORefs, NumWORefs);
|
||||
auto FS = llvm::make_unique<FunctionSummary>(
|
||||
auto FS = std::make_unique<FunctionSummary>(
|
||||
Flags, InstCount, getDecodedFFlags(RawFunFlags), EntryCount,
|
||||
std::move(Refs), std::move(Edges), std::move(PendingTypeTests),
|
||||
std::move(PendingTypeTestAssumeVCalls),
|
||||
@ -6046,7 +6046,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
uint64_t RawFlags = Record[2];
|
||||
unsigned AliaseeValueId = Record[3];
|
||||
auto Flags = getDecodedGVSummaryFlags(RawFlags, Version);
|
||||
auto AS = llvm::make_unique<AliasSummary>(Flags);
|
||||
auto AS = std::make_unique<AliasSummary>(Flags);
|
||||
LastSeenSummary = AS.get();
|
||||
AS->setModulePath(ModuleIdMap[ModuleId]);
|
||||
|
||||
@ -6075,7 +6075,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
|
||||
std::vector<ValueInfo> Refs =
|
||||
makeRefList(ArrayRef<uint64_t>(Record).slice(RefArrayStart));
|
||||
auto FS =
|
||||
llvm::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
std::make_unique<GlobalVarSummary>(Flags, GVF, std::move(Refs));
|
||||
LastSeenSummary = FS.get();
|
||||
FS->setModulePath(ModuleIdMap[ModuleId]);
|
||||
ValueInfo VI = getValueInfoFromValueId(ValueID).first;
|
||||
@ -6438,7 +6438,7 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
|
||||
Context);
|
||||
|
||||
std::unique_ptr<Module> M =
|
||||
llvm::make_unique<Module>(ModuleIdentifier, Context);
|
||||
std::make_unique<Module>(ModuleIdentifier, Context);
|
||||
M->setMaterializer(R);
|
||||
|
||||
// Delay parsing Metadata if ShouldLazyLoadMetadata is true.
|
||||
@ -6485,7 +6485,7 @@ Expected<std::unique_ptr<ModuleSummaryIndex>> BitcodeModule::getSummary() {
|
||||
if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
|
||||
return std::move(JumpFailed);
|
||||
|
||||
auto Index = llvm::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
|
||||
auto Index = std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
|
||||
ModuleSummaryIndexBitcodeReader R(std::move(Stream), Strtab, *Index,
|
||||
ModuleIdentifier, 0);
|
||||
|
||||
|
@ -2133,7 +2133,7 @@ MetadataLoader::MetadataLoader(BitstreamCursor &Stream, Module &TheModule,
|
||||
BitcodeReaderValueList &ValueList,
|
||||
bool IsImporting,
|
||||
std::function<Type *(unsigned)> getTypeByID)
|
||||
: Pimpl(llvm::make_unique<MetadataLoaderImpl>(
|
||||
: Pimpl(std::make_unique<MetadataLoaderImpl>(
|
||||
Stream, TheModule, ValueList, std::move(getTypeByID), IsImporting)) {}
|
||||
|
||||
Error MetadataLoader::parseMetadata(bool ModuleLevel) {
|
||||
|
@ -311,7 +311,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
if (MAI->doesSupportDebugInformation()) {
|
||||
bool EmitCodeView = MMI->getModule()->getCodeViewFlag();
|
||||
if (EmitCodeView && TM.getTargetTriple().isOSWindows()) {
|
||||
Handlers.emplace_back(llvm::make_unique<CodeViewDebug>(this),
|
||||
Handlers.emplace_back(std::make_unique<CodeViewDebug>(this),
|
||||
DbgTimerName, DbgTimerDescription,
|
||||
CodeViewLineTablesGroupName,
|
||||
CodeViewLineTablesGroupDescription);
|
||||
@ -380,7 +380,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
|
||||
if (mdconst::extract_or_null<ConstantInt>(
|
||||
MMI->getModule()->getModuleFlag("cfguardtable")))
|
||||
Handlers.emplace_back(llvm::make_unique<WinCFGuard>(this), CFGuardName,
|
||||
Handlers.emplace_back(std::make_unique<WinCFGuard>(this), CFGuardName,
|
||||
CFGuardDescription, DWARFGroupName,
|
||||
DWARFGroupDescription);
|
||||
|
||||
@ -1025,7 +1025,7 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
// Get MachineDominatorTree or compute it on the fly if it's unavailable
|
||||
MDT = getAnalysisIfAvailable<MachineDominatorTree>();
|
||||
if (!MDT) {
|
||||
OwnedMDT = make_unique<MachineDominatorTree>();
|
||||
OwnedMDT = std::make_unique<MachineDominatorTree>();
|
||||
OwnedMDT->getBase().recalculate(*MF);
|
||||
MDT = OwnedMDT.get();
|
||||
}
|
||||
@ -1033,7 +1033,7 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
// Get MachineLoopInfo or compute it on the fly if it's unavailable
|
||||
MLI = getAnalysisIfAvailable<MachineLoopInfo>();
|
||||
if (!MLI) {
|
||||
OwnedMLI = make_unique<MachineLoopInfo>();
|
||||
OwnedMLI = std::make_unique<MachineLoopInfo>();
|
||||
OwnedMLI->getBase().analyze(MDT->getBase());
|
||||
MLI = OwnedMLI.get();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ static void srcMgrDiagHandler(const SMDiagnostic &Diag, void *diagInfo) {
|
||||
unsigned AsmPrinter::addInlineAsmDiagBuffer(StringRef AsmStr,
|
||||
const MDNode *LocMDNode) const {
|
||||
if (!DiagInfo) {
|
||||
DiagInfo = make_unique<SrcMgrDiagInfo>();
|
||||
DiagInfo = std::make_unique<SrcMgrDiagInfo>();
|
||||
|
||||
MCContext &Context = MMI->getContext();
|
||||
Context.setInlineSourceManager(&DiagInfo->SrcMgr);
|
||||
|
@ -648,9 +648,9 @@ void CodeViewDebug::emitTypeInformation() {
|
||||
|
||||
if (OS.isVerboseAsm()) {
|
||||
// To construct block comment describing the type record for readability.
|
||||
SP = llvm::make_unique<ScopedPrinter>(CommentOS);
|
||||
SP = std::make_unique<ScopedPrinter>(CommentOS);
|
||||
SP->setPrefix(CommentPrefix);
|
||||
TDV = llvm::make_unique<TypeDumpVisitor>(Table, SP.get(), false);
|
||||
TDV = std::make_unique<TypeDumpVisitor>(Table, SP.get(), false);
|
||||
Pipeline.addCallbackToPipeline(*TDV);
|
||||
}
|
||||
|
||||
@ -1363,7 +1363,7 @@ void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) {
|
||||
const TargetRegisterInfo *TRI = TSI.getRegisterInfo();
|
||||
const MachineFrameInfo &MFI = MF->getFrameInfo();
|
||||
const Function &GV = MF->getFunction();
|
||||
auto Insertion = FnDebugInfo.insert({&GV, llvm::make_unique<FunctionInfo>()});
|
||||
auto Insertion = FnDebugInfo.insert({&GV, std::make_unique<FunctionInfo>()});
|
||||
assert(Insertion.second && "function already has info");
|
||||
CurFn = Insertion.first->second.get();
|
||||
CurFn->FuncId = NextFuncId++;
|
||||
@ -3015,7 +3015,7 @@ void CodeViewDebug::collectGlobalVariableInfo() {
|
||||
auto Insertion = ScopeGlobals.insert(
|
||||
{Scope, std::unique_ptr<GlobalVariableList>()});
|
||||
if (Insertion.second)
|
||||
Insertion.first->second = llvm::make_unique<GlobalVariableList>();
|
||||
Insertion.first->second = std::make_unique<GlobalVariableList>();
|
||||
VariableList = Insertion.first->second.get();
|
||||
} else if (GV->hasComdat())
|
||||
// Emit this global variable into a COMDAT section.
|
||||
|
@ -208,7 +208,7 @@ void DwarfCompileUnit::addLocationAttribute(
|
||||
if (!Loc) {
|
||||
addToAccelTable = true;
|
||||
Loc = new (DIEValueAllocator) DIELoc;
|
||||
DwarfExpr = llvm::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
|
||||
DwarfExpr = std::make_unique<DIEDwarfExpression>(*Asm, *this, *Loc);
|
||||
}
|
||||
|
||||
if (Expr) {
|
||||
@ -1071,11 +1071,11 @@ void DwarfCompileUnit::createAbstractEntity(const DINode *Node,
|
||||
assert(Scope && Scope->isAbstractScope());
|
||||
auto &Entity = getAbstractEntities()[Node];
|
||||
if (isa<const DILocalVariable>(Node)) {
|
||||
Entity = llvm::make_unique<DbgVariable>(
|
||||
Entity = std::make_unique<DbgVariable>(
|
||||
cast<const DILocalVariable>(Node), nullptr /* IA */);;
|
||||
DU->addScopeVariable(Scope, cast<DbgVariable>(Entity.get()));
|
||||
} else if (isa<const DILabel>(Node)) {
|
||||
Entity = llvm::make_unique<DbgLabel>(
|
||||
Entity = std::make_unique<DbgLabel>(
|
||||
cast<const DILabel>(Node), nullptr /* IA */);
|
||||
DU->addScopeLabel(Scope, cast<DbgLabel>(Entity.get()));
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ void DbgVariable::initializeDbgValue(const MachineInstr *DbgValue) {
|
||||
assert(getInlinedAt() == DbgValue->getDebugLoc()->getInlinedAt() &&
|
||||
"Wrong inlined-at");
|
||||
|
||||
ValueLoc = llvm::make_unique<DbgValueLoc>(getDebugLocValue(DbgValue));
|
||||
ValueLoc = std::make_unique<DbgValueLoc>(getDebugLocValue(DbgValue));
|
||||
if (auto *E = DbgValue->getDebugExpression())
|
||||
if (E->getNumElements())
|
||||
FrameIndexExprs.push_back({0, E});
|
||||
@ -864,7 +864,7 @@ DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) {
|
||||
|
||||
CompilationDir = DIUnit->getDirectory();
|
||||
|
||||
auto OwnedUnit = llvm::make_unique<DwarfCompileUnit>(
|
||||
auto OwnedUnit = std::make_unique<DwarfCompileUnit>(
|
||||
InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
|
||||
DwarfCompileUnit &NewCU = *OwnedUnit;
|
||||
InfoHolder.addUnit(std::move(OwnedUnit));
|
||||
@ -1289,7 +1289,7 @@ void DwarfDebug::collectVariableInfoFromMFTable(
|
||||
continue;
|
||||
|
||||
ensureAbstractEntityIsCreatedIfScoped(TheCU, Var.first, Scope->getScopeNode());
|
||||
auto RegVar = llvm::make_unique<DbgVariable>(
|
||||
auto RegVar = std::make_unique<DbgVariable>(
|
||||
cast<DILocalVariable>(Var.first), Var.second);
|
||||
RegVar->initializeMMI(VI.Expr, VI.Slot);
|
||||
if (DbgVariable *DbgVar = MFVars.lookup(Var))
|
||||
@ -1500,13 +1500,13 @@ DbgEntity *DwarfDebug::createConcreteEntity(DwarfCompileUnit &TheCU,
|
||||
ensureAbstractEntityIsCreatedIfScoped(TheCU, Node, Scope.getScopeNode());
|
||||
if (isa<const DILocalVariable>(Node)) {
|
||||
ConcreteEntities.push_back(
|
||||
llvm::make_unique<DbgVariable>(cast<const DILocalVariable>(Node),
|
||||
std::make_unique<DbgVariable>(cast<const DILocalVariable>(Node),
|
||||
Location));
|
||||
InfoHolder.addScopeVariable(&Scope,
|
||||
cast<DbgVariable>(ConcreteEntities.back().get()));
|
||||
} else if (isa<const DILabel>(Node)) {
|
||||
ConcreteEntities.push_back(
|
||||
llvm::make_unique<DbgLabel>(cast<const DILabel>(Node),
|
||||
std::make_unique<DbgLabel>(cast<const DILabel>(Node),
|
||||
Location, Sym));
|
||||
InfoHolder.addScopeLabel(&Scope,
|
||||
cast<DbgLabel>(ConcreteEntities.back().get()));
|
||||
@ -2824,7 +2824,7 @@ void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
|
||||
|
||||
DwarfCompileUnit &DwarfDebug::constructSkeletonCU(const DwarfCompileUnit &CU) {
|
||||
|
||||
auto OwnedUnit = llvm::make_unique<DwarfCompileUnit>(
|
||||
auto OwnedUnit = std::make_unique<DwarfCompileUnit>(
|
||||
CU.getUniqueID(), CU.getCUNode(), Asm, this, &SkeletonHolder);
|
||||
DwarfCompileUnit &NewCU = *OwnedUnit;
|
||||
NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
|
||||
@ -2924,7 +2924,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
||||
bool TopLevelType = TypeUnitsUnderConstruction.empty();
|
||||
AddrPool.resetUsedFlag();
|
||||
|
||||
auto OwnedUnit = llvm::make_unique<DwarfTypeUnit>(CU, Asm, this, &InfoHolder,
|
||||
auto OwnedUnit = std::make_unique<DwarfTypeUnit>(CU, Asm, this, &InfoHolder,
|
||||
getDwoLineTable(CU));
|
||||
DwarfTypeUnit &NewTU = *OwnedUnit;
|
||||
DIE &UnitDie = NewTU.getUnitDie();
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
assert(!ValueLoc && "Already initialized?");
|
||||
assert(!Value.getExpression()->isFragment() && "Fragments not supported.");
|
||||
|
||||
ValueLoc = llvm::make_unique<DbgValueLoc>(Value);
|
||||
ValueLoc = std::make_unique<DbgValueLoc>(Value);
|
||||
if (auto *E = ValueLoc->getExpression())
|
||||
if (E->getNumElements())
|
||||
FrameIndexExprs.push_back({0, E});
|
||||
|
@ -344,7 +344,7 @@ class TypePromotionTransaction;
|
||||
// Get the DominatorTree, building if necessary.
|
||||
DominatorTree &getDT(Function &F) {
|
||||
if (!DT)
|
||||
DT = llvm::make_unique<DominatorTree>(F);
|
||||
DT = std::make_unique<DominatorTree>(F);
|
||||
return *DT;
|
||||
}
|
||||
|
||||
@ -2680,26 +2680,26 @@ private:
|
||||
|
||||
void TypePromotionTransaction::setOperand(Instruction *Inst, unsigned Idx,
|
||||
Value *NewVal) {
|
||||
Actions.push_back(llvm::make_unique<TypePromotionTransaction::OperandSetter>(
|
||||
Actions.push_back(std::make_unique<TypePromotionTransaction::OperandSetter>(
|
||||
Inst, Idx, NewVal));
|
||||
}
|
||||
|
||||
void TypePromotionTransaction::eraseInstruction(Instruction *Inst,
|
||||
Value *NewVal) {
|
||||
Actions.push_back(
|
||||
llvm::make_unique<TypePromotionTransaction::InstructionRemover>(
|
||||
std::make_unique<TypePromotionTransaction::InstructionRemover>(
|
||||
Inst, RemovedInsts, NewVal));
|
||||
}
|
||||
|
||||
void TypePromotionTransaction::replaceAllUsesWith(Instruction *Inst,
|
||||
Value *New) {
|
||||
Actions.push_back(
|
||||
llvm::make_unique<TypePromotionTransaction::UsesReplacer>(Inst, New));
|
||||
std::make_unique<TypePromotionTransaction::UsesReplacer>(Inst, New));
|
||||
}
|
||||
|
||||
void TypePromotionTransaction::mutateType(Instruction *Inst, Type *NewTy) {
|
||||
Actions.push_back(
|
||||
llvm::make_unique<TypePromotionTransaction::TypeMutator>(Inst, NewTy));
|
||||
std::make_unique<TypePromotionTransaction::TypeMutator>(Inst, NewTy));
|
||||
}
|
||||
|
||||
Value *TypePromotionTransaction::createTrunc(Instruction *Opnd,
|
||||
@ -2729,7 +2729,7 @@ Value *TypePromotionTransaction::createZExt(Instruction *Inst,
|
||||
void TypePromotionTransaction::moveBefore(Instruction *Inst,
|
||||
Instruction *Before) {
|
||||
Actions.push_back(
|
||||
llvm::make_unique<TypePromotionTransaction::InstructionMoveBefore>(
|
||||
std::make_unique<TypePromotionTransaction::InstructionMoveBefore>(
|
||||
Inst, Before));
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) {
|
||||
return *I->second;
|
||||
|
||||
GCStrategy *S = getGCStrategy(F.getGC());
|
||||
Functions.push_back(llvm::make_unique<GCFunctionInfo>(F, *S));
|
||||
Functions.push_back(std::make_unique<GCFunctionInfo>(F, *S));
|
||||
GCFunctionInfo *GFI = Functions.back().get();
|
||||
FInfoMap[&F] = GFI;
|
||||
return *GFI;
|
||||
|
@ -65,9 +65,9 @@ std::unique_ptr<CSEConfigBase>
|
||||
llvm::getStandardCSEConfigForOpt(CodeGenOpt::Level Level) {
|
||||
std::unique_ptr<CSEConfigBase> Config;
|
||||
if (Level == CodeGenOpt::None)
|
||||
Config = make_unique<CSEConfigConstantOnly>();
|
||||
Config = std::make_unique<CSEConfigConstantOnly>();
|
||||
else
|
||||
Config = make_unique<CSEConfigFull>();
|
||||
Config = std::make_unique<CSEConfigFull>();
|
||||
return Config;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ bool Combiner::combineMachineInstrs(MachineFunction &MF,
|
||||
return false;
|
||||
|
||||
Builder =
|
||||
CSEInfo ? make_unique<CSEMIRBuilder>() : make_unique<MachineIRBuilder>();
|
||||
CSEInfo ? std::make_unique<CSEMIRBuilder>() : std::make_unique<MachineIRBuilder>();
|
||||
MRI = &MF.getRegInfo();
|
||||
Builder->setMF(MF);
|
||||
if (CSEInfo)
|
||||
|
@ -2193,26 +2193,26 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
|
||||
: TPC->isGISelCSEEnabled();
|
||||
|
||||
if (EnableCSE) {
|
||||
EntryBuilder = make_unique<CSEMIRBuilder>(CurMF);
|
||||
EntryBuilder = std::make_unique<CSEMIRBuilder>(CurMF);
|
||||
CSEInfo = &Wrapper.get(TPC->getCSEConfig());
|
||||
EntryBuilder->setCSEInfo(CSEInfo);
|
||||
CurBuilder = make_unique<CSEMIRBuilder>(CurMF);
|
||||
CurBuilder = std::make_unique<CSEMIRBuilder>(CurMF);
|
||||
CurBuilder->setCSEInfo(CSEInfo);
|
||||
} else {
|
||||
EntryBuilder = make_unique<MachineIRBuilder>();
|
||||
CurBuilder = make_unique<MachineIRBuilder>();
|
||||
EntryBuilder = std::make_unique<MachineIRBuilder>();
|
||||
CurBuilder = std::make_unique<MachineIRBuilder>();
|
||||
}
|
||||
CLI = MF->getSubtarget().getCallLowering();
|
||||
CurBuilder->setMF(*MF);
|
||||
EntryBuilder->setMF(*MF);
|
||||
MRI = &MF->getRegInfo();
|
||||
DL = &F.getParent()->getDataLayout();
|
||||
ORE = llvm::make_unique<OptimizationRemarkEmitter>(&F);
|
||||
ORE = std::make_unique<OptimizationRemarkEmitter>(&F);
|
||||
FuncInfo.MF = MF;
|
||||
FuncInfo.BPI = nullptr;
|
||||
const auto &TLI = *MF->getSubtarget().getTargetLowering();
|
||||
const TargetMachine &TM = MF->getTarget();
|
||||
SL = make_unique<GISelSwitchLowering>(this, FuncInfo);
|
||||
SL = std::make_unique<GISelSwitchLowering>(this, FuncInfo);
|
||||
SL->init(TLI, TM, *DL);
|
||||
|
||||
EnableOpts = TM.getOptLevel() != CodeGenOpt::None && !skipFunction(F);
|
||||
|
@ -184,11 +184,11 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
|
||||
: TPC.isGISelCSEEnabled();
|
||||
|
||||
if (EnableCSE) {
|
||||
MIRBuilder = make_unique<CSEMIRBuilder>();
|
||||
MIRBuilder = std::make_unique<CSEMIRBuilder>();
|
||||
CSEInfo = &Wrapper.get(TPC.getCSEConfig());
|
||||
MIRBuilder->setCSEInfo(CSEInfo);
|
||||
} else
|
||||
MIRBuilder = make_unique<MachineIRBuilder>();
|
||||
MIRBuilder = std::make_unique<MachineIRBuilder>();
|
||||
// This observer keeps the worklist updated.
|
||||
LegalizerWorkListManager WorkListObserver(InstList, ArtifactList);
|
||||
// We want both WorkListObserver as well as CSEInfo to observe all changes.
|
||||
|
@ -92,7 +92,7 @@ void RegBankSelect::init(MachineFunction &MF) {
|
||||
MBPI = nullptr;
|
||||
}
|
||||
MIRBuilder.setMF(MF);
|
||||
MORE = llvm::make_unique<MachineOptimizationRemarkEmitter>(MF, MBFI);
|
||||
MORE = std::make_unique<MachineOptimizationRemarkEmitter>(MF, MBFI);
|
||||
}
|
||||
|
||||
void RegBankSelect::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
@ -283,7 +283,7 @@ RegisterBankInfo::getPartialMapping(unsigned StartIdx, unsigned Length,
|
||||
++NumPartialMappingsCreated;
|
||||
|
||||
auto &PartMapping = MapOfPartialMappings[Hash];
|
||||
PartMapping = llvm::make_unique<PartialMapping>(StartIdx, Length, RegBank);
|
||||
PartMapping = std::make_unique<PartialMapping>(StartIdx, Length, RegBank);
|
||||
return *PartMapping;
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
|
||||
++NumValueMappingsCreated;
|
||||
|
||||
auto &ValMapping = MapOfValueMappings[Hash];
|
||||
ValMapping = llvm::make_unique<ValueMapping>(BreakDown, NumBreakDowns);
|
||||
ValMapping = std::make_unique<ValueMapping>(BreakDown, NumBreakDowns);
|
||||
return *ValMapping;
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ RegisterBankInfo::getOperandsMapping(Iterator Begin, Iterator End) const {
|
||||
// mapping, because we use the pointer of the ValueMapping
|
||||
// to hash and we expect them to uniquely identify an instance
|
||||
// of value mapping.
|
||||
Res = llvm::make_unique<ValueMapping[]>(std::distance(Begin, End));
|
||||
Res = std::make_unique<ValueMapping[]>(std::distance(Begin, End));
|
||||
unsigned Idx = 0;
|
||||
for (Iterator It = Begin; It != End; ++It, ++Idx) {
|
||||
const ValueMapping *ValMap = *It;
|
||||
@ -391,7 +391,7 @@ RegisterBankInfo::getInstructionMappingImpl(
|
||||
++NumInstructionMappingsCreated;
|
||||
|
||||
auto &InstrMapping = MapOfInstructionMappings[Hash];
|
||||
InstrMapping = llvm::make_unique<InstructionMapping>(
|
||||
InstrMapping = std::make_unique<InstructionMapping>(
|
||||
ID, Cost, OperandsMapping, NumOperands);
|
||||
return *InstrMapping;
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ void IfConverter::AnalyzeBlock(
|
||||
// \ /
|
||||
// TailBB
|
||||
// Note TailBB can be empty.
|
||||
Tokens.push_back(llvm::make_unique<IfcvtToken>(
|
||||
Tokens.push_back(std::make_unique<IfcvtToken>(
|
||||
BBI, ICDiamond, TNeedSub | FNeedSub, Dups, Dups2,
|
||||
(bool) TrueBBICalc.ClobbersPred, (bool) FalseBBICalc.ClobbersPred));
|
||||
Enqueued = true;
|
||||
@ -1218,7 +1218,7 @@ void IfConverter::AnalyzeBlock(
|
||||
// / \ / \
|
||||
// FalseBB TrueBB FalseBB
|
||||
//
|
||||
Tokens.push_back(llvm::make_unique<IfcvtToken>(
|
||||
Tokens.push_back(std::make_unique<IfcvtToken>(
|
||||
BBI, ICForkedDiamond, TNeedSub | FNeedSub, Dups, Dups2,
|
||||
(bool) TrueBBICalc.ClobbersPred, (bool) FalseBBICalc.ClobbersPred));
|
||||
Enqueued = true;
|
||||
@ -1238,7 +1238,7 @@ void IfConverter::AnalyzeBlock(
|
||||
// | /
|
||||
// FBB
|
||||
Tokens.push_back(
|
||||
llvm::make_unique<IfcvtToken>(BBI, ICTriangle, TNeedSub, Dups));
|
||||
std::make_unique<IfcvtToken>(BBI, ICTriangle, TNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
|
||||
@ -1247,7 +1247,7 @@ void IfConverter::AnalyzeBlock(
|
||||
TrueBBI.ExtraCost2, Prediction) &&
|
||||
FeasibilityAnalysis(TrueBBI, BBI.BrCond, true, true)) {
|
||||
Tokens.push_back(
|
||||
llvm::make_unique<IfcvtToken>(BBI, ICTriangleRev, TNeedSub, Dups));
|
||||
std::make_unique<IfcvtToken>(BBI, ICTriangleRev, TNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
|
||||
@ -1263,7 +1263,7 @@ void IfConverter::AnalyzeBlock(
|
||||
// |
|
||||
// FBB
|
||||
Tokens.push_back(
|
||||
llvm::make_unique<IfcvtToken>(BBI, ICSimple, TNeedSub, Dups));
|
||||
std::make_unique<IfcvtToken>(BBI, ICSimple, TNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
|
||||
@ -1275,7 +1275,7 @@ void IfConverter::AnalyzeBlock(
|
||||
FalseBBI.NonPredSize + FalseBBI.ExtraCost,
|
||||
FalseBBI.ExtraCost2, Prediction.getCompl()) &&
|
||||
FeasibilityAnalysis(FalseBBI, RevCond, true)) {
|
||||
Tokens.push_back(llvm::make_unique<IfcvtToken>(BBI, ICTriangleFalse,
|
||||
Tokens.push_back(std::make_unique<IfcvtToken>(BBI, ICTriangleFalse,
|
||||
FNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ void IfConverter::AnalyzeBlock(
|
||||
FalseBBI.ExtraCost2, Prediction.getCompl()) &&
|
||||
FeasibilityAnalysis(FalseBBI, RevCond, true, true)) {
|
||||
Tokens.push_back(
|
||||
llvm::make_unique<IfcvtToken>(BBI, ICTriangleFRev, FNeedSub, Dups));
|
||||
std::make_unique<IfcvtToken>(BBI, ICTriangleFRev, FNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
|
||||
@ -1297,7 +1297,7 @@ void IfConverter::AnalyzeBlock(
|
||||
FalseBBI.ExtraCost2, Prediction.getCompl()) &&
|
||||
FeasibilityAnalysis(FalseBBI, RevCond)) {
|
||||
Tokens.push_back(
|
||||
llvm::make_unique<IfcvtToken>(BBI, ICSimpleFalse, FNeedSub, Dups));
|
||||
std::make_unique<IfcvtToken>(BBI, ICSimpleFalse, FNeedSub, Dups));
|
||||
Enqueued = true;
|
||||
}
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ void HoistSpillHelper::addToMergeableSpills(MachineInstr &Spill, int StackSlot,
|
||||
// save a copy of LiveInterval in StackSlotToOrigLI because the original
|
||||
// LiveInterval may be cleared after all its references are spilled.
|
||||
if (StackSlotToOrigLI.find(StackSlot) == StackSlotToOrigLI.end()) {
|
||||
auto LI = llvm::make_unique<LiveInterval>(OrigLI.reg, OrigLI.weight);
|
||||
auto LI = std::make_unique<LiveInterval>(OrigLI.reg, OrigLI.weight);
|
||||
LI->assign(OrigLI, Allocator);
|
||||
StackSlotToOrigLI[StackSlot] = std::move(LI);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user