[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] [PATCH 00/16] Add ARM inline assembler

From: Danny Milosavljevic
Subject: [Tinycc-devel] [PATCH 00/16] Add ARM inline assembler
Date: Sat, 26 Dec 2020 22:58:01 +0100

This patchset adds an ARM inline assembler.

Patch 1 just exports g, gen_le16, gen_le32.  It seems that this was an
oversight since at least gen_le16 is already called by tccasm.c and thus
needs the prototype for gen_le16.

Patch 2 adds tokens for the ARM registers.
Patch 3 updates the copyright header.
Patch 4 removes asm_error.
Patch 5 adds the first instruction, a nullary instruction (nop).  It also
sets up some infrastructure to be able to easily generate instruction tokens
for all the condition code variants of each instruction.
Patch 6 adds some more nullary instructions: wfe and wfi.
Patch 7 adds parse_operand and Operand.  I've had to change tccpp.c slightly
in order to let the '#' through since ARM assembly usually needs the '#' for


   mov r3, #5

Here, "5" refers to the constant 5--it's not a comment.

In any case, I also support '$'--but that's not really common on ARM.

Patch 8 adds the first block data transfer instructions: push and pop.

tcctok.h also has push and pop, so I make sure not to define the token twice.

Patch 9 adds the first unary instruction: swi.
Patch 10 adds these binary instructions: clz, sxtb, sxth, uxtb, uxth.
Patch 11 adds the multiplication instructions.
Patch 12 adds some more block data transfer instructions: stmda, ldmda, stm,
ldm, stmia, ldmia,  stmdb, ldmdb, stmib, ldmib.
Patch 13 adds some single data transfer instructions: ldr, ldrb, str, strb.
Patch 14 adds some data processing instructions: and, eor, sub, rsb, add, adc,
sbc, rsc, tst, teq, cmp, cmn, orr, mov, bic, mvn.

Patch 15 adds some branch instructions: b, bl, bx, blx.

I copied encbranchoffset from arm-gen.c and adapted it slightly.

Patch 16 optimizes the memory allocation of gen_le32.

Danny Milosavljevic (16):
  arm-asm: Publish g, gen_le16, gen_le32 in tcc.h
  arm-asm: Implement asm_parse_regvar and asm_clobber
  arm-asm: Update copyright header
  arm-asm: Remove asm_error
  arm-asm: Add nop
  arm-asm: Add wfe, wfi
  arm-asm: Add parse_operand, Operand
  arm-asm: Add push, pop
  arm-asm: Add swi
  arm-asm: Add clz, sxtb, sxth, uxtb, uxth
  arm-asm: Add mul, mla, smull, umull, smlal, umlal
  arm-asm: Add stmda, ldmda, stm, ldm, stmia, ldmia, stmdb, ldmdb,
    stmib, ldmib
  arm-asm: Add ldr, ldrb, str, strb
  arm-asm: Add and, eor, sub, rsb, add, adc, sbc, rsc, tst, teq, cmp,
    cmn, orr, mov, bic, mvn
  arm-asm: Add b, bl, bx, blx
  arm-asm: Optimize gen_le32

 Makefile  |   2 +-
 arm-asm.c | 916 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 arm-tok.h | 147 +++++++++
 tcc.h     |   4 +-
 tccpp.c   |  12 +-
 tcctok.h  |   5 +-
 6 files changed, 1069 insertions(+), 17 deletions(-)
 create mode 100644 arm-tok.h

reply via email to

[Prev in Thread] Current Thread [Next in Thread]