1//===-- ABISysV_arc.h -------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_ABISysV_arc_h_
10#define liblldb_ABISysV_arc_h_
11
12// Other libraries and framework includes
13#include <optional>
14
15// Project includes
16#include "lldb/Target/ABI.h"
17#include "lldb/lldb-private.h"
18
19class ABISysV_arc : public lldb_private::RegInfoBasedABI {
20public:
21 ~ABISysV_arc() override = default;
22
23 size_t GetRedZoneSize() const override;
24
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;
29
30 // Special thread plan for GDB style non-jit function calls.
31 bool
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;
36
37 bool GetArgumentValues(lldb_private::Thread &thread,
38 lldb_private::ValueList &values) const override;
39
40 lldb_private::Status
41 SetReturnValueObject(lldb::StackFrameSP &frame_sp,
42 lldb::ValueObjectSP &new_value) override;
43
44 lldb::ValueObjectSP
45 GetReturnValueObjectImpl(lldb_private::Thread &thread,
46 lldb_private::CompilerType &type) const override;
47
48 // Specialized to work with llvm IR types.
49 lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
50 llvm::Type &type) const override;
51
52 bool
53 CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
54
55 bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
56
57 bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
58
59 bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
60 // Stack call frame address must be 4 byte aligned.
61 return (cfa & 0x3ull) == 0;
62 }
63
64 bool CodeAddressIsValid(lldb::addr_t pc) override {
65 // Code addresse must be 2 byte aligned.
66 return (pc & 1ull) == 0;
67 }
68
69 const lldb_private::RegisterInfo *
70 GetRegisterInfoArray(uint32_t &count) override;
71
72 //------------------------------------------------------------------
73 // Static Functions
74 //------------------------------------------------------------------
75
76 static void Initialize();
77
78 static void Terminate();
79
80 static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp,
81 const lldb_private::ArchSpec &arch);
82
83 static llvm::StringRef GetPluginNameStatic() { return "sysv-arc"; }
84
85 //------------------------------------------------------------------
86 // PluginInterface protocol
87 //------------------------------------------------------------------
88
89 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
90
91private:
92 lldb::ValueObjectSP
93 GetReturnValueObjectSimple(lldb_private::Thread &thread,
94 lldb_private::CompilerType &ast_type) const;
95
96 bool IsRegisterFileReduced(lldb_private::RegisterContext &reg_ctx) const;
97
98 using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
99
100 using RegisterFileFlag = std::optional<bool>;
101 mutable RegisterFileFlag m_is_reg_file_reduced;
102};
103
104#endif // liblldb_ABISysV_arc_h_
105

source code of lldb/source/Plugins/ABI/ARC/ABISysV_arc.h