diff options
Diffstat (limited to 'compiler/compiler_backend.cc')
-rw-r--r-- | compiler/compiler_backend.cc | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/compiler/compiler_backend.cc b/compiler/compiler_backend.cc index eaa39f83c1..0afa665eb7 100644 --- a/compiler/compiler_backend.cc +++ b/compiler/compiler_backend.cc @@ -83,6 +83,9 @@ static CompiledMethod* TryCompileWithSeaIR(art::CompilerDriver& compiler, } +// Hack for CFI CIE initialization +extern std::vector<uint8_t>* X86CFIInitialization(); + class QuickBackend : public CompilerBackend { public: QuickBackend() : CompilerBackend(100) {} @@ -135,10 +138,11 @@ class QuickBackend : public CompilerBackend { } bool WriteElf(art::File* file, - OatWriter& oat_writer, + OatWriter* oat_writer, const std::vector<const art::DexFile*>& dex_files, const std::string& android_root, bool is_host, const CompilerDriver& driver) const + OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return art::ElfWriterQuick::Create(file, oat_writer, dex_files, android_root, is_host, driver); } @@ -165,11 +169,27 @@ class QuickBackend : public CompilerBackend { bool set_max = cu->mir_graph->SetMaxAvailableNonSpecialCompilerTemps(max_temps); CHECK(set_max); } - return mir_to_lir;; + return mir_to_lir; } void InitCompilationUnit(CompilationUnit& cu) const {} + /* + * @brief Generate and return Dwarf CFI initialization, if supported by the + * backend. + * @param driver CompilerDriver for this compile. + * @returns nullptr if not supported by backend or a vector of bytes for CFI DWARF + * information. + * @note This is used for backtrace information in generated code. + */ + std::vector<uint8_t>* GetCallFrameInformationInitialization(const CompilerDriver& driver) const + OVERRIDE { + if (driver.GetInstructionSet() == kX86) { + return X86CFIInitialization(); + } + return nullptr; + } + private: DISALLOW_COPY_AND_ASSIGN(QuickBackend); }; @@ -249,11 +269,12 @@ class LLVMBackend : public CompilerBackend { } bool WriteElf(art::File* file, - OatWriter& oat_writer, + OatWriter* oat_writer, const std::vector<const art::DexFile*>& dex_files, const std::string& android_root, bool is_host, const CompilerDriver& driver) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + OVERRIDE + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return art::ElfWriterMclinker::Create( file, oat_writer, dex_files, android_root, is_host, driver); } @@ -271,15 +292,17 @@ class LLVMBackend : public CompilerBackend { (1 << kSuppressExceptionEdges); } - bool isPortable() const { return true; } + bool IsPortable() const OVERRIDE { + return true; + } - void SetBitcodeFileName(std::string const& filename) { - typedef void (*SetBitcodeFileNameFn)(CompilerDriver&, std::string const&); + void SetBitcodeFileName(const CompilerDriver& driver, const std::string& filename) { + typedef void (*SetBitcodeFileNameFn)(const CompilerDriver&, const std::string&); SetBitcodeFileNameFn set_bitcode_file_name = reinterpret_cast<SetBitcodeFileNameFn>(compilerLLVMSetBitcodeFileName); - set_bitcode_file_name(*this, filename); + set_bitcode_file_name(driver, filename); } private: |