blob: 942a1f339fe48a7d333257306fd318d12356ef63 [file] [log] [blame]
Zonr Chang0fffa7e2012-04-12 19:43:53 +08001/*
2 * Copyright 2012, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Stephen Hinese198abe2012-07-27 18:05:41 -070017#include "bcc/Renderscript/RSCompilerDriver.h"
Zonr Chang0fffa7e2012-04-12 19:43:53 +080018
Yang Nia4ded132014-11-17 17:44:08 -080019#include "llvm/IR/AssemblyAnnotationWriter.h"
Tobias Grosser7b980e12013-06-20 10:12:13 -070020#include <llvm/IR/Module.h>
Yang Ni0ab50b82015-02-16 12:31:56 -080021#include "llvm/Linker/Linker.h"
Stephen Hinesad694762013-04-29 18:59:47 -070022#include <llvm/Support/CommandLine.h>
Stephen Hinesb10c3a72013-08-07 23:15:22 -070023#include <llvm/Support/Path.h>
Tobias Grosser7b980e12013-06-20 10:12:13 -070024#include <llvm/Support/raw_ostream.h>
Shih-wei Liao7bcec852012-04-25 04:07:09 -070025
26#include "bcinfo/BitcodeWrapper.h"
Yang Ni0ab50b82015-02-16 12:31:56 -080027#include "bcc/Assert.h"
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -080028#include "bcinfo/MetadataExtractor.h"
Yang Nia4ded132014-11-17 17:44:08 -080029#include "bcc/BCCContext.h"
Stephen Hines47f0d5a2013-06-05 00:27:38 -070030#include "bcc/Compiler.h"
Stephen Hinesbde1a252014-05-15 18:02:33 -070031#include "bcc/Config/Config.h"
Stephen Hinese198abe2012-07-27 18:05:41 -070032#include "bcc/Renderscript/RSScript.h"
Yang Nia4ded132014-11-17 17:44:08 -080033#include "bcc/Renderscript/RSScriptGroupFusion.h"
Zonr Changc72c4dd2012-04-12 15:38:53 +080034#include "bcc/Support/CompilerConfig.h"
Shih-wei Liao7bcec852012-04-25 04:07:09 -070035#include "bcc/Source.h"
Zonr Changc72c4dd2012-04-12 15:38:53 +080036#include "bcc/Support/FileMutex.h"
Zonr Changef73a242012-04-12 16:44:01 +080037#include "bcc/Support/Log.h"
Zonr Changc72c4dd2012-04-12 15:38:53 +080038#include "bcc/Support/InputFile.h"
39#include "bcc/Support/Initialization.h"
40#include "bcc/Support/OutputFile.h"
Zonr Chang0fffa7e2012-04-12 19:43:53 +080041
Yang Ni0ab50b82015-02-16 12:31:56 -080042#include <sstream>
Yang Nia4ded132014-11-17 17:44:08 -080043#include <string>
44
Nick Kralevichb81d6972013-05-21 16:52:35 -070045#ifdef HAVE_ANDROID_OS
Zonr Chang0fffa7e2012-04-12 19:43:53 +080046#include <cutils/properties.h>
Nick Kralevichb81d6972013-05-21 16:52:35 -070047#endif
Shih-wei Liao7bcec852012-04-25 04:07:09 -070048#include <utils/StopWatch.h>
Zonr Chang0fffa7e2012-04-12 19:43:53 +080049
50using namespace bcc;
51
Stephen Hines3ab9da12013-02-01 18:39:15 -080052RSCompilerDriver::RSCompilerDriver(bool pUseCompilerRT) :
Chris Wailes900c6c12014-08-13 15:40:00 -070053 mConfig(nullptr), mCompiler(), mDebugContext(false),
Stephen Hines750ee652015-04-16 16:24:18 -070054 mLinkRuntimeCallback(nullptr), mEnableGlobalMerge(true),
55 mEmbedGlobalInfo(false), mEmbedGlobalInfoSkipConstant(false) {
Zonr Chang0fffa7e2012-04-12 19:43:53 +080056 init::Initialize();
Zonr Chang0fffa7e2012-04-12 19:43:53 +080057}
58
59RSCompilerDriver::~RSCompilerDriver() {
60 delete mConfig;
61}
62
Zonr Chang0fffa7e2012-04-12 19:43:53 +080063
Stephen Hinesbde1a252014-05-15 18:02:33 -070064#if defined(PROVIDE_ARM_CODEGEN)
Stephen Hinesad694762013-04-29 18:59:47 -070065extern llvm::cl::opt<bool> EnableGlobalMerge;
Stephen Hinesc06cd062013-07-12 10:51:29 -070066#endif
67
Zonr Chang0fffa7e2012-04-12 19:43:53 +080068bool RSCompilerDriver::setupConfig(const RSScript &pScript) {
69 bool changed = false;
70
71 const llvm::CodeGenOpt::Level script_opt_level =
72 static_cast<llvm::CodeGenOpt::Level>(pScript.getOptimizationLevel());
73
Stephen Hinesbde1a252014-05-15 18:02:33 -070074#if defined(PROVIDE_ARM_CODEGEN)
Stephen Hines045558b2014-02-18 14:07:15 -080075 EnableGlobalMerge = mEnableGlobalMerge;
76#endif
77
Chris Wailes900c6c12014-08-13 15:40:00 -070078 if (mConfig != nullptr) {
Zonr Chang0fffa7e2012-04-12 19:43:53 +080079 // Renderscript bitcode may have their optimization flag configuration
80 // different than the previous run of RS compilation.
81 if (mConfig->getOptimizationLevel() != script_opt_level) {
82 mConfig->setOptimizationLevel(script_opt_level);
83 changed = true;
84 }
85 } else {
86 // Haven't run the compiler ever.
Stephen Hinesbde1a252014-05-15 18:02:33 -070087 mConfig = new (std::nothrow) CompilerConfig(DEFAULT_TARGET_TRIPLE_STRING);
Chris Wailes900c6c12014-08-13 15:40:00 -070088 if (mConfig == nullptr) {
Zonr Chang0fffa7e2012-04-12 19:43:53 +080089 // Return false since mConfig remains NULL and out-of-memory.
90 return false;
91 }
92 mConfig->setOptimizationLevel(script_opt_level);
93 changed = true;
94 }
95
Stephen Hinesbde1a252014-05-15 18:02:33 -070096#if defined(PROVIDE_ARM_CODEGEN)
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -080097 bcinfo::MetadataExtractor me(&pScript.getSource().getModule());
98 if (!me.extract()) {
David Grossc2ca7422015-05-29 14:54:33 -070099 bccAssert("Could not extract RS pragma metadata for module!");
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -0800100 }
101
102 bool script_full_prec = (me.getRSFloatPrecision() == bcinfo::RS_FP_Full);
Stephen Hinesbde1a252014-05-15 18:02:33 -0700103 if (mConfig->getFullPrecision() != script_full_prec) {
104 mConfig->setFullPrecision(script_full_prec);
105 changed = true;
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800106 }
107#endif
108
109 return changed;
110}
111
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700112Compiler::ErrorCode RSCompilerDriver::compileScript(RSScript& pScript, const char* pScriptName,
113 const char* pOutputPath,
114 const char* pRuntimePath,
Pirama Arumuga Nainar51ee77b2015-02-19 16:33:27 -0800115 const char* pBuildChecksum,
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -0800116 bool pDumpIR) {
Pirama Arumuga Nainar51ee77b2015-02-19 16:33:27 -0800117 // embed build checksum metadata into the source
118 if (pBuildChecksum != nullptr && strlen(pBuildChecksum) > 0) {
119 pScript.getSource().addBuildChecksumMetadata(pBuildChecksum);
120 }
121
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800122 //===--------------------------------------------------------------------===//
Stephen Hinese198abe2012-07-27 18:05:41 -0700123 // Link RS script with Renderscript runtime.
Shih-wei Liaoba420642012-06-30 11:27:37 -0700124 //===--------------------------------------------------------------------===//
Stephen Hines331310e2012-10-26 19:27:55 -0700125 if (!RSScript::LinkRuntime(pScript, pRuntimePath)) {
Yang Ni6da4e252015-03-11 10:00:42 -0700126 ALOGE("Failed to link script '%s' with Renderscript runtime %s!",
127 pScriptName, pRuntimePath);
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700128 return Compiler::kErrInvalidSource;
Shih-wei Liaoba420642012-06-30 11:27:37 -0700129 }
130
Stephen Hines01f05d42013-05-31 20:51:27 -0700131 {
Stephen Hines07843652013-08-15 15:41:47 -0700132 // FIXME(srhines): Windows compilation can't use locking like this, but
133 // we also don't need to worry about concurrent writers of the same file.
Stephen Hinesd7a95262013-08-08 16:03:19 -0700134#ifndef USE_MINGW
Stephen Hines07843652013-08-15 15:41:47 -0700135 //===------------------------------------------------------------------===//
Stephen Hines01f05d42013-05-31 20:51:27 -0700136 // Acquire the write lock for writing output object file.
Stephen Hines07843652013-08-15 15:41:47 -0700137 //===------------------------------------------------------------------===//
Stephen Hines01f05d42013-05-31 20:51:27 -0700138 FileMutex<FileBase::kWriteLock> write_output_mutex(pOutputPath);
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800139
Stephen Hines01f05d42013-05-31 20:51:27 -0700140 if (write_output_mutex.hasError() || !write_output_mutex.lock()) {
141 ALOGE("Unable to acquire the lock for writing %s! (%s)",
142 pOutputPath, write_output_mutex.getErrorMessage().c_str());
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700143 return Compiler::kErrInvalidSource;
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800144 }
Stephen Hinesd7a95262013-08-08 16:03:19 -0700145#endif
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800146
Stephen Hines01f05d42013-05-31 20:51:27 -0700147 // Open the output file for write.
Stephen Hinesacf9c9e2013-09-26 16:32:31 -0700148 OutputFile output_file(pOutputPath,
149 FileBase::kTruncate | FileBase::kBinary);
Stephen Hines01f05d42013-05-31 20:51:27 -0700150
151 if (output_file.hasError()) {
152 ALOGE("Unable to open %s for write! (%s)", pOutputPath,
153 output_file.getErrorMessage().c_str());
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700154 return Compiler::kErrInvalidSource;
Stephen Hines01f05d42013-05-31 20:51:27 -0700155 }
156
157 // Setup the config to the compiler.
158 bool compiler_need_reconfigure = setupConfig(pScript);
159
Chris Wailes900c6c12014-08-13 15:40:00 -0700160 if (mConfig == nullptr) {
Stephen Hines01f05d42013-05-31 20:51:27 -0700161 ALOGE("Failed to setup config for RS compiler to compile %s!",
162 pOutputPath);
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700163 return Compiler::kErrInvalidSource;
Stephen Hines01f05d42013-05-31 20:51:27 -0700164 }
165
166 if (compiler_need_reconfigure) {
167 Compiler::ErrorCode err = mCompiler.config(*mConfig);
168 if (err != Compiler::kSuccess) {
169 ALOGE("Failed to config the RS compiler for %s! (%s)",pOutputPath,
170 Compiler::GetErrorString(err));
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700171 return Compiler::kErrInvalidSource;
Stephen Hines01f05d42013-05-31 20:51:27 -0700172 }
173 }
174
Chris Wailes900c6c12014-08-13 15:40:00 -0700175 OutputFile *ir_file = nullptr;
176 llvm::raw_fd_ostream *IRStream = nullptr;
Tobias Grosser27fb7ed2013-06-21 18:34:56 -0700177 if (pDumpIR) {
Chris Wailes35978e72014-08-11 14:01:47 -0700178 std::string path(pOutputPath);
Tobias Grosser27fb7ed2013-06-21 18:34:56 -0700179 path.append(".ll");
Chris Wailes35978e72014-08-11 14:01:47 -0700180 ir_file = new OutputFile(path.c_str(), FileBase::kTruncate);
Tobias Grosser27fb7ed2013-06-21 18:34:56 -0700181 IRStream = ir_file->dup();
182 }
183
Stephen Hines01f05d42013-05-31 20:51:27 -0700184 // Run the compiler.
Chris Wailes35978e72014-08-11 14:01:47 -0700185 Compiler::ErrorCode compile_result =
186 mCompiler.compile(pScript, output_file, IRStream);
Tobias Grosser27fb7ed2013-06-21 18:34:56 -0700187
188 if (ir_file) {
189 ir_file->close();
190 delete ir_file;
191 }
Stephen Hines01f05d42013-05-31 20:51:27 -0700192
193 if (compile_result != Compiler::kSuccess) {
194 ALOGE("Unable to compile the source to file %s! (%s)", pOutputPath,
195 Compiler::GetErrorString(compile_result));
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700196 return Compiler::kErrInvalidSource;
Stephen Hines01f05d42013-05-31 20:51:27 -0700197 }
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800198 }
199
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700200 return Compiler::kSuccess;
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800201}
202
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700203bool RSCompilerDriver::build(BCCContext &pContext,
204 const char *pCacheDir,
205 const char *pResName,
206 const char *pBitcode,
207 size_t pBitcodeSize,
Pirama Arumuga Nainar51ee77b2015-02-19 16:33:27 -0800208 const char *pBuildChecksum,
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700209 const char *pRuntimePath,
Tobias Grosser7b980e12013-06-20 10:12:13 -0700210 RSLinkRuntimeCallback pLinkRuntimeCallback,
211 bool pDumpIR) {
Tim Murrayc89f78b2013-05-09 11:57:12 -0700212 // android::StopWatch build_time("bcc: RSCompilerDriver::build time");
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700213 //===--------------------------------------------------------------------===//
214 // Check parameters.
215 //===--------------------------------------------------------------------===//
Chris Wailes900c6c12014-08-13 15:40:00 -0700216 if ((pCacheDir == nullptr) || (pResName == nullptr)) {
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700217 ALOGE("Invalid parameter passed to RSCompilerDriver::build()! (cache dir: "
218 "%s, resource name: %s)", ((pCacheDir) ? pCacheDir : "(null)"),
219 ((pResName) ? pResName : "(null)"));
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700220 return false;
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700221 }
222
Chris Wailes900c6c12014-08-13 15:40:00 -0700223 if ((pBitcode == nullptr) || (pBitcodeSize <= 0)) {
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700224 ALOGE("No bitcode supplied! (bitcode: %p, size of bitcode: %u)",
225 pBitcode, static_cast<unsigned>(pBitcodeSize));
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700226 return false;
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700227 }
228
229 //===--------------------------------------------------------------------===//
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700230 // Construct output path.
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700231 // {pCacheDir}/{pResName}.o
Stephen Hinesb10c3a72013-08-07 23:15:22 -0700232 //===--------------------------------------------------------------------===//
233 llvm::SmallString<80> output_path(pCacheDir);
234 llvm::sys::path::append(output_path, pResName);
235 llvm::sys::path::replace_extension(output_path, ".o");
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700236
237 //===--------------------------------------------------------------------===//
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700238 // Load the bitcode and create script.
239 //===--------------------------------------------------------------------===//
240 Source *source = Source::CreateFromBuffer(pContext, pResName,
241 pBitcode, pBitcodeSize);
Chris Wailes900c6c12014-08-13 15:40:00 -0700242 if (source == nullptr) {
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700243 return false;
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700244 }
245
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700246 RSScript script(*source);
Stephen Hinesc3437f02014-01-30 17:57:21 -0800247 if (pLinkRuntimeCallback) {
248 setLinkRuntimeCallback(pLinkRuntimeCallback);
249 }
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700250
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700251 script.setLinkRuntimeCallback(getLinkRuntimeCallback());
Stephen Hines06731a62013-02-12 19:29:42 -0800252
Stephen Hines750ee652015-04-16 16:24:18 -0700253 script.setEmbedGlobalInfo(mEmbedGlobalInfo);
254 script.setEmbedGlobalInfoSkipConstant(mEmbedGlobalInfoSkipConstant);
255
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700256 // Read information from bitcode wrapper.
257 bcinfo::BitcodeWrapper wrapper(pBitcode, pBitcodeSize);
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700258 script.setCompilerVersion(wrapper.getCompilerVersion());
259 script.setOptimizationLevel(static_cast<RSScript::OptimizationLevel>(
260 wrapper.getOptimizationLevel()));
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700261
262 //===--------------------------------------------------------------------===//
263 // Compile the script
264 //===--------------------------------------------------------------------===//
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700265 Compiler::ErrorCode status = compileScript(script, pResName,
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700266 output_path.c_str(),
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -0800267 pRuntimePath,
268 pBuildChecksum,
269 pDumpIR);
Shih-wei Liao7bcec852012-04-25 04:07:09 -0700270
Jean-Luc Brouilletf2ac3172014-06-25 18:21:36 -0700271 return status == Compiler::kSuccess;
Zonr Chang0fffa7e2012-04-12 19:43:53 +0800272}
Stephen Hines331310e2012-10-26 19:27:55 -0700273
Yang Nia4ded132014-11-17 17:44:08 -0800274bool RSCompilerDriver::buildScriptGroup(
Yang Ni0ab50b82015-02-16 12:31:56 -0800275 BCCContext& Context, const char* pOutputFilepath, const char* pRuntimePath,
Yang Ni186d2f32015-04-07 14:51:47 -0700276 const char* pRuntimeRelaxedPath, bool dumpIR, const char* buildChecksum,
Yang Ni6da4e252015-03-11 10:00:42 -0700277 const std::vector<Source*>& sources,
Yang Ni0ab50b82015-02-16 12:31:56 -0800278 const std::list<std::list<std::pair<int, int>>>& toFuse,
279 const std::list<std::string>& fused,
280 const std::list<std::list<std::pair<int, int>>>& invokes,
281 const std::list<std::string>& invokeBatchNames) {
282 // ---------------------------------------------------------------------------
283 // Link all input modules into a single module
284 // ---------------------------------------------------------------------------
285
286 llvm::LLVMContext& context = Context.getLLVMContext();
287 llvm::Module module("Merged Script Group", context);
288
289 llvm::Linker linker(&module);
290 for (Source* source : sources) {
291 if (linker.linkInModule(&source->getModule())) {
292 ALOGE("Linking for module in source failed.");
293 return false;
294 }
Yang Nia4ded132014-11-17 17:44:08 -0800295 }
296
Yang Ni0ab50b82015-02-16 12:31:56 -0800297 // ---------------------------------------------------------------------------
298 // Create fused kernels
299 // ---------------------------------------------------------------------------
300
301 auto inputIter = toFuse.begin();
302 for (const std::string& nameOfFused : fused) {
303 auto inputKernels = *inputIter++;
304 std::vector<Source*> sourcesToFuse;
305 std::vector<int> slots;
306
307 for (auto p : inputKernels) {
308 sourcesToFuse.push_back(sources[p.first]);
309 slots.push_back(p.second);
310 }
311
312 if (!fuseKernels(Context, sourcesToFuse, slots, nameOfFused, &module)) {
313 return false;
314 }
315 }
316
317 // ---------------------------------------------------------------------------
318 // Rename invokes
319 // ---------------------------------------------------------------------------
320
321 auto invokeIter = invokes.begin();
322 for (const std::string& newName : invokeBatchNames) {
323 auto inputInvoke = *invokeIter++;
324 auto p = inputInvoke.front();
325 Source* source = sources[p.first];
326 int slot = p.second;
327
328 if (!renameInvoke(Context, source, slot, newName, &module)) {
329 return false;
330 }
331 }
332
333 // ---------------------------------------------------------------------------
334 // Compile the new module with fused kernels
335 // ---------------------------------------------------------------------------
336
Yang Nia4ded132014-11-17 17:44:08 -0800337 const std::unique_ptr<Source> source(
Yang Ni0ab50b82015-02-16 12:31:56 -0800338 Source::CreateFromModule(Context, pOutputFilepath, module, true));
Yang Nia4ded132014-11-17 17:44:08 -0800339 RSScript script(*source);
340
Yang Ni0ab50b82015-02-16 12:31:56 -0800341 // Embed the info string directly in the ELF
342 script.setEmbedInfo(true);
343 script.setOptimizationLevel(RSScript::kOptLvl3);
Stephen Hines750ee652015-04-16 16:24:18 -0700344 script.setEmbedGlobalInfo(mEmbedGlobalInfo);
345 script.setEmbedGlobalInfoSkipConstant(mEmbedGlobalInfoSkipConstant);
Yang Nia4ded132014-11-17 17:44:08 -0800346
347 llvm::SmallString<80> output_path(pOutputFilepath);
348 llvm::sys::path::replace_extension(output_path, ".o");
349
Yang Ni6da4e252015-03-11 10:00:42 -0700350 // Pick the right runtime lib
351 const char* coreLibPath = pRuntimePath;
352 if (strcmp(pRuntimeRelaxedPath, "")) {
353 bcinfo::MetadataExtractor me(&module);
354 me.extract();
355 if (me.getRSFloatPrecision() == bcinfo::RS_FP_Relaxed) {
356 coreLibPath = pRuntimeRelaxedPath;
357 }
358 }
359
360 compileScript(script, pOutputFilepath, output_path.c_str(), coreLibPath,
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -0800361 buildChecksum, dumpIR);
Yang Nia4ded132014-11-17 17:44:08 -0800362
363 return true;
364}
Stephen Hines331310e2012-10-26 19:27:55 -0700365
Jean-Luc Brouilletc5e607a2014-06-18 18:14:02 -0700366bool RSCompilerDriver::buildForCompatLib(RSScript &pScript, const char *pOut,
Pirama Arumuga Nainar51ee77b2015-02-19 16:33:27 -0800367 const char *pBuildChecksum,
Tim Murray77c1d552015-01-22 15:15:17 -0800368 const char *pRuntimePath,
369 bool pDumpIR) {
Stephen Hines86a0b792012-11-06 20:04:47 -0800370 // Embed the info string directly in the ELF, since this path is for an
371 // offline (host) compilation.
372 pScript.setEmbedInfo(true);
373
Stephen Hines750ee652015-04-16 16:24:18 -0700374 pScript.setEmbedGlobalInfo(mEmbedGlobalInfo);
375 pScript.setEmbedGlobalInfoSkipConstant(mEmbedGlobalInfoSkipConstant);
376
Yang Ni6da4e252015-03-11 10:00:42 -0700377 Compiler::ErrorCode status = compileScript(pScript, pOut, pOut, pRuntimePath,
Pirama Arumuga Nainara65fba62015-02-19 11:01:30 -0800378 pBuildChecksum, pDumpIR);
Stephen Hines47f0d5a2013-06-05 00:27:38 -0700379 if (status != Compiler::kSuccess) {
380 return false;
381 }
382
383 return true;
Stephen Hines331310e2012-10-26 19:27:55 -0700384}