Skip to content

Commit 9c5ca2a

Browse files
author
whitequark
committedAug 9, 2015
LLVMIRGenerator: add target data layout to LLVM modules.
1 parent 153592f commit 9c5ca2a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
 

Diff for: ‎artiq/compiler/targets.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ class Target:
1212
1313
:var triple: (string)
1414
LLVM target triple, e.g. ``"or1k"``
15+
:var data_layout: (string)
16+
LLVM target data layout, e.g. ``"E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"``
1517
:var features: (list of string)
1618
LLVM target CPU features, e.g. ``["mul", "div", "ffl1"]``
1719
:var print_function: (string)
1820
Name of a formatted print functions (with the signature of ``printf``)
1921
provided by the target, e.g. ``"printf"``.
2022
"""
2123
triple = "unknown"
24+
data_layout = ""
2225
features = []
2326
print_function = "printf"
2427

@@ -82,5 +85,6 @@ def __init__(self):
8285

8386
class OR1KTarget(Target):
8487
triple = "or1k-linux"
88+
data_layout = "E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"
8589
attributes = ["mul", "div", "ffl1", "cmov", "addc"]
8690
print_function = "lognonl"

Diff for: ‎artiq/compiler/transforms/llvm_ir_generator.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self, engine, module_name, target):
1414
self.llcontext = target.llcontext
1515
self.llmodule = ll.Module(context=self.llcontext, name=module_name)
1616
self.llmodule.triple = target.triple
17+
self.llmodule.data_layout = target.data_layout
1718
self.llfunction = None
1819
self.llmap = {}
1920
self.fixups = []

0 commit comments

Comments
 (0)