LLVM  16.0.0git
riscv.h
Go to the documentation of this file.
1 //===-- riscv.h - Generic JITLink riscv edge kinds, utilities -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Generic utilities for graphs representing riscv objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_JITLINK_RISCV_H
14 #define LLVM_EXECUTIONENGINE_JITLINK_RISCV_H
15 
17 
18 namespace llvm {
19 namespace jitlink {
20 namespace riscv {
21 
22 /// Represets riscv fixups
24 
25  // TODO: Capture and replace to generic fixups
26  /// A plain 32-bit pointer value relocation
27  ///
28  /// Fixup expression:
29  /// Fixup <= Target + Addend : uint32
30  ///
32 
33  /// A plain 64-bit pointer value relocation
34  ///
35  /// Fixup expression:
36  /// Fixup <- Target + Addend : uint32
37  ///
39 
40  /// PC-relative branch pointer value relocation
41  ///
42  /// Fixup expression:
43  /// Fixup <- (Target - Fixup + Addend)
44  ///
46 
47  /// High 20 bits of PC-relative jump pointer value relocation
48  ///
49  /// Fixup expression:
50  /// Fixup <- Target - Fixup + Addend
51  ///
53 
54  /// High 20 bits of 32-bit pointer value relocation
55  ///
56  /// Fixup expression
57  /// Fixup <- (Target + Addend + 0x800) >> 12
59 
60  /// Low 12 bits of 32-bit pointer value relocation, used by S type instruction
61  /// format
62  ///
63  /// Fixup expression
64  /// Fixup <- (Target + Addend) & 0xFFF
66 
67  /// Low 12 bits of 32-bit pointer value relocation
68  ///
69  /// Fixup expression
70  /// Fixup <- (Target + Addend) & 0xFFF
72  /// High 20 bits of PC relative relocation
73  ///
74  /// Fixup expression:
75  /// Fixup <- (Target - Fixup + Addend + 0x800) >> 12
77 
78  /// Low 12 bits of PC relative relocation, used by I type instruction format
79  ///
80  /// Fixup expression:
81  /// Fixup <- (Target - Fixup + Addend) & 0xFFF
83 
84  /// Low 12 bits of PC relative relocation, used by S type instruction format
85  ///
86  /// Fixup expression:
87  /// Fixup <- (Target - Fixup + Addend) & 0xFFF
89 
90  /// PC relative call
91  ///
92  /// Fixup expression:
93  /// Fixup <- (Target - Fixup + Addend)
95 
96  /// 32 bits PC relative relocation
97  ///
98  /// Fixup expression:
99  /// Fixup <- (Target - Fixup + Addend)
101 
102  /// PC relative GOT offset
103  ///
104  /// Fixup expression:
105  /// Fixup <- (GOT - Fixup + Addend) >> 12
107 
108  /// PC relative call by PLT
109  ///
110  /// Fixup expression:
111  /// Fixup <- (Target - Fixup + Addend)
113 
114  /// 64 bits label addition
115  ///
116  /// Fixup expression:
117  /// Fixup <- (Target - *{8}Fixup + Addend)
119 
120  /// 32 bits label addition
121  ///
122  /// Fixup expression:
123  /// Fixup <- (Target - *{4}Fixup + Addend)
125 
126  /// 16 bits label addition
127  ///
128  /// Fixup expression
129  /// Fixup <- (Target - *{2}Fixup + Addend)
131 
132  /// 8 bits label addition
133  ///
134  /// Fixup expression
135  /// Fixup <- (Target - *{1}Fixup + Addend)
137 
138  /// 64 bits label subtraction
139  ///
140  /// Fixup expression
141  /// Fixup <- (Target - *{8}Fixup - Addend)
143 
144  /// 32 bits label subtraction
145  ///
146  /// Fixup expression
147  /// Fixup <- (Target - *{4}Fixup - Addend)
149 
150  /// 16 bits label subtraction
151  ///
152  /// Fixup expression
153  /// Fixup <- (Target - *{2}Fixup - Addend)
155 
156  /// 8 bits label subtraction
157  ///
158  /// Fixup expression
159  /// Fixup <- (Target - *{1}Fixup - Addend)
161 
162  /// 6 bits label subtraction
163  ///
164  /// Fixup expression
165  /// Fixup <- (Target - *{1}Fixup - Addend)
167 
168  /// Local label assignment
169  ///
170  /// Fixup expression:
171  /// Fixup <- (Target + Addend)
173 
174  /// Local label assignment
175  ///
176  /// Fixup expression:
177  /// Fixup <- (Target + Addend)
179 
180  /// Local label assignment
181  ///
182  /// Fixup expression:
183  /// Fixup <- (Target + Addend)
185 
186  /// Local label assignment
187  ///
188  /// Fixup expression:
189  /// Fixup <- (Target + Addend)
191 };
192 
193 /// Returns a string name for the given riscv edge. For debugging purposes
194 /// only
195 const char *getEdgeKindName(Edge::Kind K);
196 } // namespace riscv
197 } // namespace jitlink
198 } // namespace llvm
199 
200 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18