llvm.org GIT mirror llvm / 30b44ff
[BuildingAJIT] Clang-format chapters 1 and 2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346727 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 8 months ago
4 changed file(s) with 9 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
9898
9999 .. code-block:: c++
100100
101 ThreadSafeModule optimizeModule(ThreadSafeModule M,
102 const MaterializationResponsibility &R) {
101 static Expected
102 optimizeModule(ThreadSafeModule M, const MaterializationResponsibility &R) {
103103 // Create a function pass manager.
104104 auto FPM = llvm::make_unique(M.get());
105105
678678 static std::unique_ptr ParseTopLevelExpr(unsigned ExprCount) {
679679 if (auto E = ParseExpression()) {
680680 // Make an anonymous proto.
681 auto Proto = llvm::make_unique(("__anon_expr" +
682 Twine(ExprCount)).str(),
683 std::vector());
681 auto Proto = llvm::make_unique
682 ("__anon_expr" + Twine(ExprCount)).str(), std::vector());
684683 return llvm::make_unique(std::move(Proto), std::move(E));
685684 }
686685 return nullptr;
11561155
11571156 // Get the anonymous expression's JITSymbol.
11581157 auto Sym =
1159 ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
1158 ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
11601159
11611160 auto *FP = (double (*)())(intptr_t)Sym.getAddress();
11621161 assert(FP && "Failed to codegen function");
4646 ThreadSafeContext Ctx;
4747
4848 public:
49
5049 KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
5150 : ObjectLayer(ES,
5251 []() { return llvm::make_unique(); }),
8584 }
8685
8786 private:
88
8987 static Expected
90 optimizeModule(ThreadSafeModule TSM,
91 const MaterializationResponsibility &R) {
88 optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) {
9289 // Create a function pass manager.
9390 auto FPM = llvm::make_unique(TSM.getModule());
9491
678678 static std::unique_ptr ParseTopLevelExpr(unsigned ExprCount) {
679679 if (auto E = ParseExpression()) {
680680 // Make an anonymous proto.
681 auto Proto = llvm::make_unique(("__anon_expr" +
682 Twine(ExprCount)).str(),
683 std::vector());
681 auto Proto = llvm::make_unique
682 ("__anon_expr" + Twine(ExprCount)).str(), std::vector());
684683 return llvm::make_unique(std::move(Proto), std::move(E));
685684 }
686685 return nullptr;
11561155
11571156 // Get the anonymous expression's JITSymbol.
11581157 auto Sym =
1159 ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
1158 ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
11601159
11611160 auto *FP = (double (*)())(intptr_t)Sym.getAddress();
11621161 assert(FP && "Failed to codegen function");