LLVM
8.0.1
include
llvm-c
DisassemblerTypes.h
Go to the documentation of this file.
1
/*===-- llvm-c/DisassemblerTypedefs.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 LLVM_DISASSEMBLER_TYPES_H
11
#define LLVM_DISASSEMBLER_TYPES_H
12
13
#include "
llvm-c/DataTypes.h
"
14
#ifdef __cplusplus
15
#include <cstddef>
16
#else
17
#include <stddef.h>
18
#endif
19
20
/**
21
* An opaque reference to a disassembler context.
22
*/
23
typedef
void
*
LLVMDisasmContextRef
;
24
25
/**
26
* The type for the operand information call back function. This is called to
27
* get the symbolic information for an operand of an instruction. Typically
28
* this is from the relocation information, symbol table, etc. That block of
29
* information is saved when the disassembler context is created and passed to
30
* the call back in the DisInfo parameter. The instruction containing operand
31
* is at the PC parameter. For some instruction sets, there can be more than
32
* one operand with symbolic information. To determine the symbolic operand
33
* information for each operand, the bytes for the specific operand in the
34
* instruction are specified by the Offset parameter and its byte widith is the
35
* size parameter. For instructions sets with fixed widths and one symbolic
36
* operand per instruction, the Offset parameter will be zero and Size parameter
37
* will be the instruction width. The information is returned in TagBuf and is
38
* Triple specific with its specific information defined by the value of
39
* TagType for that Triple. If symbolic information is returned the function
40
* returns 1, otherwise it returns 0.
41
*/
42
typedef
int (*
LLVMOpInfoCallback
)(
void
*DisInfo, uint64_t PC,
43
uint64_t
Offset
, uint64_t
Size
,
44
int
TagType,
void
*TagBuf);
45
46
/**
47
* The initial support in LLVM MC for the most general form of a relocatable
48
* expression is "AddSymbol - SubtractSymbol + Offset". For some Darwin targets
49
* this full form is encoded in the relocation information so that AddSymbol and
50
* SubtractSymbol can be link edited independent of each other. Many other
51
* platforms only allow a relocatable expression of the form AddSymbol + Offset
52
* to be encoded.
53
*
54
* The LLVMOpInfoCallback() for the TagType value of 1 uses the struct
55
* LLVMOpInfo1. The value of the relocatable expression for the operand,
56
* including any PC adjustment, is passed in to the call back in the Value
57
* field. The symbolic information about the operand is returned using all
58
* the fields of the structure with the Offset of the relocatable expression
59
* returned in the Value field. It is possible that some symbols in the
60
* relocatable expression were assembly temporary symbols, for example
61
* "Ldata - LpicBase + constant", and only the Values of the symbols without
62
* symbol names are present in the relocation information. The VariantKind
63
* type is one of the Target specific #defines below and is used to print
64
* operands like "_foo@GOT", ":lower16:_foo", etc.
65
*/
66
struct
LLVMOpInfoSymbol1
{
67
uint64_t
Present
;
/* 1 if this symbol is present */
68
const
char
*
Name
;
/* symbol name if not NULL */
69
uint64_t
Value
;
/* symbol value if name is NULL */
70
};
71
72
struct
LLVMOpInfo1
{
73
struct
LLVMOpInfoSymbol1
AddSymbol;
74
struct
LLVMOpInfoSymbol1
SubtractSymbol;
75
uint64_t
Value
;
76
uint64_t
VariantKind
;
77
};
78
79
/**
80
* The operand VariantKinds for symbolic disassembly.
81
*/
82
#define LLVMDisassembler_VariantKind_None 0
/* all targets */
83
84
/**
85
* The ARM target VariantKinds.
86
*/
87
#define LLVMDisassembler_VariantKind_ARM_HI16 1
/* :upper16: */
88
#define LLVMDisassembler_VariantKind_ARM_LO16 2
/* :lower16: */
89
90
/**
91
* The ARM64 target VariantKinds.
92
*/
93
#define LLVMDisassembler_VariantKind_ARM64_PAGE 1
/* @page */
94
#define LLVMDisassembler_VariantKind_ARM64_PAGEOFF 2
/* @pageoff */
95
#define LLVMDisassembler_VariantKind_ARM64_GOTPAGE 3
/* @gotpage */
96
#define LLVMDisassembler_VariantKind_ARM64_GOTPAGEOFF 4
/* @gotpageoff */
97
#define LLVMDisassembler_VariantKind_ARM64_TLVP 5
/* @tvlppage */
98
#define LLVMDisassembler_VariantKind_ARM64_TLVOFF 6
/* @tvlppageoff */
99
100
/**
101
* The type for the symbol lookup function. This may be called by the
102
* disassembler for things like adding a comment for a PC plus a constant
103
* offset load instruction to use a symbol name instead of a load address value.
104
* It is passed the block information is saved when the disassembler context is
105
* created and the ReferenceValue to look up as a symbol. If no symbol is found
106
* for the ReferenceValue NULL is returned. The ReferenceType of the
107
* instruction is passed indirectly as is the PC of the instruction in
108
* ReferencePC. If the output reference can be determined its type is returned
109
* indirectly in ReferenceType along with ReferenceName if any, or that is set
110
* to NULL.
111
*/
112
typedef
const
char
*(*LLVMSymbolLookupCallback)(
void
*DisInfo,
113
uint64_t ReferenceValue,
114
uint64_t *ReferenceType,
115
uint64_t ReferencePC,
116
const
char
**ReferenceName);
117
/**
118
* The reference types on input and output.
119
*/
120
/* No input reference type or no output reference type. */
121
#define LLVMDisassembler_ReferenceType_InOut_None 0
122
123
/* The input reference is from a branch instruction. */
124
#define LLVMDisassembler_ReferenceType_In_Branch 1
125
/* The input reference is from a PC relative load instruction. */
126
#define LLVMDisassembler_ReferenceType_In_PCrel_Load 2
127
128
/* The input reference is from an ARM64::ADRP instruction. */
129
#define LLVMDisassembler_ReferenceType_In_ARM64_ADRP 0x100000001
130
/* The input reference is from an ARM64::ADDXri instruction. */
131
#define LLVMDisassembler_ReferenceType_In_ARM64_ADDXri 0x100000002
132
/* The input reference is from an ARM64::LDRXui instruction. */
133
#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXui 0x100000003
134
/* The input reference is from an ARM64::LDRXl instruction. */
135
#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXl 0x100000004
136
/* The input reference is from an ARM64::ADR instruction. */
137
#define LLVMDisassembler_ReferenceType_In_ARM64_ADR 0x100000005
138
139
/* The output reference is to as symbol stub. */
140
#define LLVMDisassembler_ReferenceType_Out_SymbolStub 1
141
/* The output reference is to a symbol address in a literal pool. */
142
#define LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr 2
143
/* The output reference is to a cstring address in a literal pool. */
144
#define LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr 3
145
146
/* The output reference is to a Objective-C CoreFoundation string. */
147
#define LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref 4
148
/* The output reference is to a Objective-C message. */
149
#define LLVMDisassembler_ReferenceType_Out_Objc_Message 5
150
/* The output reference is to a Objective-C message ref. */
151
#define LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref 6
152
/* The output reference is to a Objective-C selector ref. */
153
#define LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref 7
154
/* The output reference is to a Objective-C class ref. */
155
#define LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref 8
156
157
/* The output reference is to a C++ symbol name. */
158
#define LLVMDisassembler_ReferenceType_DeMangled_Name 9
159
160
#endif
LLVMOpInfo1::Value
uint64_t Value
Definition:
DisassemblerTypes.h:75
LLVMOpInfo1
Definition:
DisassemblerTypes.h:72
LLVMOpInfo1::VariantKind
uint64_t VariantKind
Definition:
DisassemblerTypes.h:76
LLVMOpInfoCallback
int(* LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, uint64_t Offset, uint64_t Size, int TagType, void *TagBuf)
The type for the operand information call back function.
Definition:
DisassemblerTypes.h:42
LLVMDisasmContextRef
void * LLVMDisasmContextRef
An opaque reference to a disassembler context.
Definition:
DisassemblerTypes.h:23
LLVMOpInfoSymbol1::Value
uint64_t Value
Definition:
DisassemblerTypes.h:69
DataTypes.h
LLVMOpInfoSymbol1
The initial support in LLVM MC for the most general form of a relocatable expression is "AddSymbol - ...
Definition:
DisassemblerTypes.h:66
LLVMOpInfoSymbol1::Name
const char * Name
Definition:
DisassemblerTypes.h:68
llvm::AMDGPU::Hwreg::Offset
Offset
Definition:
SIDefines.h:296
Size
uint32_t Size
Definition:
Profile.cpp:47
LLVMOpInfoSymbol1::Present
uint64_t Present
Definition:
DisassemblerTypes.h:67
Generated on Sun Dec 20 2020 13:52:41 for LLVM by
1.8.13