You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Ensure the newly defined instructions have `let Predicates = [HasExtensionName];`set.
18
+
4. Add or exclude the extension from existing processor models:
19
+
- Search for`list<Predicate> UnsupportedFeatures`in the target directory.
20
+
Add `HasExtensionName` to all processor models which don't support it.
21
+
- The processor models which do support it, need the instructions in the scheduler.
22
+
Check how it is done in the processor's scheduler file.
23
+
5. Include the `<ARCH>NewExtension.td` at the bottom of `<ARCH>InstrInfo.td`with`include "<ARCH>NewExtension.td"`.
24
+
25
+
**Note:** As an example you can refer to `AArch64AppleProprietary.td`.
26
+
Also search for`HasAMX`and`FeatureAMX` to see how those flags are used in the files.
27
+
28
+
# Deprecated Features
29
+
30
+
Capstone needs to support features which were removed by LLVMin the past.
31
+
Here we explain how to reintroduce them.
32
+
33
+
## Reintroduction
34
+
35
+
To get the old features back we copy them from the old `.td` files and include them in the new ones.
36
+
37
+
To include removed features from previous LLVM versions do the following:
38
+
39
+
1. Checkout the last LLVM version the feature was present.
40
+
2. Copy all feature related definitions into a `<ARCH>Deprecated.td`file.
41
+
3. Checkout the newest LLVM version again.
42
+
4. Wrap the different definition types in include guards. For example the `InstrInfo` definitions could be included in:
43
+
44
+
```
45
+
#ifndef INCLUDED_CAPSTONE_DEPR_INSTR
46
+
#ifdef CAPSTONE_DEPR_INSTR
47
+
#define INCLUDED_CAPSTONE_DEPR_INSTR // Ensures it is only included once
48
+
49
+
[Instruction definitions of removed feature]
50
+
51
+
#endif // INCLUDED_CAPSTONE_DEPR_INSTR
52
+
#endif // CAPSTONE_DEPR_INSTR
53
+
```
54
+
55
+
_Note that the order of `#ifndef` and `#ifdef` matters (otherwise you'll get an error from `tblgen`)._
56
+
57
+
**This step is somewhat optional. It might be enough to write all definitions in a single fileand`#include` them once into `ARCHInstrInfo.td` at the bottom.**
58
+
59
+
5. Include the definitions in the current definition files with:
60
+
61
+
```
62
+
#define CAPSTONE_DEPR_INSTR
63
+
include "<ARCH>Deprecated.td"
64
+
```
65
+
66
+
## Notes
67
+
- It is possible that you have to change some definitions slightly.
68
+
Because certain classes no longer exist or were replaced (e.g.: `GCCBuiltin`->`ClangBuiltin`).
69
+
- Some processors might need the feature flag (`Has<DeprecatedFeature>`) added
0 commit comments