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 */
51 GetRedZoneSize () const = 0;
54 PrepareTrivialCall ( lldb_private::Thread &thread,
56 lldb::addr_t functionAddress,
57 lldb::addr_t returnAddress,
58 llvm::ArrayRef<lldb::addr_t> args) const = 0;
60 // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
62 // . Because i don't want to change other ABI's this is not declared pure virtual.
63 // The dummy implementation will simply fail. Only HexagonABI will currently
65 // . Two PrepareTrivialCall's is not good design so perhaps this should be combined.
68 PrepareTrivialCall ( lldb_private::Thread &thread,
70 lldb::addr_t functionAddress,
71 lldb::addr_t returnAddress,
72 llvm::Type &prototype,
73 llvm::ArrayRef<CallArgument> args) const;
76 GetArgumentValues (Thread &thread,
77 ValueList &values) const = 0;
80 GetReturnValueObject (Thread &thread,
82 bool persistent = true) const;
84 // specialized to work with llvm IR types
86 GetReturnValueObject (Thread &thread,
88 bool persistent = true) const;
90 // Set the Return value object in the current frame as though a function with
92 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
95 // This is the method the ABI will call to actually calculate the return value.
96 // Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
97 virtual lldb::ValueObjectSP
98 GetReturnValueObjectImpl (Thread &thread, ClangASTType &ast_type) const = 0;
100 // specialized to work with llvm IR types
101 virtual lldb::ValueObjectSP
102 GetReturnValueObjectImpl( Thread &thread, llvm::Type &ir_type ) const;
106 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
109 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0;
112 RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
114 // Should take a look at a call frame address (CFA) which is just the stack
115 // pointer value upon entry to a function. ABIs usually impose alignment
116 // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
117 // This function should return true if "cfa" is valid call frame address for
118 // the ABI, and false otherwise. This is used by the generic stack frame unwinding
119 // code to help determine when a stack ends.
121 CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
123 // Validates a possible PC value and returns true if an opcode can be at "pc".
125 CodeAddressIsValid (lldb::addr_t pc) = 0;
128 FixCodeAddress (lldb::addr_t pc)
130 // Some targets might use bits in a code address to indicate
131 // a mode switch. ARM uses bit zero to signify a code address is
132 // thumb, so any ARM ABI plug-ins would strip those bits.
136 virtual const RegisterInfo *
137 GetRegisterInfoArray (uint32_t &count) = 0;
140 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
143 GetRegisterInfoByKind (lldb::RegisterKind reg_kind,
148 FindPlugin (const ArchSpec &arch);
151 //------------------------------------------------------------------
152 // Classes that inherit from ABI can see and modify these
153 //------------------------------------------------------------------
156 DISALLOW_COPY_AND_ASSIGN (ABI);
159 } // namespace lldb_private
161 #endif // liblldb_ABI_h_