1 //===-- ABI.h ---------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ABI_h_
11 #define liblldb_ABI_h_
15 // Other libraries and framework includes
17 #include "lldb/Core/Error.h"
18 #include "lldb/Core/PluginInterface.h"
19 #include "lldb/lldb-private.h"
21 #include "llvm/ADT/ArrayRef.h"
23 // forward define the llvm::Type class
24 namespace llvm { class Type; }
26 namespace lldb_private {
29 public PluginInterface
37 HostPointer = 0, /* pointer to host data */
38 TargetValue , /* value is on the target or literal */
40 eType type; /* value of eType */
41 size_t size; /* size in bytes of this argument */
43 lldb::addr_t value; /* literal value */
44 std::unique_ptr<uint8_t[]> data_ap; /* host data pointer */
50 GetRedZoneSize () const = 0;
53 PrepareTrivialCall ( lldb_private::Thread &thread,
55 lldb::addr_t functionAddress,
56 lldb::addr_t returnAddress,
57 llvm::ArrayRef<lldb::addr_t> args) const = 0;
59 // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
61 // . Because i don't want to change other ABI's this is not declared pure virtual.
62 // The dummy implementation will simply fail. Only HexagonABI will currently
64 // . Two PrepareTrivialCall's is not good design so perhaps this should be combined.
67 PrepareTrivialCall ( lldb_private::Thread &thread,
69 lldb::addr_t functionAddress,
70 lldb::addr_t returnAddress,
71 llvm::Type &prototype,
72 llvm::ArrayRef<CallArgument> args) const;
75 GetArgumentValues (Thread &thread,
76 ValueList &values) const = 0;
79 GetReturnValueObject (Thread &thread,
81 bool persistent = true) const;
83 // specialized to work with llvm IR types
85 GetReturnValueObject (Thread &thread,
87 bool persistent = true) const;
89 // Set the Return value object in the current frame as though a function with
91 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
94 // This is the method the ABI will call to actually calculate the return value.
95 // Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
96 virtual lldb::ValueObjectSP
97 GetReturnValueObjectImpl (Thread &thread, CompilerType &ast_type) const = 0;
99 // specialized to work with llvm IR types
100 virtual lldb::ValueObjectSP
101 GetReturnValueObjectImpl( Thread &thread, llvm::Type &ir_type ) const;
105 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
108 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0;
111 RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
113 // Should take a look at a call frame address (CFA) which is just the stack
114 // pointer value upon entry to a function. ABIs usually impose alignment
115 // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
116 // This function should return true if "cfa" is valid call frame address for
117 // the ABI, and false otherwise. This is used by the generic stack frame unwinding
118 // code to help determine when a stack ends.
120 CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
122 // Validates a possible PC value and returns true if an opcode can be at "pc".
124 CodeAddressIsValid (lldb::addr_t pc) = 0;
127 FixCodeAddress (lldb::addr_t pc)
129 // Some targets might use bits in a code address to indicate
130 // a mode switch. ARM uses bit zero to signify a code address is
131 // thumb, so any ARM ABI plug-ins would strip those bits.
135 virtual const RegisterInfo *
136 GetRegisterInfoArray (uint32_t &count) = 0;
139 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
142 GetRegisterInfoByKind (lldb::RegisterKind reg_kind,
147 FindPlugin (const ArchSpec &arch);
151 //------------------------------------------------------------------
152 // Classes that inherit from ABI can see and modify these
153 //------------------------------------------------------------------
158 DISALLOW_COPY_AND_ASSIGN (ABI);
161 } // namespace lldb_private
163 #endif // liblldb_ABI_h_