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 uint8_t *data; /* host data pointer */
52 GetRedZoneSize () const = 0;
55 PrepareTrivialCall ( lldb_private::Thread &thread,
57 lldb::addr_t functionAddress,
58 lldb::addr_t returnAddress,
59 llvm::ArrayRef<lldb::addr_t> args) const = 0;
61 // Prepare trivial call used from ThreadPlanFunctionCallGDB
63 // . Because i don't want to change other ABI's this is not declared pure virtual.
64 // The dummy implementation will simply fail. Only HexagonABI will currently
66 // . Two PrepareTrivialCall's is not good design so perhaps this should be combined.
69 PrepareTrivialCall ( lldb_private::Thread &thread,
71 lldb::addr_t functionAddress,
72 lldb::addr_t returnAddress,
73 llvm::Type &prototype,
74 llvm::ArrayRef<CallArgument> args) const;
77 GetArgumentValues (Thread &thread,
78 ValueList &values) const = 0;
81 GetReturnValueObject (Thread &thread,
83 bool persistent = true) const;
85 // specialized to work with llvm IR types
87 GetReturnValueObject (Thread &thread,
89 bool persistent = true) const;
91 // Set the Return value object in the current frame as though a function with
93 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
96 // This is the method the ABI will call to actually calculate the return value.
97 // Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
98 virtual lldb::ValueObjectSP
99 GetReturnValueObjectImpl (Thread &thread, ClangASTType &ast_type) const = 0;
101 // specialized to work with llvm IR types
102 virtual lldb::ValueObjectSP
103 GetReturnValueObjectImpl( Thread &thread, llvm::Type &ir_type ) const;
107 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
110 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0;
113 RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
115 // Should take a look at a call frame address (CFA) which is just the stack
116 // pointer value upon entry to a function. ABIs usually impose alignment
117 // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
118 // This function should return true if "cfa" is valid call frame address for
119 // the ABI, and false otherwise. This is used by the generic stack frame unwinding
120 // code to help determine when a stack ends.
122 CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
124 // Validates a possible PC value and returns true if an opcode can be at "pc".
126 CodeAddressIsValid (lldb::addr_t pc) = 0;
129 FixCodeAddress (lldb::addr_t pc)
131 // Some targets might use bits in a code address to indicate
132 // a mode switch. ARM uses bit zero to signify a code address is
133 // thumb, so any ARM ABI plug-ins would strip those bits.
137 virtual const RegisterInfo *
138 GetRegisterInfoArray (uint32_t &count) = 0;
141 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
144 GetRegisterInfoByKind (lldb::RegisterKind reg_kind,
149 FindPlugin (const ArchSpec &arch);
152 //------------------------------------------------------------------
153 // Classes that inherit from ABI can see and modify these
154 //------------------------------------------------------------------
157 DISALLOW_COPY_AND_ASSIGN (ABI);
160 } // namespace lldb_private
162 #endif // liblldb_ABI_h_