Skip to content

Commit 02f885e

Browse files
committed
Add elaborations
1 parent 3146ac1 commit 02f885e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

suite/auto-sync/RefactorGuide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,19 @@ Note:
7373
- If in doubt, check the original C++ file in the LLVM repo.
7474
- ### Make it build
7575
- Add `ARCHLinkage.h` and the functions in the `InstPrinter.c`, `ArchDisassembler.c`.
76+
- Explanation: The idea behind `ARCHLinkage.h` is to separate the Capstone and LLVM code, at least loosely, into compile units.
77+
So the LLVM and Capstone code can at some point live in their own object files. This is not yet implemented, but
78+
we try to keep them from becoming too entangled.
7679
- Add essential code in `ARCHMapping.c`. Esential is everything **not** releated to details.
7780
- If unsure how to do Capstone <-> LLVM code things, always check LoongArch. If LoongArch doesn't handle this case, check Mips, SystemZ
7881
- ### Run tests & Fixing bugs
7982
- Update regression MC tests: Map LLVM `mattr` and `mcpu` names to the CS identifiers if necessary. -> Edit the `mcupdater.json` config file.
8083
- Update tests: `ASUpdater -s MCUpdate -a Arch -w`
84+
- It can happen that `MCUpdate` doesn't generate any tests. This means LLVM has no disassembly tests for this architecture.
85+
You can add your arch to `use_assembly_tests` in `mcupdater.json` to do so.
86+
Keep in mind that some tests can later fail even though they are correct.
87+
The compiler can assemble an instruction to a semantically equivalent, but syntactically different one.
88+
This syntactic mismatch can later make those tests fail in Capstone.
8189
- Run MC tests: `cstest tests/MC/Arch`
8290
- ### Add details
8391
- Effectively copy behavior from `LoongArchMapping.c` or `SystemZMapping.c` but change values.

0 commit comments

Comments
 (0)