forked from M-Labs/artiq
1
0
Fork 0

compiler/target: split RISCV target into float/non-float

This commit is contained in:
occheung 2021-11-08 12:59:09 +08:00 committed by Sébastien Bourdeauducq
parent 03b803e764
commit 0d708cd61a
1 changed files with 15 additions and 2 deletions

View File

@ -98,7 +98,8 @@ class Target:
lltarget = llvm.Target.from_triple(self.triple) lltarget = llvm.Target.from_triple(self.triple)
llmachine = lltarget.create_target_machine( llmachine = lltarget.create_target_machine(
features=",".join(["+{}".format(f) for f in self.features]), features=",".join(["+{}".format(f) for f in self.features]),
reloc="pic", codemodel="default") reloc="pic", codemodel="default",
abiname="ilp32d" if isinstance(self, RV32GTarget) else "")
llmachine.set_asm_verbosity(True) llmachine.set_asm_verbosity(True)
return llmachine return llmachine
@ -252,7 +253,7 @@ class NativeTarget(Target):
self.triple = llvm.get_default_triple() self.triple = llvm.get_default_triple()
host_data_layout = str(llvm.targets.Target.from_default_triple().create_target_machine().target_data) host_data_layout = str(llvm.targets.Target.from_default_triple().create_target_machine().target_data)
class RISCVTarget(Target): class RV32IMATarget(Target):
triple = "riscv32-unknown-linux" triple = "riscv32-unknown-linux"
data_layout = "e-m:e-p:32:32-i64:64-n32-S128" data_layout = "e-m:e-p:32:32-i64:64-n32-S128"
features = ["m", "a"] features = ["m", "a"]
@ -264,6 +265,18 @@ class RISCVTarget(Target):
tool_addr2line = "llvm-addr2line" tool_addr2line = "llvm-addr2line"
tool_cxxfilt = "llvm-cxxfilt" tool_cxxfilt = "llvm-cxxfilt"
class RV32GTarget(Target):
triple = "riscv32-unknown-linux"
data_layout = "e-m:e-p:32:32-i64:64-n32-S128"
features = ["m", "a", "f", "d"]
print_function = "core_log"
now_pinning = True
tool_ld = "ld.lld"
tool_strip = "llvm-strip"
tool_addr2line = "llvm-addr2line"
tool_cxxfilt = "llvm-cxxfilt"
class CortexA9Target(Target): class CortexA9Target(Target):
triple = "armv7-unknown-linux-gnueabihf" triple = "armv7-unknown-linux-gnueabihf"
data_layout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" data_layout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"