Skip to content

Commit

Permalink
LLVMIRGenerator: add target data layout to LLVM modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Aug 9, 2015
1 parent 153592f commit 9c5ca2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions artiq/compiler/targets.py
Expand Up @@ -12,13 +12,16 @@ class Target:
:var triple: (string)
LLVM target triple, e.g. ``"or1k"``
:var data_layout: (string)
LLVM target data layout, e.g. ``"E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"``
:var features: (list of string)
LLVM target CPU features, e.g. ``["mul", "div", "ffl1"]``
:var print_function: (string)
Name of a formatted print functions (with the signature of ``printf``)
provided by the target, e.g. ``"printf"``.
"""
triple = "unknown"
data_layout = ""
features = []
print_function = "printf"

Expand Down Expand Up @@ -82,5 +85,6 @@ def __init__(self):

class OR1KTarget(Target):
triple = "or1k-linux"
data_layout = "E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"
attributes = ["mul", "div", "ffl1", "cmov", "addc"]
print_function = "lognonl"
1 change: 1 addition & 0 deletions artiq/compiler/transforms/llvm_ir_generator.py
Expand Up @@ -14,6 +14,7 @@ def __init__(self, engine, module_name, target):
self.llcontext = target.llcontext
self.llmodule = ll.Module(context=self.llcontext, name=module_name)
self.llmodule.triple = target.triple
self.llmodule.data_layout = target.data_layout
self.llfunction = None
self.llmap = {}
self.fixups = []
Expand Down

0 comments on commit 9c5ca2a

Please sign in to comment.