1 //===-- ArchitectureArc.h ---------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_ABISysV_arc_h_
10 #define liblldb_ABISysV_arc_h_
12 // Other libraries and framework includes
13 #include <llvm/ADT/Optional.h>
16 #include "lldb/Target/ABI.h"
17 #include "lldb/lldb-private.h"
19 class ABISysV_arc : public lldb_private::ABI {
21 ~ABISysV_arc() override = default;
23 size_t GetRedZoneSize() const override;
25 bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
26 lldb::addr_t functionAddress,
27 lldb::addr_t returnAddress,
28 llvm::ArrayRef<lldb::addr_t> args) const override;
30 // Special thread plan for GDB style non-jit function calls.
32 PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
33 lldb::addr_t functionAddress, lldb::addr_t returnAddress,
34 llvm::Type &prototype,
35 llvm::ArrayRef<ABI::CallArgument> args) const override;
37 bool GetArgumentValues(lldb_private::Thread &thread,
38 lldb_private::ValueList &values) const override;
41 SetReturnValueObject(lldb::StackFrameSP &frame_sp,
42 lldb::ValueObjectSP &new_value) override;
45 GetReturnValueObjectImpl(lldb_private::Thread &thread,
46 lldb_private::CompilerType &type) const override;
48 // Specialized to work with llvm IR types.
49 lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
50 llvm::Type &type) const override;
53 CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
55 bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
57 bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
59 bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
60 // Stack call frame address must be 4 byte aligned.
61 return (cfa & 0x3ull) == 0;
64 bool CodeAddressIsValid(lldb::addr_t pc) override {
65 // Code addresse must be 2 byte aligned.
66 return (pc & 1ull) == 0;
69 const lldb_private::RegisterInfo *
70 GetRegisterInfoArray(uint32_t &count) override;
72 //------------------------------------------------------------------
74 //------------------------------------------------------------------
76 static void Initialize();
78 static void Terminate();
80 static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp,
81 const lldb_private::ArchSpec &arch);
83 static lldb_private::ConstString GetPluginNameStatic();
85 //------------------------------------------------------------------
86 // PluginInterface protocol
87 //------------------------------------------------------------------
89 lldb_private::ConstString GetPluginName() override;
91 uint32_t GetPluginVersion() override;
95 GetReturnValueObjectSimple(lldb_private::Thread &thread,
96 lldb_private::CompilerType &ast_type) const;
98 bool IsRegisterFileReduced(lldb_private::RegisterContext ®_ctx) const;
100 using lldb_private::ABI::ABI; // Call CreateInstance instead.
102 using RegisterFileFlag = llvm::Optional<bool>;
103 mutable RegisterFileFlag m_is_reg_file_reduced;
106 #endif // liblldb_ABISysV_arc_h_