Merge branch 'master' of github.com:m-labs/artiq

This commit is contained in:
Sebastien Bourdeauducq 2016-03-30 01:45:16 +08:00
commit 010c68f0a1
3 changed files with 21 additions and 15 deletions

View File

@ -46,12 +46,14 @@ class RunTool:
def _dump(target, kind, suffix, content):
if target is not None:
print("====== {} DUMP ======".format(kind.upper()), file=sys.stderr)
content_bytes = bytes(content(), 'utf-8')
content_value = content()
if isinstance(content_value, str):
content_value = bytes(content_value, 'utf-8')
if target == "":
file = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
else:
file = open(target + suffix, "wb")
file.write(content_bytes)
file.write(content_value)
file.close()
print("{} dumped as {}".format(kind, file.name), file=sys.stderr)

View File

@ -569,7 +569,6 @@ class LLVMIRGenerator:
if func.is_internal:
self.llfunction.linkage = 'private'
if func.is_cold:
self.llfunction.calling_convention = 'coldcc'
self.llfunction.attributes.add('cold')
self.llfunction.attributes.add('noinline')
@ -685,13 +684,17 @@ class LLVMIRGenerator:
inbounds=True)
llouterenv = self.llbuilder.load(llptr)
llouterenv.metadata['invariant.load'] = self.empty_metadata
llouterenv.metadata['nonnull'] = self.empty_metadata
return self.llptr_to_var(llouterenv, env_ty.params["$outer"], var_name)
def process_GetLocal(self, insn):
env = insn.environment()
llptr = self.llptr_to_var(self.map(env), env.type, insn.var_name)
llptr.name = "ptr.{}.{}".format(env.name, insn.var_name)
return self.llbuilder.load(llptr, name="val.{}.{}".format(env.name, insn.var_name))
llvalue = self.llbuilder.load(llptr, name="val.{}.{}".format(env.name, insn.var_name))
if isinstance(llvalue.type, ll.PointerType):
llvalue.metadata['nonnull'] = self.empty_metadata
return llvalue
def process_SetLocal(self, insn):
env = insn.environment()
@ -810,9 +813,12 @@ class LLVMIRGenerator:
else:
llptr = self.llbuilder.gep(obj, [self.llindex(0), self.llindex(index)],
inbounds=True, name="ptr.{}".format(insn.name))
llval = self.llbuilder.load(llptr, name="val.{}".format(insn.name))
llval.metadata['invariant.load'] = self.empty_metadata
return llval
llvalue = self.llbuilder.load(llptr, name="val.{}".format(insn.name))
if types.is_instance(typ) and attr in typ.constant_attributes:
llvalue.metadata['invariant.load'] = self.empty_metadata
if isinstance(llvalue.type, ll.PointerType):
llvalue.metadata['nonnull'] = self.empty_metadata
return llvalue
def process_SetAttr(self, insn):
typ, attr = insn.object().type, insn.attr
@ -840,7 +846,10 @@ class LLVMIRGenerator:
llelts = self.llbuilder.extract_value(self.map(insn.list()), 1)
llelt = self.llbuilder.gep(llelts, [self.map(insn.index())],
inbounds=True)
return self.llbuilder.load(llelt)
llvalue = self.llbuilder.load(llelt)
if isinstance(llvalue.type, ll.PointerType):
llvalue.metadata['nonnull'] = self.empty_metadata
return llvalue
def process_SetElem(self, insn):
llelts = self.llbuilder.extract_value(self.map(insn.list()), 1)
@ -1051,6 +1060,7 @@ class LLVMIRGenerator:
inbounds=True)
llouterenv = self.llbuilder.load(llptr)
llouterenv.metadata['invariant.load'] = self.empty_metadata
llouterenv.metadata['nonnull'] = self.empty_metadata
return self.llptr_to_var(llouterenv, env_ty.params["$outer"], var_name)
else:
return llenv
@ -1311,9 +1321,6 @@ class LLVMIRGenerator:
if types.is_c_function(functiontyp) and 'nowrite' in functiontyp.flags:
llcall.metadata['tbaa'] = self.tbaa_nowrite_call
if insn.is_cold:
llcall.cconv = 'coldcc'
return llresult
def process_Invoke(self, insn):
@ -1347,9 +1354,6 @@ class LLVMIRGenerator:
if types.is_c_function(functiontyp) and 'nowrite' in functiontyp.flags:
llcall.metadata['tbaa'] = self.tbaa_nowrite_call
if insn.is_cold:
llcall.cconv = 'coldcc'
return llcall
def _quote(self, value, typ, path):

View File

@ -4,7 +4,7 @@
from artiq.language.core import *
from artiq.language.types import *
# CHECK: call void @foo\(\), !dbg !\d+, !tbaa !\d+
# CHECK: call void @foo\(\)(, !dbg !\d+)?, !tbaa !\d+
# CHECK-L: ; Function Attrs: nounwind
# CHECK-NEXT-L: declare void @foo()