Commit Graph

8 Commits

Author SHA1 Message Date
wanglei bf47954703 [LoongArch] Add more fixups and relocations
This patch makes the assembler support all modifiers defined in gnu-as.
Also changes some diagnostic information.

Differential Revision: https://reviews.llvm.org/D132633
2022-09-05 14:55:18 +08:00
wanglei c2ee21cf3f [LoongArch] Add some fixups and relocations
This patch only add %pc_hi20/%pc_lo12/%plt relocations in order
to be able to generate gnu ld linkable relocation file for the
`hello world` IR :
```
@.str = private unnamed_addr constant [14 x i8] c"Hello world!\0A\00", align 1

define dso_local signext i32 @main() nounwind {
entry:
  %call = call signext i32 (ptr, ...) @printf(ptr noundef @.str)
  ret i32 0
}

declare dso_local signext i32 @printf(ptr noundef, ...)
```

This patch also updates some test cases due to new modifiers introduced.
New test: test/MC/LoongArch/Relocations/relocations.s

Differential Revision: https://reviews.llvm.org/D132108
2022-08-20 11:19:24 +08:00
Weining Lu cfeacec833 [LoongArch] Add the missing ld.d instruction definition 2022-06-02 14:57:23 +08:00
Weining Lu 11ec7307a3 [LoongArch] Add privilege instructions definition
These instructions are added by following the `LoongArch Reference
Manual Volume 1: Basic Architecture Version 1.00`.

Differential Revision: https://reviews.llvm.org/D124826
2022-05-14 17:46:02 +08:00
Weining Lu 24532d05f8 [LoongArch] Check msb is not less than lsb for the bstr{ins/pick}.{w/d} instructions
Differential Revision: https://reviews.llvm.org/D124825
2022-05-12 09:31:44 +08:00
Weining Lu 3a49ad717c [LoongArch] Add basic floating-point instructions definition
These instructions are added by following the `LoongArch Reference
Manual Volume 1: Basic Architecture Version 1.00`.

Differential Revision: https://reviews.llvm.org/D123988
2022-04-21 10:04:20 +08:00
Weining Lu 7898587e94 [LoongArch] Add basic support to Disassembler
With the addition of disassembler now we can do instructions 'round-trip' test
that assembles `.s` to obj with `llvm-mc` and disassembles it with `llvm-objdump`
to check instruction mnemonics.

Reviewed By: xen0n, MaskRay

Differential Revision: https://reviews.llvm.org/D120477
2022-03-10 17:08:31 +08:00
Weining Lu 3347f77b80 [LoongArch] Add basic support to AsmParser
This patch adds basic support to AsmParser which can handle basic
instructions with register or immediate operands. With the addition of
the parser, now it's possible to test instructions encoding with `llvm-mc`.

Disassembler will be added later and then we can do `round-trip` test.

Reviewed By: xen0n, MaskRay, myhsu

Differential Revision: https://reviews.llvm.org/D120476
2022-03-09 16:20:36 +08:00