ABISysV_x86_64.h revision 263367
1//===-- ABISysV_x86_64.h ----------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_ABISysV_x86_64_h_
11#define liblldb_ABISysV_x86_64_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-private.h"
18#include "lldb/Target/ABI.h"
19
20class ABISysV_x86_64 :
21    public lldb_private::ABI
22{
23public:
24
25    ~ABISysV_x86_64()
26    {
27    }
28
29    virtual size_t
30    GetRedZoneSize () const;
31
32    virtual bool
33    PrepareTrivialCall (lldb_private::Thread &thread,
34                        lldb::addr_t sp,
35                        lldb::addr_t functionAddress,
36                        lldb::addr_t returnAddress,
37                        llvm::ArrayRef<lldb::addr_t> args) const;
38
39    virtual bool
40    GetArgumentValues (lldb_private::Thread &thread,
41                       lldb_private::ValueList &values) const;
42
43    virtual lldb_private::Error
44    SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value);
45
46protected:
47    lldb::ValueObjectSP
48    GetReturnValueObjectSimple (lldb_private::Thread &thread,
49                                lldb_private::ClangASTType &ast_type) const;
50
51public:
52    virtual lldb::ValueObjectSP
53    GetReturnValueObjectImpl (lldb_private::Thread &thread,
54                          lldb_private::ClangASTType &type) const;
55
56    virtual bool
57    CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan);
58
59    virtual bool
60    CreateDefaultUnwindPlan (lldb_private::UnwindPlan &unwind_plan);
61
62    virtual bool
63    RegisterIsVolatile (const lldb_private::RegisterInfo *reg_info);
64
65    virtual bool
66    StackUsesFrames ()
67    {
68        return true;
69    }
70
71    virtual bool
72    CallFrameAddressIsValid (lldb::addr_t cfa)
73    {
74        // Make sure the stack call frame addresses are 16 byte aligned
75        if (cfa & (16ull - 1ull))
76            return false;   // Not 16 byte aligned
77        if (cfa == 0)
78            return false;   // Zero is not a valid stack address
79        return true;
80    }
81
82    virtual bool
83    CodeAddressIsValid (lldb::addr_t pc)
84    {
85        // We have a 64 bit address space, so anything is valid as opcodes
86        // aren't fixed width...
87        return true;
88    }
89
90    virtual bool
91    FunctionCallsChangeCFA ()
92    {
93        return true;
94    }
95
96    virtual const lldb_private::RegisterInfo *
97    GetRegisterInfoArray (uint32_t &count);
98    //------------------------------------------------------------------
99    // Static Functions
100    //------------------------------------------------------------------
101    static void
102    Initialize();
103
104    static void
105    Terminate();
106
107    static lldb::ABISP
108    CreateInstance (const lldb_private::ArchSpec &arch);
109
110    static lldb_private::ConstString
111    GetPluginNameStatic();
112
113    //------------------------------------------------------------------
114    // PluginInterface protocol
115    //------------------------------------------------------------------
116    virtual lldb_private::ConstString
117    GetPluginName();
118
119    virtual uint32_t
120    GetPluginVersion();
121
122protected:
123    void
124    CreateRegisterMapIfNeeded ();
125
126    bool
127    RegisterIsCalleeSaved (const lldb_private::RegisterInfo *reg_info);
128
129private:
130    ABISysV_x86_64() : lldb_private::ABI() { } // Call CreateInstance instead.
131};
132
133#endif  // liblldb_ABI_h_
134