forked from M-Labs/artiq
compiler: use default triple to determine data_layout for JIT
This commit is contained in:
parent
d931967e5c
commit
981a77834a
|
@ -239,6 +239,9 @@ class NativeTarget(Target):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
self.triple = llvm.get_default_triple()
|
||||
host_data_layout = str(llvm.targets.Target.from_default_triple().create_target_machine().target_data)
|
||||
assert host_data_layout[0] in "eE"
|
||||
self.little_endian = host_data_layout[0] == "e"
|
||||
|
||||
class OR1KTarget(Target):
|
||||
triple = "or1k-linux"
|
||||
|
@ -246,3 +249,4 @@ class OR1KTarget(Target):
|
|||
"f64:32:32-v64:32:32-v128:32:32-a0:0:32-n32"
|
||||
features = ["mul", "div", "ffl1", "cmov", "addc"]
|
||||
print_function = "core_log"
|
||||
little_endian = False
|
||||
|
|
|
@ -150,10 +150,6 @@ class LLVMIRGenerator:
|
|||
ll.Constant(lli64, 1)
|
||||
])
|
||||
|
||||
data_layout = str(self.lldatalayout)
|
||||
assert data_layout[0] in "eE"
|
||||
self.little_endian = data_layout[0] == "e"
|
||||
|
||||
def needs_sret(self, lltyp, may_be_large=True):
|
||||
if isinstance(lltyp, ll.VoidType):
|
||||
return False
|
||||
|
@ -1160,7 +1156,7 @@ class LLVMIRGenerator:
|
|||
lltime_lo = self.llbuilder.trunc(lltime, lli32)
|
||||
llnow_hiptr = self.llbuilder.bitcast(self.llbuiltin("now"), lli32.as_pointer())
|
||||
llnow_loptr = self.llbuilder.gep(llnow_hiptr, [self.llindex(1)])
|
||||
if self.little_endian:
|
||||
if self.target.little_endian:
|
||||
lltime_hi, lltime_lo = lltime_lo, lltime_hi
|
||||
llstore_hi = self.llbuilder.store_atomic(lltime_hi, llnow_hiptr, ordering="seq_cst", align=4)
|
||||
llstore_lo = self.llbuilder.store_atomic(lltime_lo, llnow_loptr, ordering="seq_cst", align=4)
|
||||
|
@ -1175,7 +1171,7 @@ class LLVMIRGenerator:
|
|||
lladjusted_lo = self.llbuilder.trunc(lladjusted, lli32)
|
||||
llnow_hiptr = self.llbuilder.bitcast(llnowptr, lli32.as_pointer())
|
||||
llnow_loptr = self.llbuilder.gep(llnow_hiptr, [self.llindex(1)])
|
||||
if self.little_endian:
|
||||
if self.target.little_endian:
|
||||
lladjusted_hi, lladjusted_lo = lladjusted_lo, lladjusted_hi
|
||||
llstore_hi = self.llbuilder.store_atomic(lladjusted_hi, llnow_hiptr, ordering="seq_cst", align=4)
|
||||
llstore_lo = self.llbuilder.store_atomic(lladjusted_lo, llnow_loptr, ordering="seq_cst", align=4)
|
||||
|
|
Loading…
Reference in New Issue