首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在机器代码方面,在GCC、clang和/或LLVM中实现的架构支持在哪里?

在机器代码方面,在GCC、clang和/或LLVM中实现的架构支持在哪里?
EN

Stack Overflow用户
提问于 2021-01-14 15:30:20
回答 2查看 198关注 0票数 2

我在看this

代码语言:javascript
复制
Architecture characteristic key
-----------------------------------------------------------------------
H       A hardware implementation does not exist.
M       A hardware implementation is not currently being manufactured.
S       A Free simulator does not exist.
L       Integer registers are narrower than 32 bits.
Q       Integer registers are at least 64 bits wide.
N       Memory is not byte addressable, and/or bytes are not eight bits.
F       Floating point arithmetic is not included in the instruction set
I       Architecture does not use IEEE format floating point numbers
C       Architecture does not have a single condition code register.
B       Architecture has delay slots.
D       Architecture has a stack that grows upward.

l       Port cannot use ILP32 mode integer arithmetic.
q       Port can use LP64 mode integer arithmetic.
r       Port can switch between ILP32 and LP64 at runtime.
        (Not necessarily supported by all subtargets.)
c       Port uses cc0.
p       Port uses define_peephole (as opposed to define_peephole2).
b       Port uses '"* ..."' notation for output template code.
f       Port does not define prologue and/or epilogue RTL expanders.
m       Port does not use define_constants.
g       Port does not define TARGET_ASM_FUNCTION_(PRO|EPI)LOGUE.
i       Port generates multiple inheritance thunks using
        TARGET_ASM_OUTPUT_MI(_VCALL)_THUNK.
a       Port uses LRA (by default, i.e. unless overridden by a switch).
t       All insns either produce exactly one assembly instruction, or
        trigger a define_split.
e       <arch>-elf is not a supported target.
s       <arch>-elf is the correct target to use with the simulator
        in /cvs/src.
          |      Characteristics
Target     | HMSLQNFICBD lqrcpbfmgiates
-----------+---------------------------
aarch64    |     Q        q   b  gia  s
alpha      |  ?  Q   C    q     mgi  e
arc        |          B       b  gia
arm        |                  b   ia  s
avr        |    L  FI    l  cp   g
bfin       |       F             gi
c6x        |   S     CB          gi
cr16       |    L  F C      c    g    s
cris       |       F  B          gi   s
csky       |                  b   ia
epiphany   |         C           gi   s
fr30       | ??    FI B      pb mg    s
frv        | ??       B       b   i   s
gcn        |   S     C D  q        a e
h8300      |       FI B          g    s
i386       |     Q        q   b   ia
ia64       |   ? Q   C    qr  b m i
iq2000     | ???   FICB       b  g  t
lm32       |       F             g
m32c       |    L  FI    l    b  g    s
m32r       |       FI         b       s
m68k       |                 pb   i
mcore      |  ?    FI        pb mg    s
mep        |       F C        b  g  t s
microblaze |         CB           i   s
mips       |     Q   CB   qr      ia  s
mmix       | HM  Q   C    q       i  e
mn10300    | ??                  gi   s
moxie      |       F             g  t s
msp430     |    L  FI    l    b  g    s
nds32      |       F C            ia  s
nios2      |         C            ia
nvptx      |   S Q   C    q     mg   e
pa         |     Q   CBD  qr  b   i  e
pdp11      |    L   IC    qr  b      e
powerpcspe |     Q   C    qr pb   ia
pru        |    L  F               a  s
riscv      |     Q   C    qr     gia
rl78       |    L  F     l       g    s
rs6000     |     Q   C    qr pb   ia
rx         |                          s
s390       |     Q        qr     gia e
sh         |     Q   CB   qr p    i
sparc      |     Q   CB   qr  b   ia
stormy16   | ???L  FIC D l    b   i
tilegx     |     Q   C    q      gi  e
tilepro    |   S   F C           gi  e
v850       |                     g a  s
vax        |  M     I         b   i  e
visium     |          B          g  t s
xtensa     |         C

这看起来像是大约50个架构。在GitHub上的源代码中实现的所有这些都在哪里?对于GCC、clang和/或LLVM (或在实现架构集成方面可能感兴趣的任何其他关键项目)。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-01-15 05:30:27

对于LLVM (Clang是基于LLVM的前端),您可以在llvm/lib/Target/目录中找到每个架构的后端代码。LLVM使用.td目标描述文件来描述目标(它是一种自己的语言)。比如指令、寄存器、调用约定等等。

在这些目录中还有实现某些功能的.cpp文件。例如,llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp文件实现了一个通道,用Mips体系结构的有用指令填充延迟空位。

有用于添加RISC-V目标的git补丁的this存储库,这是一个很好的例子,如何逐步实现后端。is也有很多文档,但请记住,它已经相当过时了,但仍然有有用的信息。

票数 3
EN

Stack Overflow用户

发布于 2021-01-14 15:47:38

非常简短地概述了一下GCC:

GCC的.md机器定义文件使用与GNU内联asm类似的约束语法,告诉它哪些指令是可用的,以及它们做了什么。(GCC不知道机器代码,只知道asm文本,这就是为什么它只能输出一个.sas单独汇编。)还有一些C函数知道该体系结构的通用规则,我猜是寄存器名称之类的东西。

《GCC -内幕》手册中有一节6.3.9 Anatomy of a Target Back End,记录了相关文件在GCC源代码树中的位置。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65714942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档