merged with master
This commit is contained in:
12
Makefile
12
Makefile
@@ -120,7 +120,9 @@ ifeq ($(LLVM_VERSION),LLVM_3_4)
|
|||||||
ISPC_LIBS += -lcurses
|
ISPC_LIBS += -lcurses
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LLVM_VERSION),LLVM_3_5)
|
# There is no logical OR in GNU make.
|
||||||
|
# This 'ifneq' acts like if( !($(LLVM_VERSION) == LLVM_3_2 || $(LLVM_VERSION) == LLVM_3_3 || $(LLVM_VERSION) == LLVM_3_4))
|
||||||
|
ifeq (,$(filter $(LLVM_VERSION), LLVM_3_2 LLVM_3_3 LLVM_3_4))
|
||||||
ISPC_LIBS += -lcurses -lz
|
ISPC_LIBS += -lcurses -lz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -157,7 +159,9 @@ CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -I$(CLANG_INCLUDE) \
|
|||||||
-Wall \
|
-Wall \
|
||||||
-DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \
|
-DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \
|
||||||
-Wno-sign-compare -Wno-unused-function -Werror
|
-Wno-sign-compare -Wno-unused-function -Werror
|
||||||
ifeq ($(LLVM_VERSION),LLVM_3_5)
|
|
||||||
|
# if( !($(LLVM_VERSION) == LLVM_3_2 || $(LLVM_VERSION) == LLVM_3_3 || $(LLVM_VERSION) == LLVM_3_4))
|
||||||
|
ifeq (,$(filter $(LLVM_VERSION), LLVM_3_2 LLVM_3_3 LLVM_3_4))
|
||||||
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
|
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
|
||||||
endif
|
endif
|
||||||
ifneq ($(ARM_ENABLED), 0)
|
ifneq ($(ARM_ENABLED), 0)
|
||||||
@@ -253,9 +257,9 @@ ispc: print_llvm_src dirs $(OBJS)
|
|||||||
clang: ispc
|
clang: ispc
|
||||||
clang: CXX=clang++
|
clang: CXX=clang++
|
||||||
|
|
||||||
# Use gcc as a default compiler, instead of gcc
|
# Use gcc as a default compiler
|
||||||
gcc: ispc
|
gcc: ispc
|
||||||
gcc: CXX=clang++
|
gcc: CXX=g++
|
||||||
|
|
||||||
# Build ispc with address sanitizer instrumentation using clang compiler
|
# Build ispc with address sanitizer instrumentation using clang compiler
|
||||||
# Note that this is not portable build
|
# Note that this is not portable build
|
||||||
|
|||||||
257
alloy.py
257
alloy.py
@@ -33,9 +33,22 @@
|
|||||||
|
|
||||||
# // Author: Filippov Ilia
|
# // Author: Filippov Ilia
|
||||||
|
|
||||||
def attach_mail_file(msg, filename, name):
|
def tail_and_save(file_in, file_out, tail = 100):
|
||||||
|
with open(file_in, 'r') as f_in:
|
||||||
|
lines = f_in.readlines()[-tail:]
|
||||||
|
|
||||||
|
with open(file_out, 'w') as f_out:
|
||||||
|
f_out.writelines(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def attach_mail_file(msg, filename, name, tail = -1):
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
fp = open(filename, "rb")
|
if tail > 0:
|
||||||
|
tail_and_save(filename, filename + '.tail', tail)
|
||||||
|
fp = open(filename + '.tail', "rb")
|
||||||
|
else:
|
||||||
|
fp = open(filename, "rb")
|
||||||
|
|
||||||
to_attach = MIMEBase("application", "octet-stream")
|
to_attach = MIMEBase("application", "octet-stream")
|
||||||
to_attach.set_payload(fp.read())
|
to_attach.set_payload(fp.read())
|
||||||
encode_base64(to_attach)
|
encode_base64(to_attach)
|
||||||
@@ -43,6 +56,7 @@ def attach_mail_file(msg, filename, name):
|
|||||||
fp.close()
|
fp.close()
|
||||||
msg.attach(to_attach)
|
msg.attach(to_attach)
|
||||||
|
|
||||||
|
|
||||||
def setting_paths(llvm, ispc, sde):
|
def setting_paths(llvm, ispc, sde):
|
||||||
if llvm != "":
|
if llvm != "":
|
||||||
os.environ["LLVM_HOME"]=llvm
|
os.environ["LLVM_HOME"]=llvm
|
||||||
@@ -72,6 +86,10 @@ def try_do_LLVM(text, command, from_validation):
|
|||||||
postfix = " >> " + alloy_build + " 2>> " + alloy_build
|
postfix = " >> " + alloy_build + " 2>> " + alloy_build
|
||||||
if os.system(command + postfix) != 0:
|
if os.system(command + postfix) != 0:
|
||||||
print_debug("ERROR.\n", from_validation, alloy_build)
|
print_debug("ERROR.\n", from_validation, alloy_build)
|
||||||
|
if options.notify != "":
|
||||||
|
msg = MIMEMultipart()
|
||||||
|
attach_mail_file(msg, stability_log, "stability.log")
|
||||||
|
send_mail("ERROR: Non-zero exit status while executing " + command + ". Examine build log for more information.", msg)
|
||||||
error("can't " + text, 1)
|
error("can't " + text, 1)
|
||||||
print_debug("DONE.\n", from_validation, alloy_build)
|
print_debug("DONE.\n", from_validation, alloy_build)
|
||||||
|
|
||||||
@@ -85,15 +103,18 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
|
|||||||
current_path = os.getcwd()
|
current_path = os.getcwd()
|
||||||
llvm_home = os.environ["LLVM_HOME"]
|
llvm_home = os.environ["LLVM_HOME"]
|
||||||
|
|
||||||
|
|
||||||
make_sure_dir_exists(llvm_home)
|
make_sure_dir_exists(llvm_home)
|
||||||
|
|
||||||
os.chdir(llvm_home)
|
os.chdir(llvm_home)
|
||||||
FOLDER_NAME=version_LLVM
|
FOLDER_NAME=version_LLVM
|
||||||
if version_LLVM == "trunk":
|
if version_LLVM == "trunk":
|
||||||
SVN_PATH="trunk"
|
SVN_PATH="trunk"
|
||||||
|
if version_LLVM == "3.5":
|
||||||
|
# SVN_PATH=tags/RELEASE_35/rc1
|
||||||
|
SVN_PATH="branches/release_35"
|
||||||
|
version_LLVM = "3_5"
|
||||||
if version_LLVM == "3.4":
|
if version_LLVM == "3.4":
|
||||||
SVN_PATH="tags/RELEASE_34/final"
|
SVN_PATH="tags/RELEASE_34/dot2-final"
|
||||||
version_LLVM = "3_4"
|
version_LLVM = "3_4"
|
||||||
if version_LLVM == "3.3":
|
if version_LLVM == "3.3":
|
||||||
SVN_PATH="tags/RELEASE_33/final"
|
SVN_PATH="tags/RELEASE_33/final"
|
||||||
@@ -101,9 +122,6 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
|
|||||||
if version_LLVM == "3.2":
|
if version_LLVM == "3.2":
|
||||||
SVN_PATH="tags/RELEASE_32/final"
|
SVN_PATH="tags/RELEASE_32/final"
|
||||||
version_LLVM = "3_2"
|
version_LLVM = "3_2"
|
||||||
if version_LLVM == "3.1":
|
|
||||||
SVN_PATH="tags/RELEASE_31/final"
|
|
||||||
version_LLVM = "3_1"
|
|
||||||
if revision != "":
|
if revision != "":
|
||||||
FOLDER_NAME = FOLDER_NAME + "_" + revision
|
FOLDER_NAME = FOLDER_NAME + "_" + revision
|
||||||
revision = "-" + revision
|
revision = "-" + revision
|
||||||
@@ -235,7 +253,12 @@ def check_targets():
|
|||||||
answer_sde = []
|
answer_sde = []
|
||||||
# check what native targets do we have
|
# check what native targets do we have
|
||||||
if current_OS != "Windows":
|
if current_OS != "Windows":
|
||||||
try_do_LLVM("build check_ISA", "clang check_isa.cpp -o check_isa.exe", True)
|
if options.ispc_build_compiler == "clang":
|
||||||
|
cisa_compiler = "clang"
|
||||||
|
elif options.ispc_build_compiler == "gcc":
|
||||||
|
cisa_compiler = "g++"
|
||||||
|
|
||||||
|
try_do_LLVM("build check_ISA", cisa_compiler + " check_isa.cpp -o check_isa.exe", True)
|
||||||
else:
|
else:
|
||||||
try_do_LLVM("build check_ISA", "cl check_isa.cpp", True)
|
try_do_LLVM("build check_ISA", "cl check_isa.cpp", True)
|
||||||
SSE2 = ["sse2-i32x4", "sse2-i32x8"]
|
SSE2 = ["sse2-i32x4", "sse2-i32x8"]
|
||||||
@@ -292,11 +315,41 @@ def check_targets():
|
|||||||
def build_ispc(version_LLVM, make):
|
def build_ispc(version_LLVM, make):
|
||||||
current_path = os.getcwd()
|
current_path = os.getcwd()
|
||||||
os.chdir(os.environ["ISPC_HOME"])
|
os.chdir(os.environ["ISPC_HOME"])
|
||||||
|
|
||||||
|
make_ispc = "make " + options.ispc_build_compiler + " -j" + options.speed
|
||||||
|
|
||||||
if current_OS != "Windows":
|
if current_OS != "Windows":
|
||||||
p_temp = os.getenv("PATH")
|
p_temp = os.getenv("PATH")
|
||||||
os.environ["PATH"] = os.environ["LLVM_HOME"] + "/bin-" + version_LLVM + "/bin:" + os.environ["PATH"]
|
os.environ["PATH"] = os.environ["LLVM_HOME"] + "/bin-" + version_LLVM + "/bin:" + os.environ["PATH"]
|
||||||
try_do_LLVM("clean ISPC for building", "make clean", True)
|
try_do_LLVM("clean ISPC for building", "make clean", True)
|
||||||
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make, True)
|
|
||||||
|
folder = os.environ["LLVM_HOME"] + os.sep + "llvm-"
|
||||||
|
if options.folder == "":
|
||||||
|
folder += version_LLVM
|
||||||
|
if options.debug == True:
|
||||||
|
folder += "dbg"
|
||||||
|
|
||||||
|
|
||||||
|
llvm_rev = ""
|
||||||
|
# determine LLVM revision
|
||||||
|
p = subprocess.Popen("svn info " + folder, shell=True, \
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
(info_llvm, err) = p.communicate()
|
||||||
|
info_llvm = re.split('\n', info_llvm)
|
||||||
|
for i in info_llvm:
|
||||||
|
if len(i) > 0 and i.startswith("Last Changed Rev: "):
|
||||||
|
llvm_rev = str(i[len("Last Changed Rev: "):])
|
||||||
|
|
||||||
|
if llvm_rev != "":
|
||||||
|
common.ex_state.switch_revision(llvm_rev)
|
||||||
|
print_debug("\nBuilding ISPC with LLVM %s (%s):\n" \
|
||||||
|
% (version_LLVM, llvm_rev), False, stability_log)
|
||||||
|
else:
|
||||||
|
print_debug("Unable to retrieve LLVM revision\n", False, stability_log)
|
||||||
|
raise
|
||||||
|
|
||||||
|
try_do_LLVM("recognize LLVM revision", "svn info " + folder, True)
|
||||||
|
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make_ispc, True)
|
||||||
os.environ["PATH"] = p_temp
|
os.environ["PATH"] = p_temp
|
||||||
else:
|
else:
|
||||||
p_temp = os.getenv("LLVM_INSTALL_DIR")
|
p_temp = os.getenv("LLVM_INSTALL_DIR")
|
||||||
@@ -308,8 +361,10 @@ def build_ispc(version_LLVM, make):
|
|||||||
temp = "3_3"
|
temp = "3_3"
|
||||||
if version_LLVM == "3.4":
|
if version_LLVM == "3.4":
|
||||||
temp = "3_4"
|
temp = "3_4"
|
||||||
if version_LLVM == "trunk":
|
if version_LLVM == "3.5":
|
||||||
temp = "3_5"
|
temp = "3_5"
|
||||||
|
if version_LLVM == "trunk":
|
||||||
|
temp = "3_6"
|
||||||
os.environ["LLVM_VERSION"] = "LLVM_" + temp
|
os.environ["LLVM_VERSION"] = "LLVM_" + temp
|
||||||
try_do_LLVM("clean ISPC for building", "msbuild ispc.vcxproj /t:clean", True)
|
try_do_LLVM("clean ISPC for building", "msbuild ispc.vcxproj /t:clean", True)
|
||||||
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", "msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", True)
|
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", "msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", True)
|
||||||
@@ -324,7 +379,7 @@ def execute_stability(stability, R, print_version):
|
|||||||
temp = b_temp[0]
|
temp = b_temp[0]
|
||||||
time = b_temp[1]
|
time = b_temp[1]
|
||||||
for j in range(0,4):
|
for j in range(0,4):
|
||||||
R[j][0] = R[j][0] + temp[j]
|
R[j][0] = R[j][0] + temp[j] # new_runfails, new_compfails, new_passes_runfails, new_passes_compfails
|
||||||
for i in range(0,len(temp[j])):
|
for i in range(0,len(temp[j])):
|
||||||
R[j][1].append(temp[4])
|
R[j][1].append(temp[4])
|
||||||
number_of_fails = temp[5]
|
number_of_fails = temp[5]
|
||||||
@@ -348,11 +403,42 @@ def execute_stability(stability, R, print_version):
|
|||||||
str_time = "\n"
|
str_time = "\n"
|
||||||
print_debug(temp[4][1:-3] + str_fails + str_new_fails + str_new_passes + str_time, False, stability_log)
|
print_debug(temp[4][1:-3] + str_fails + str_new_fails + str_new_passes + str_time, False, stability_log)
|
||||||
|
|
||||||
def run_special_tests():
|
|
||||||
i = 5
|
|
||||||
|
|
||||||
class options_for_drivers:
|
'''
|
||||||
pass
|
R = [[new_runfails, [new_line, new_line...]],
|
||||||
|
[new_compfails, [new_line, new_line...]],
|
||||||
|
[new_passes_runfails, [new_line, new_line...]],
|
||||||
|
[new_passes_runfails, [new_line, new_line...]]]
|
||||||
|
'''
|
||||||
|
def output_test_results(R):
|
||||||
|
ttt = ["NEW RUNFAILS: ", "NEW COMPFAILS: ", "NEW PASSES RUNFAILS: ", "NEW PASSES COMPFAILS: "]
|
||||||
|
for j in range(0, 4):
|
||||||
|
if len(R[j][0]) == 0:
|
||||||
|
print_debug("NO " + ttt[j][:-2] + "\n", False, stability_log)
|
||||||
|
else:
|
||||||
|
print_debug(ttt[j] + str(len(R[j][0])) + "\n", False, stability_log)
|
||||||
|
to_print = {}
|
||||||
|
for (fail_name, opt_str) in zip(R[j][0], R[j][1]):
|
||||||
|
if fail_name not in to_print:
|
||||||
|
to_print[fail_name] = []
|
||||||
|
to_print[fail_name].append(opt_str)
|
||||||
|
|
||||||
|
# sort
|
||||||
|
for key in to_print.keys():
|
||||||
|
to_print[key] = sorted(to_print[key])
|
||||||
|
|
||||||
|
# print out
|
||||||
|
for fail_name in sorted(to_print.keys()):
|
||||||
|
print_debug("\t" + fail_name + "\n", True, stability_log)
|
||||||
|
for opt_str in to_print[fail_name]:
|
||||||
|
print_debug("\t\t\t" + opt_str, True, stability_log)
|
||||||
|
|
||||||
|
def concatenate_test_results(R1, R2):
|
||||||
|
R = [[[],[]],[[],[]],[[],[]],[[],[]]]
|
||||||
|
for j in range(0, 4):
|
||||||
|
R[j][0] = R1[j][0] + R2[j][0]
|
||||||
|
R[j][1] = R1[j][1] + R2[j][1]
|
||||||
|
return R
|
||||||
|
|
||||||
def validation_run(only, only_targets, reference_branch, number, notify, update, speed_number, make, perf_llvm, time):
|
def validation_run(only, only_targets, reference_branch, number, notify, update, speed_number, make, perf_llvm, time):
|
||||||
os.chdir(os.environ["ISPC_HOME"])
|
os.chdir(os.environ["ISPC_HOME"])
|
||||||
@@ -360,22 +446,19 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"]
|
os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"]
|
||||||
if options.notify != "":
|
if options.notify != "":
|
||||||
common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log")
|
common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log")
|
||||||
smtp_server = os.environ["SMTP_ISPC"]
|
|
||||||
msg = MIMEMultipart()
|
msg = MIMEMultipart()
|
||||||
msg['Subject'] = 'ISPC test system results'
|
|
||||||
msg['From'] = 'ISPC_test_system'
|
|
||||||
msg['To'] = options.notify
|
|
||||||
print_debug("Command: " + ' '.join(sys.argv) + "\n", False, "")
|
print_debug("Command: " + ' '.join(sys.argv) + "\n", False, "")
|
||||||
print_debug("Folder: " + os.environ["ISPC_HOME"] + "\n", False, "")
|
print_debug("Folder: " + os.environ["ISPC_HOME"] + "\n", False, "")
|
||||||
date = datetime.datetime.now()
|
date = datetime.datetime.now()
|
||||||
print_debug("Date: " + date.strftime('%H:%M %d/%m/%Y') + "\n", False, "")
|
print_debug("Date: " + date.strftime('%H:%M %d/%m/%Y') + "\n", False, "")
|
||||||
newest_LLVM="3.4"
|
newest_LLVM="3.4"
|
||||||
|
msg_additional_info = ""
|
||||||
# *** *** ***
|
# *** *** ***
|
||||||
# Stability validation run
|
# Stability validation run
|
||||||
# *** *** ***
|
# *** *** ***
|
||||||
if ((("stability" in only) == True) or ("performance" in only) == False):
|
if ((("stability" in only) == True) or ("performance" in only) == False):
|
||||||
print_debug("\n\nStability validation run\n\n", False, "")
|
print_debug("\n\nStability validation run\n\n", False, "")
|
||||||
stability = options_for_drivers()
|
stability = common.EmptyClass()
|
||||||
# stability constant options
|
# stability constant options
|
||||||
stability.save_bin = False
|
stability.save_bin = False
|
||||||
stability.random = False
|
stability.random = False
|
||||||
@@ -403,6 +486,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
LLVM = []
|
LLVM = []
|
||||||
targets = []
|
targets = []
|
||||||
sde_targets = []
|
sde_targets = []
|
||||||
|
|
||||||
# parsing option only, update parameters of run
|
# parsing option only, update parameters of run
|
||||||
if "-O2" in only:
|
if "-O2" in only:
|
||||||
opts.append(False)
|
opts.append(False)
|
||||||
@@ -414,7 +498,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
archs.append("x86-64")
|
archs.append("x86-64")
|
||||||
if "native" in only:
|
if "native" in only:
|
||||||
sde_targets_t = []
|
sde_targets_t = []
|
||||||
for i in ["3.1", "3.2", "3.3", "3.4", "trunk"]:
|
for i in ["3.2", "3.3", "3.4", "3.5", "trunk"]:
|
||||||
if i in only:
|
if i in only:
|
||||||
LLVM.append(i)
|
LLVM.append(i)
|
||||||
if "current" in only:
|
if "current" in only:
|
||||||
@@ -455,7 +539,6 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
targets = targets_t + targets_generic_t[:-4]
|
targets = targets_t + targets_generic_t[:-4]
|
||||||
sde_targets = sde_targets_t
|
sde_targets = sde_targets_t
|
||||||
|
|
||||||
|
|
||||||
if "build" in only:
|
if "build" in only:
|
||||||
targets = []
|
targets = []
|
||||||
sde_targets = []
|
sde_targets = []
|
||||||
@@ -475,14 +558,24 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
# begin validation run for stabitily
|
# begin validation run for stabitily
|
||||||
common.remove_if_exists(stability.in_file)
|
common.remove_if_exists(stability.in_file)
|
||||||
R = [[[],[]],[[],[]],[[],[]],[[],[]]]
|
R = [[[],[]],[[],[]],[[],[]],[[],[]]]
|
||||||
|
print_debug("\n" + common.get_host_name() + "\n", False, stability_log)
|
||||||
print_debug("\n_________________________STABILITY REPORT_________________________\n", False, stability_log)
|
print_debug("\n_________________________STABILITY REPORT_________________________\n", False, stability_log)
|
||||||
for i in range(0,len(LLVM)):
|
for i in range(0,len(LLVM)):
|
||||||
|
R_tmp = [[[],[]],[[],[]],[[],[]],[[],[]]]
|
||||||
print_version = 2
|
print_version = 2
|
||||||
if rebuild:
|
if rebuild:
|
||||||
build_ispc(LLVM[i], make)
|
build_ispc(LLVM[i], make)
|
||||||
for j in range(0,len(targets)):
|
for j in range(0,len(targets)):
|
||||||
stability.target = targets[j]
|
stability.target = targets[j]
|
||||||
stability.wrapexe = ""
|
stability.wrapexe = ""
|
||||||
|
# choosing right compiler for a given target
|
||||||
|
# sometimes clang++ is not avaluable. if --ispc-build-compiler = gcc we will pass in g++ compiler
|
||||||
|
if options.ispc_build_compiler == "gcc":
|
||||||
|
stability.compiler_exe = "g++"
|
||||||
|
# but 'knc' target is supported only by icpc, so set explicitly
|
||||||
|
if "knc" in targets[j]:
|
||||||
|
stability.compiler_exe = "icpc"
|
||||||
|
# now set archs for targets
|
||||||
if "generic" in targets[j]:
|
if "generic" in targets[j]:
|
||||||
arch = gen_archs
|
arch = gen_archs
|
||||||
elif "knc" in targets[j]:
|
elif "knc" in targets[j]:
|
||||||
@@ -494,9 +587,9 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
stability.arch = arch[i1]
|
stability.arch = arch[i1]
|
||||||
stability.no_opt = opts[i2]
|
stability.no_opt = opts[i2]
|
||||||
try:
|
try:
|
||||||
execute_stability(stability, R, print_version)
|
execute_stability(stability, R_tmp, print_version)
|
||||||
except:
|
except:
|
||||||
print_debug("Exception in execute_stability - maybe some test subprocess terminated before it should have\n", False, stability_log)
|
print_debug("ERROR: Exception in execute_stability - maybe some test subprocess terminated before it should have\n", False, stability_log)
|
||||||
print_version = 0
|
print_version = 0
|
||||||
for j in range(0,len(sde_targets)):
|
for j in range(0,len(sde_targets)):
|
||||||
stability.target = sde_targets[j][1]
|
stability.target = sde_targets[j][1]
|
||||||
@@ -505,34 +598,21 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
for i2 in range(0,len(opts)):
|
for i2 in range(0,len(opts)):
|
||||||
stability.arch = archs[i1]
|
stability.arch = archs[i1]
|
||||||
stability.no_opt = opts[i2]
|
stability.no_opt = opts[i2]
|
||||||
execute_stability(stability, R, print_version)
|
execute_stability(stability, R_tmp, print_version)
|
||||||
print_version = 0
|
print_version = 0
|
||||||
# run special tests like embree
|
# Output testing results separate for each tested LLVM version
|
||||||
#
|
R = concatenate_test_results(R, R_tmp)
|
||||||
run_special_tests()
|
output_test_results(R_tmp)
|
||||||
ttt = ["NEW RUNFAILS: ", "NEW COMPFAILS: ", "NEW PASSES RUNFAILS: ", "NEW PASSES COMPFAILS: "]
|
print_debug("\n", False, stability_log)
|
||||||
for j in range(0,4):
|
|
||||||
if len(R[j][0]) == 0:
|
print_debug("\n----------------------------------------\nTOTAL:\n", False, stability_log)
|
||||||
print_debug("NO " + ttt[j][:-2] + "\n", False, stability_log)
|
output_test_results(R)
|
||||||
else:
|
|
||||||
print_debug(ttt[j] + str(len(R[j][0])) + "\n", False, stability_log)
|
|
||||||
temp5 = [[],[]]
|
|
||||||
for i in range(0,len(R[j][0])):
|
|
||||||
er = True
|
|
||||||
for k in range(0,len(temp5[0])):
|
|
||||||
if R[j][0][i] == temp5[0][k]:
|
|
||||||
temp5[1][k].append(R[j][1][i])
|
|
||||||
er = False
|
|
||||||
if er == True:
|
|
||||||
temp5[0].append(R[j][0][i])
|
|
||||||
temp5[1].append([R[j][1][i]])
|
|
||||||
for i in range(0,len(temp5[0])):
|
|
||||||
print_debug("\t" + temp5[0][i] + "\n", True, stability_log)
|
|
||||||
for k in range(0,len(temp5[1][i])):
|
|
||||||
print_debug("\t\t\t" + temp5[1][i][k], True, stability_log)
|
|
||||||
print_debug("__________________Watch stability.log for details_________________\n", False, stability_log)
|
print_debug("__________________Watch stability.log for details_________________\n", False, stability_log)
|
||||||
if options.notify != "":
|
if options.notify != "":
|
||||||
attach_mail_file(msg, stability.in_file, "run_tests_log.log")
|
# e-mail header for performance test:
|
||||||
|
msg_additional_info += "New runfails(%d) New compfails(%d) New passes runfails(%d) New passes compfails(%d)" \
|
||||||
|
% (len(R[0][0]), len(R[1][0]), len(R[2][0]), len(R[3][0]))
|
||||||
|
attach_mail_file(msg, stability.in_file, "run_tests_log.log", 100)
|
||||||
attach_mail_file(msg, stability_log, "stability.log")
|
attach_mail_file(msg, stability_log, "stability.log")
|
||||||
|
|
||||||
# *** *** ***
|
# *** *** ***
|
||||||
@@ -541,7 +621,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
if ((("performance" in only) == True) or ("stability" in only) == False):
|
if ((("performance" in only) == True) or ("stability" in only) == False):
|
||||||
print_debug("\n\nPerformance validation run\n\n", False, "")
|
print_debug("\n\nPerformance validation run\n\n", False, "")
|
||||||
common.check_tools(1)
|
common.check_tools(1)
|
||||||
performance = options_for_drivers()
|
performance = common.EmptyClass()
|
||||||
# performance constant options
|
# performance constant options
|
||||||
performance.number = number
|
performance.number = number
|
||||||
performance.config = "." + os.sep + "perf.ini"
|
performance.config = "." + os.sep + "perf.ini"
|
||||||
@@ -591,33 +671,47 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
build_ispc(newest_LLVM, make)
|
build_ispc(newest_LLVM, make)
|
||||||
os.rename("ispc", "ispc_ref")
|
os.rename("ispc", "ispc_ref")
|
||||||
build_ispc(reference_branch, make)
|
build_ispc(reference_branch, make)
|
||||||
# begin validation run for performance. output is inserted into perf()
|
# begin validation run for performance. output is inserted into perf()
|
||||||
perf.perf(performance, [])
|
perf.perf(performance, [])
|
||||||
if options.notify != "":
|
if options.notify != "":
|
||||||
attach_mail_file(msg, performance.in_file, "performance.log")
|
attach_mail_file(msg, performance.in_file, "performance.log")
|
||||||
attach_mail_file(msg, "." + os.sep + "logs" + os.sep + "perf_build.log", "perf_build.log")
|
attach_mail_file(msg, "." + os.sep + "logs" + os.sep + "perf_build.log", "perf_build.log")
|
||||||
|
# dumping gathered info to the file
|
||||||
|
common.ex_state.dump(alloy_folder + "test_table.dump", common.ex_state.tt)
|
||||||
|
|
||||||
# sending e-mail with results
|
# sending e-mail with results
|
||||||
if options.notify != "":
|
if options.notify != "":
|
||||||
|
send_mail(msg_additional_info, msg)
|
||||||
|
|
||||||
|
def send_mail(body_header, msg):
|
||||||
|
try:
|
||||||
fp = open(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", 'rb')
|
fp = open(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", 'rb')
|
||||||
f_lines = fp.readlines()
|
f_lines = fp.readlines()
|
||||||
fp.close()
|
fp.close()
|
||||||
line = ""
|
except:
|
||||||
if not sys.exc_info()[0] == None:
|
body_header += "\nUnable to open notify_log.log: " + str(sys.exc_info()) + "\n"
|
||||||
line = line + "Last exception: " + str(sys.exc_info()) + '\n'
|
print_debug("Unable to open notify_log.log: " + str(sys.exc_info()) + "\n", False, stability_log)
|
||||||
for i in range(0,len(f_lines)):
|
|
||||||
line = line + f_lines[i][:-1]
|
|
||||||
line = line + ' \n'
|
|
||||||
text = MIMEText(line, "", "KOI-8")
|
|
||||||
msg.attach(text)
|
|
||||||
attach_mail_file(msg, alloy_build, "alloy_build.log")
|
|
||||||
s = smtplib.SMTP(smtp_server)
|
|
||||||
|
|
||||||
print "Sending an e-mail with logs:", options.notify
|
body = "Hostname: " + common.get_host_name() + "\n\n"
|
||||||
for name in options.notify.split(" "):
|
|
||||||
print "Sending to: ", name
|
if not sys.exc_info()[0] == None:
|
||||||
s.sendmail('ISPC_test_system', name, msg.as_string())
|
body += "ERROR: Exception(last) - " + str(sys.exc_info()) + '\n'
|
||||||
s.quit()
|
|
||||||
|
body += body_header + '\n'
|
||||||
|
for i in range(0, len(f_lines)):
|
||||||
|
body += f_lines[i][:-1]
|
||||||
|
body += ' \n'
|
||||||
|
|
||||||
|
attach_mail_file(msg, alloy_build, "alloy_build.log", 100) # build.log is always being sent
|
||||||
|
smtp_server = os.environ["SMTP_ISPC"]
|
||||||
|
msg['Subject'] = "ISPC test system results"
|
||||||
|
msg['From'] = "ISPC_test_system"
|
||||||
|
msg['To'] = options.notify
|
||||||
|
text = MIMEText(body, "", "KOI-8")
|
||||||
|
msg.attach(text)
|
||||||
|
s = smtplib.SMTP(smtp_server)
|
||||||
|
s.sendmail(options.notify, options.notify.split(" "), msg.as_string())
|
||||||
|
s.quit()
|
||||||
|
|
||||||
def Main():
|
def Main():
|
||||||
global current_OS
|
global current_OS
|
||||||
@@ -635,6 +729,19 @@ def Main():
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
# set appropriate makefile target
|
||||||
|
# gcc and g++ options are equal and added for ease of use
|
||||||
|
if options.ispc_build_compiler != "clang" and \
|
||||||
|
options.ispc_build_compiler != "gcc":
|
||||||
|
error("unknow option for --ispc-build-compiler: " + options.ispc_build_compiler, 1)
|
||||||
|
parser.print_help()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if options.notify != "":
|
||||||
|
# in case 'notify' option is used but build (in '-b' for example) failed we do not want to have trash in our message body
|
||||||
|
# NOTE! 'notify.log' must also be cleaned up at the beginning of every message sending function, i.e. in 'validation_run()'
|
||||||
|
common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log")
|
||||||
|
|
||||||
setting_paths(options.llvm_home, options.ispc_home, options.sde_home)
|
setting_paths(options.llvm_home, options.ispc_home, options.sde_home)
|
||||||
if os.environ.get("LLVM_HOME") == None:
|
if os.environ.get("LLVM_HOME") == None:
|
||||||
error("you have no LLVM_HOME", 1)
|
error("you have no LLVM_HOME", 1)
|
||||||
@@ -644,7 +751,7 @@ def Main():
|
|||||||
if os.environ.get("SMTP_ISPC") == None:
|
if os.environ.get("SMTP_ISPC") == None:
|
||||||
error("you have no SMTP_ISPC in your environment for option notify", 1)
|
error("you have no SMTP_ISPC in your environment for option notify", 1)
|
||||||
if options.only != "":
|
if options.only != "":
|
||||||
test_only_r = " 3.1 3.2 3.3 3.4 trunk current build stability performance x86 x86-64 -O0 -O2 native "
|
test_only_r = " 3.2 3.3 3.4 3.5 trunk current build stability performance x86 x86-64 -O0 -O2 native "
|
||||||
test_only = options.only.split(" ")
|
test_only = options.only.split(" ")
|
||||||
for iterator in test_only:
|
for iterator in test_only:
|
||||||
if not (" " + iterator + " " in test_only_r):
|
if not (" " + iterator + " " in test_only_r):
|
||||||
@@ -656,10 +763,12 @@ def Main():
|
|||||||
f_date = "logs"
|
f_date = "logs"
|
||||||
common.remove_if_exists(f_date)
|
common.remove_if_exists(f_date)
|
||||||
os.makedirs(f_date)
|
os.makedirs(f_date)
|
||||||
|
global alloy_folder
|
||||||
|
alloy_folder = os.getcwd() + os.sep + f_date + os.sep
|
||||||
global alloy_build
|
global alloy_build
|
||||||
alloy_build = os.getcwd() + os.sep + f_date + os.sep + "alloy_build.log"
|
alloy_build = alloy_folder + "alloy_build.log"
|
||||||
global stability_log
|
global stability_log
|
||||||
stability_log = os.getcwd() + os.sep + f_date + os.sep + "stability.log"
|
stability_log = alloy_folder + "stability.log"
|
||||||
current_path = os.getcwd()
|
current_path = os.getcwd()
|
||||||
make = "make -j" + options.speed
|
make = "make -j" + options.speed
|
||||||
if os.environ["ISPC_HOME"] != os.getcwd():
|
if os.environ["ISPC_HOME"] != os.getcwd():
|
||||||
@@ -703,6 +812,8 @@ import smtplib
|
|||||||
import datetime
|
import datetime
|
||||||
import copy
|
import copy
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
from email.MIMEMultipart import MIMEMultipart
|
from email.MIMEMultipart import MIMEMultipart
|
||||||
from email.MIMEBase import MIMEBase
|
from email.MIMEBase import MIMEBase
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
@@ -743,11 +854,13 @@ if __name__ == '__main__':
|
|||||||
help='ask for validation run', default=False, action="store_true")
|
help='ask for validation run', default=False, action="store_true")
|
||||||
parser.add_option('-j', dest='speed',
|
parser.add_option('-j', dest='speed',
|
||||||
help='set -j for make', default=num_threads)
|
help='set -j for make', default=num_threads)
|
||||||
|
parser.add_option('--ispc-build-compiler', dest='ispc_build_compiler',
|
||||||
|
help='set compiler to build ispc binary (clang/gcc)', default="clang")
|
||||||
# options for activity "build LLVM"
|
# options for activity "build LLVM"
|
||||||
llvm_group = OptionGroup(parser, "Options for building LLVM",
|
llvm_group = OptionGroup(parser, "Options for building LLVM",
|
||||||
"These options must be used with -b option.")
|
"These options must be used with -b option.")
|
||||||
llvm_group.add_option('--version', dest='version',
|
llvm_group.add_option('--version', dest='version',
|
||||||
help='version of llvm to build: 3.1 3.2 3.3 3.4 trunk. Default: trunk', default="trunk")
|
help='version of llvm to build: 3.2 3.3 3.4 3.5 trunk. Default: trunk', default="trunk")
|
||||||
llvm_group.add_option('--revision', dest='revision',
|
llvm_group.add_option('--revision', dest='revision',
|
||||||
help='revision of llvm to build in format r172870', default="")
|
help='revision of llvm to build in format r172870', default="")
|
||||||
llvm_group.add_option('--debug', dest='debug',
|
llvm_group.add_option('--debug', dest='debug',
|
||||||
@@ -782,7 +895,7 @@ if __name__ == '__main__':
|
|||||||
run_group.add_option('--only', dest='only',
|
run_group.add_option('--only', dest='only',
|
||||||
help='set types of tests. Possible values:\n' +
|
help='set types of tests. Possible values:\n' +
|
||||||
'-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' +
|
'-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' +
|
||||||
'build (only build with different LLVM), 3.1, 3.2, 3.3, 3.4, trunk, native (do not use SDE), current (do not rebuild ISPC).',
|
'build (only build with different LLVM), 3.2, 3.3, 3.4 3.5, trunk, native (do not use SDE), current (do not rebuild ISPC).',
|
||||||
default="")
|
default="")
|
||||||
run_group.add_option('--perf_LLVM', dest='perf_llvm',
|
run_group.add_option('--perf_LLVM', dest='perf_llvm',
|
||||||
help='compare LLVM 3.3 with "--compare-with", default trunk', default=False, action='store_true')
|
help='compare LLVM 3.3 with "--compare-with", default trunk', default=False, action='store_true')
|
||||||
|
|||||||
11
builtins.cpp
11
builtins.cpp
@@ -50,7 +50,7 @@
|
|||||||
#if defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Attributes.h>
|
#include <llvm/Attributes.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/LLVMContext.h>
|
#include <llvm/LLVMContext.h>
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
#include <llvm/IR/Intrinsics.h>
|
#include <llvm/IR/Intrinsics.h>
|
||||||
#include <llvm/IR/DerivedTypes.h>
|
#include <llvm/IR/DerivedTypes.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/Linker/Linker.h>
|
#include <llvm/Linker/Linker.h>
|
||||||
#else
|
#else
|
||||||
#include <llvm/Linker.h>
|
#include <llvm/Linker.h>
|
||||||
@@ -781,7 +781,8 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
llvm::Module *module, SymbolTable *symbolTable) {
|
llvm::Module *module, SymbolTable *symbolTable) {
|
||||||
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
|
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
|
||||||
llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb);
|
llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb);
|
||||||
#if defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
llvm::ErrorOr<llvm::Module *> ModuleOrErr = llvm::parseBitcodeFile(bcBuf, *g->ctx);
|
llvm::ErrorOr<llvm::Module *> ModuleOrErr = llvm::parseBitcodeFile(bcBuf, *g->ctx);
|
||||||
if (std::error_code EC = ModuleOrErr.getError())
|
if (std::error_code EC = ModuleOrErr.getError())
|
||||||
Error(SourcePos(), "Error parsing stdlib bitcode: %s", EC.message().c_str());
|
Error(SourcePos(), "Error parsing stdlib bitcode: %s", EC.message().c_str());
|
||||||
@@ -841,7 +842,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
// architecture and investigate what happened.
|
// architecture and investigate what happened.
|
||||||
// Generally we allow library DataLayout to be subset of module
|
// Generally we allow library DataLayout to be subset of module
|
||||||
// DataLayout or library DataLayout to be empty.
|
// DataLayout or library DataLayout to be empty.
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (!VerifyDataLayoutCompatibility(module->getDataLayoutStr(),
|
if (!VerifyDataLayoutCompatibility(module->getDataLayoutStr(),
|
||||||
bcModule->getDataLayoutStr())) {
|
bcModule->getDataLayoutStr())) {
|
||||||
Warning(SourcePos(), "Module DataLayout is incompatible with "
|
Warning(SourcePos(), "Module DataLayout is incompatible with "
|
||||||
@@ -932,7 +933,7 @@ lDefineConstantIntFunc(const char *name, int val, llvm::Module *module,
|
|||||||
Assert(func != NULL); // it should be declared already...
|
Assert(func != NULL); // it should be declared already...
|
||||||
#if defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
func->addFnAttr(llvm::Attributes::AlwaysInline);
|
func->addFnAttr(llvm::Attributes::AlwaysInline);
|
||||||
#else // LLVM 3.1 and 3.3+
|
#else // LLVM 3.3+
|
||||||
func->addFnAttr(llvm::Attribute::AlwaysInline);
|
func->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||||
#endif
|
#endif
|
||||||
llvm::BasicBlock *bblock = llvm::BasicBlock::Create(*g->ctx, "entry", func, 0);
|
llvm::BasicBlock *bblock = llvm::BasicBlock::Create(*g->ctx, "entry", func, 0);
|
||||||
|
|||||||
@@ -46,8 +46,6 @@
|
|||||||
;; corresponding to one of the Target::ISA enumerant values that gives the
|
;; corresponding to one of the Target::ISA enumerant values that gives the
|
||||||
;; most capable ISA that the curremt system can run.
|
;; most capable ISA that the curremt system can run.
|
||||||
;;
|
;;
|
||||||
;; Note: clang from LLVM 3.1 should be used if this is updated, for maximum
|
|
||||||
;; backwards compatibility for anyone building ispc with LLVM 3.1
|
|
||||||
;;
|
;;
|
||||||
;; #include <stdint.h>
|
;; #include <stdint.h>
|
||||||
;; #include <stdlib.h>
|
;; #include <stdlib.h>
|
||||||
|
|||||||
@@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
include(`target-avx1-i64x4base.ll')
|
include(`target-avx1-i64x4base.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
rdrand_definition()
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; int min/max
|
;; int min/max
|
||||||
|
|||||||
@@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
include(`target-avx-x2.ll')
|
include(`target-avx-x2.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `rdrand_decls()',
|
rdrand_definition()
|
||||||
LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; int min/max
|
;; int min/max
|
||||||
@@ -75,9 +73,6 @@ gen_gather(double)
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; float/half conversions
|
;; float/half conversions
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
;; nothing to define...
|
|
||||||
', `
|
|
||||||
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
||||||
; 0 is round nearest even
|
; 0 is round nearest even
|
||||||
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
||||||
@@ -128,5 +123,3 @@ define i16 @__float_to_half_uniform(float %v) nounwind readnone {
|
|||||||
%r = extractelement <8 x i16> %rv, i32 0
|
%r = extractelement <8 x i16> %rv, i32 0
|
||||||
ret i16 %r
|
ret i16 %r
|
||||||
}
|
}
|
||||||
'
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -31,10 +31,7 @@
|
|||||||
|
|
||||||
include(`target-avx.ll')
|
include(`target-avx.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `rdrand_decls()',
|
rdrand_definition()
|
||||||
LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
saturation_arithmetic()
|
saturation_arithmetic()
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -77,9 +74,6 @@ gen_gather(double)
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; float/half conversions
|
;; float/half conversions
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
;; nothing to define...
|
|
||||||
', `
|
|
||||||
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
||||||
; 0 is round nearest even
|
; 0 is round nearest even
|
||||||
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
||||||
@@ -114,4 +108,3 @@ define i16 @__float_to_half_uniform(float %v) nounwind readnone {
|
|||||||
%r = extractelement <8 x i16> %rv, i32 0
|
%r = extractelement <8 x i16> %rv, i32 0
|
||||||
ret i16 %r
|
ret i16 %r
|
||||||
}
|
}
|
||||||
')
|
|
||||||
|
|||||||
@@ -29,13 +29,11 @@
|
|||||||
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_1', `',
|
define(`HAVE_GATHER', `1')
|
||||||
`define(`HAVE_GATHER', `1')')
|
|
||||||
|
|
||||||
include(`target-avx1-i64x4base.ll')
|
include(`target-avx1-i64x4base.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
rdrand_definition()
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; int min/max
|
;; int min/max
|
||||||
@@ -126,15 +124,6 @@ define i16 @__float_to_half_uniform(float %v) nounwind readnone {
|
|||||||
|
|
||||||
declare void @llvm.trap() noreturn nounwind
|
declare void @llvm.trap() noreturn nounwind
|
||||||
|
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_1', `
|
|
||||||
gen_gather_factored(i8)
|
|
||||||
gen_gather_factored(i16)
|
|
||||||
gen_gather_factored(i32)
|
|
||||||
gen_gather_factored(float)
|
|
||||||
gen_gather_factored(i64)
|
|
||||||
gen_gather_factored(double)', `
|
|
||||||
|
|
||||||
gen_gather(i8)
|
gen_gather(i8)
|
||||||
gen_gather(i16)
|
gen_gather(i16)
|
||||||
|
|
||||||
@@ -351,5 +340,3 @@ define <4 x double> @__gather64_double(<4 x i64> %ptrs,
|
|||||||
|
|
||||||
ret <4 x double> %v
|
ret <4 x double> %v
|
||||||
}
|
}
|
||||||
|
|
||||||
')
|
|
||||||
|
|||||||
@@ -29,15 +29,11 @@
|
|||||||
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `',
|
define(`HAVE_GATHER', `1')
|
||||||
LLVM_VERSION, `LLVM_3_1', `',
|
|
||||||
`define(`HAVE_GATHER', `1')')
|
|
||||||
|
|
||||||
include(`target-avx-x2.ll')
|
include(`target-avx-x2.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `rdrand_decls()',
|
rdrand_definition()
|
||||||
LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; int min/max
|
;; int min/max
|
||||||
@@ -74,9 +70,6 @@ define <16 x i32> @__max_varying_uint32(<16 x i32>, <16 x i32>) nounwind readonl
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; float/half conversions
|
;; float/half conversions
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
;; nothing to define...
|
|
||||||
', `
|
|
||||||
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
||||||
; 0 is round nearest even
|
; 0 is round nearest even
|
||||||
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
||||||
@@ -127,7 +120,7 @@ define i16 @__float_to_half_uniform(float %v) nounwind readnone {
|
|||||||
%r = extractelement <8 x i16> %rv, i32 0
|
%r = extractelement <8 x i16> %rv, i32 0
|
||||||
ret i16 %r
|
ret i16 %r
|
||||||
}
|
}
|
||||||
')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; gather
|
;; gather
|
||||||
@@ -176,20 +169,6 @@ define(`assemble_4s', `
|
|||||||
assemble_8s($1, $2, $2_1, $2_2)
|
assemble_8s($1, $2, $2_1, $2_2)
|
||||||
')
|
')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
gen_gather_factored(i8)
|
|
||||||
gen_gather_factored(i16)
|
|
||||||
gen_gather_factored(i32)
|
|
||||||
gen_gather_factored(float)
|
|
||||||
gen_gather_factored(i64)
|
|
||||||
gen_gather_factored(double)',
|
|
||||||
LLVM_VERSION, `LLVM_3_1', `
|
|
||||||
gen_gather_factored(i8)
|
|
||||||
gen_gather_factored(i16)
|
|
||||||
gen_gather_factored(i32)
|
|
||||||
gen_gather_factored(float)
|
|
||||||
gen_gather_factored(i64)
|
|
||||||
gen_gather_factored(double)', `
|
|
||||||
|
|
||||||
gen_gather(i8)
|
gen_gather(i8)
|
||||||
gen_gather(i16)
|
gen_gather(i16)
|
||||||
@@ -557,5 +536,3 @@ define <16 x double> @__gather64_double(<16 x i64> %ptrs,
|
|||||||
|
|
||||||
ret <16 x double> %v
|
ret <16 x double> %v
|
||||||
}
|
}
|
||||||
|
|
||||||
')
|
|
||||||
|
|||||||
@@ -29,16 +29,11 @@
|
|||||||
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `',
|
define(`HAVE_GATHER', `1')
|
||||||
LLVM_VERSION, `LLVM_3_1', `',
|
|
||||||
`define(`HAVE_GATHER', `1')')
|
|
||||||
|
|
||||||
include(`target-avx.ll')
|
include(`target-avx.ll')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `rdrand_decls()',
|
rdrand_definition()
|
||||||
LLVM_VERSION, `LLVM_3_1', `rdrand_decls()',
|
|
||||||
`rdrand_definition()')
|
|
||||||
|
|
||||||
saturation_arithmetic()
|
saturation_arithmetic()
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -76,9 +71,6 @@ define <8 x i32> @__max_varying_uint32(<8 x i32>, <8 x i32>) nounwind readonly a
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; float/half conversions
|
;; float/half conversions
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
;; nothing to define...
|
|
||||||
', `
|
|
||||||
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readnone
|
||||||
; 0 is round nearest even
|
; 0 is round nearest even
|
||||||
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readnone
|
||||||
@@ -113,7 +105,6 @@ define i16 @__float_to_half_uniform(float %v) nounwind readnone {
|
|||||||
%r = extractelement <8 x i16> %rv, i32 0
|
%r = extractelement <8 x i16> %rv, i32 0
|
||||||
ret i16 %r
|
ret i16 %r
|
||||||
}
|
}
|
||||||
')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; gather
|
;; gather
|
||||||
@@ -125,21 +116,6 @@ define(`extract_4s', `
|
|||||||
%$2_2 = shufflevector <8 x $1> %$2, <8 x $1> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
|
%$2_2 = shufflevector <8 x $1> %$2, <8 x $1> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
|
||||||
')
|
')
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
gen_gather_factored(i8)
|
|
||||||
gen_gather_factored(i16)
|
|
||||||
gen_gather_factored(i32)
|
|
||||||
gen_gather_factored(float)
|
|
||||||
gen_gather_factored(i64)
|
|
||||||
gen_gather_factored(double)',
|
|
||||||
LLVM_VERSION, `LLVM_3_1', `
|
|
||||||
gen_gather_factored(i8)
|
|
||||||
gen_gather_factored(i16)
|
|
||||||
gen_gather_factored(i32)
|
|
||||||
gen_gather_factored(float)
|
|
||||||
gen_gather_factored(i64)
|
|
||||||
gen_gather_factored(double)', `
|
|
||||||
|
|
||||||
gen_gather(i8)
|
gen_gather(i8)
|
||||||
gen_gather(i16)
|
gen_gather(i16)
|
||||||
|
|
||||||
@@ -431,5 +407,3 @@ define <8 x double> @__gather64_double(<8 x i64> %ptrs,
|
|||||||
|
|
||||||
ret <8 x double> %v
|
ret <8 x double> %v
|
||||||
}
|
}
|
||||||
|
|
||||||
')
|
|
||||||
|
|||||||
@@ -275,20 +275,7 @@ declare void @__masked_store_i64(<WIDTH x i64>* nocapture, <WIDTH x i64>,
|
|||||||
declare void @__masked_store_double(<WIDTH x double>* nocapture, <WIDTH x double>,
|
declare void @__masked_store_double(<WIDTH x double>* nocapture, <WIDTH x double>,
|
||||||
<WIDTH x i1> %mask) nounwind
|
<WIDTH x i1> %mask) nounwind
|
||||||
|
|
||||||
ifelse(LLVM_VERSION, `LLVM_3_0', `
|
|
||||||
declare void @__masked_store_blend_i8(<WIDTH x i8>* nocapture, <WIDTH x i8>,
|
|
||||||
<WIDTH x i1>) nounwind
|
|
||||||
declare void @__masked_store_blend_i16(<WIDTH x i16>* nocapture, <WIDTH x i16>,
|
|
||||||
<WIDTH x i1>) nounwind
|
|
||||||
declare void @__masked_store_blend_i32(<WIDTH x i32>* nocapture, <WIDTH x i32>,
|
|
||||||
<WIDTH x i1>) nounwind
|
|
||||||
declare void @__masked_store_blend_float(<WIDTH x float>* nocapture, <WIDTH x float>,
|
|
||||||
<WIDTH x i1>) nounwind
|
|
||||||
declare void @__masked_store_blend_i64(<WIDTH x i64>* nocapture, <WIDTH x i64>,
|
|
||||||
<WIDTH x i1> %mask) nounwind
|
|
||||||
declare void @__masked_store_blend_double(<WIDTH x double>* nocapture, <WIDTH x double>,
|
|
||||||
<WIDTH x i1> %mask) nounwind
|
|
||||||
', `
|
|
||||||
define void @__masked_store_blend_i8(<WIDTH x i8>* nocapture, <WIDTH x i8>,
|
define void @__masked_store_blend_i8(<WIDTH x i8>* nocapture, <WIDTH x i8>,
|
||||||
<WIDTH x i1>) nounwind alwaysinline {
|
<WIDTH x i1>) nounwind alwaysinline {
|
||||||
%v = load <WIDTH x i8> * %0
|
%v = load <WIDTH x i8> * %0
|
||||||
@@ -336,7 +323,6 @@ define void @__masked_store_blend_double(<WIDTH x double>* nocapture,
|
|||||||
store <WIDTH x double> %v1, <WIDTH x double> * %0
|
store <WIDTH x double> %v1, <WIDTH x double> * %0
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
')
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; gather/scatter
|
;; gather/scatter
|
||||||
|
|||||||
146
builtins/util.m4
146
builtins/util.m4
@@ -1497,13 +1497,17 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
|
|||||||
per_lane($1, <$1 x MASK> %mask, `
|
per_lane($1, <$1 x MASK> %mask, `
|
||||||
%cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE
|
%cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE
|
||||||
%val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE
|
%val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE
|
||||||
|
|
||||||
|
;; 3.5 and 3.6 code is the same since m4 has no OR and AND operators
|
||||||
ifelse(LLVM_VERSION,LLVM_3_5,`
|
ifelse(LLVM_VERSION,LLVM_3_5,`
|
||||||
%r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
|
%r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
|
||||||
%r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0
|
%r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0
|
||||||
|
',LLVM_VERSION,LLVM_3_6,`
|
||||||
|
%r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
|
||||||
|
%r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0
|
||||||
',`
|
',`
|
||||||
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst
|
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst
|
||||||
')
|
')
|
||||||
|
|
||||||
%rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE
|
%rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE
|
||||||
store $2 %r_LANE_ID, $2 * %rp_LANE_ID')
|
store $2 %r_LANE_ID, $2 * %rp_LANE_ID')
|
||||||
|
|
||||||
@@ -1513,9 +1517,13 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
|
|||||||
|
|
||||||
define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp,
|
define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp,
|
||||||
$2 %val) nounwind alwaysinline {
|
$2 %val) nounwind alwaysinline {
|
||||||
|
;; 3.5 and 3.6 code is the same since m4 has no OR and AND operators
|
||||||
ifelse(LLVM_VERSION,LLVM_3_5,`
|
ifelse(LLVM_VERSION,LLVM_3_5,`
|
||||||
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
|
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
|
||||||
%r = extractvalue { $2, i1 } %r_t, 0
|
%r = extractvalue { $2, i1 } %r_t, 0
|
||||||
|
',LLVM_VERSION,LLVM_3_6,`
|
||||||
|
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
|
||||||
|
%r = extractvalue { $2, i1 } %r_t, 0
|
||||||
',`
|
',`
|
||||||
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst
|
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst
|
||||||
')
|
')
|
||||||
@@ -3914,23 +3922,10 @@ define(`masked_store_blend_8_16_by_4', `
|
|||||||
define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
||||||
<4 x i32>) nounwind alwaysinline {
|
<4 x i32>) nounwind alwaysinline {
|
||||||
%old = load <4 x i8> * %0, align 1
|
%old = load <4 x i8> * %0, align 1
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old32 = bitcast <4 x i8> %old to i32
|
|
||||||
%new32 = bitcast <4 x i8> %1 to i32
|
|
||||||
|
|
||||||
%mask8 = trunc <4 x i32> %2 to <4 x i8>
|
%m = trunc <4 x i32> %2 to <4 x i1>
|
||||||
%mask32 = bitcast <4 x i8> %mask8 to i32
|
%resultvec = select <4 x i1> %m, <4 x i8> %1, <4 x i8> %old
|
||||||
%notmask32 = xor i32 %mask32, -1
|
|
||||||
|
|
||||||
%newmasked = and i32 %new32, %mask32
|
|
||||||
%oldmasked = and i32 %old32, %notmask32
|
|
||||||
%result = or i32 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i32 %result to <4 x i8>
|
|
||||||
',`
|
|
||||||
%m = trunc <4 x i32> %2 to <4 x i1>
|
|
||||||
%resultvec = select <4 x i1> %m, <4 x i8> %1, <4 x i8> %old
|
|
||||||
')
|
|
||||||
store <4 x i8> %resultvec, <4 x i8> * %0, align 1
|
store <4 x i8> %resultvec, <4 x i8> * %0, align 1
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -3938,23 +3933,10 @@ define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
|||||||
define void @__masked_store_blend_i16(<4 x i16>* nocapture, <4 x i16>,
|
define void @__masked_store_blend_i16(<4 x i16>* nocapture, <4 x i16>,
|
||||||
<4 x i32>) nounwind alwaysinline {
|
<4 x i32>) nounwind alwaysinline {
|
||||||
%old = load <4 x i16> * %0, align 2
|
%old = load <4 x i16> * %0, align 2
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old64 = bitcast <4 x i16> %old to i64
|
|
||||||
%new64 = bitcast <4 x i16> %1 to i64
|
|
||||||
|
|
||||||
%mask16 = trunc <4 x i32> %2 to <4 x i16>
|
%m = trunc <4 x i32> %2 to <4 x i1>
|
||||||
%mask64 = bitcast <4 x i16> %mask16 to i64
|
%resultvec = select <4 x i1> %m, <4 x i16> %1, <4 x i16> %old
|
||||||
%notmask64 = xor i64 %mask64, -1
|
|
||||||
|
|
||||||
%newmasked = and i64 %new64, %mask64
|
|
||||||
%oldmasked = and i64 %old64, %notmask64
|
|
||||||
%result = or i64 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i64 %result to <4 x i16>
|
|
||||||
',`
|
|
||||||
%m = trunc <4 x i32> %2 to <4 x i1>
|
|
||||||
%resultvec = select <4 x i1> %m, <4 x i16> %1, <4 x i16> %old
|
|
||||||
')
|
|
||||||
store <4 x i16> %resultvec, <4 x i16> * %0, align 2
|
store <4 x i16> %resultvec, <4 x i16> * %0, align 2
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -3964,23 +3946,10 @@ define(`masked_store_blend_8_16_by_4_mask64', `
|
|||||||
define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
||||||
<4 x i64>) nounwind alwaysinline {
|
<4 x i64>) nounwind alwaysinline {
|
||||||
%old = load <4 x i8> * %0, align 1
|
%old = load <4 x i8> * %0, align 1
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old32 = bitcast <4 x i8> %old to i32
|
|
||||||
%new32 = bitcast <4 x i8> %1 to i32
|
|
||||||
|
|
||||||
%mask8 = trunc <4 x i64> %2 to <4 x i8>
|
%m = trunc <4 x i64> %2 to <4 x i1>
|
||||||
%mask32 = bitcast <4 x i8> %mask8 to i32
|
%resultvec = select <4 x i1> %m, <4 x i8> %1, <4 x i8> %old
|
||||||
%notmask32 = xor i32 %mask32, -1
|
|
||||||
|
|
||||||
%newmasked = and i32 %new32, %mask32
|
|
||||||
%oldmasked = and i32 %old32, %notmask32
|
|
||||||
%result = or i32 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i32 %result to <4 x i8>
|
|
||||||
',`
|
|
||||||
%m = trunc <4 x i64> %2 to <4 x i1>
|
|
||||||
%resultvec = select <4 x i1> %m, <4 x i8> %1, <4 x i8> %old
|
|
||||||
')
|
|
||||||
store <4 x i8> %resultvec, <4 x i8> * %0, align 1
|
store <4 x i8> %resultvec, <4 x i8> * %0, align 1
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -3988,23 +3957,10 @@ define void @__masked_store_blend_i8(<4 x i8>* nocapture, <4 x i8>,
|
|||||||
define void @__masked_store_blend_i16(<4 x i16>* nocapture, <4 x i16>,
|
define void @__masked_store_blend_i16(<4 x i16>* nocapture, <4 x i16>,
|
||||||
<4 x i64>) nounwind alwaysinline {
|
<4 x i64>) nounwind alwaysinline {
|
||||||
%old = load <4 x i16> * %0, align 2
|
%old = load <4 x i16> * %0, align 2
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old64 = bitcast <4 x i16> %old to i64
|
|
||||||
%new64 = bitcast <4 x i16> %1 to i64
|
|
||||||
|
|
||||||
%mask16 = trunc <4 x i64> %2 to <4 x i16>
|
%m = trunc <4 x i64> %2 to <4 x i1>
|
||||||
%mask64 = bitcast <4 x i16> %mask16 to i64
|
%resultvec = select <4 x i1> %m, <4 x i16> %1, <4 x i16> %old
|
||||||
%notmask64 = xor i64 %mask64, -1
|
|
||||||
|
|
||||||
%newmasked = and i64 %new64, %mask64
|
|
||||||
%oldmasked = and i64 %old64, %notmask64
|
|
||||||
%result = or i64 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i64 %result to <4 x i16>
|
|
||||||
',`
|
|
||||||
%m = trunc <4 x i64> %2 to <4 x i1>
|
|
||||||
%resultvec = select <4 x i1> %m, <4 x i16> %1, <4 x i16> %old
|
|
||||||
')
|
|
||||||
store <4 x i16> %resultvec, <4 x i16> * %0, align 2
|
store <4 x i16> %resultvec, <4 x i16> * %0, align 2
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -4014,23 +3970,10 @@ define(`masked_store_blend_8_16_by_8', `
|
|||||||
define void @__masked_store_blend_i8(<8 x i8>* nocapture, <8 x i8>,
|
define void @__masked_store_blend_i8(<8 x i8>* nocapture, <8 x i8>,
|
||||||
<8 x i32>) nounwind alwaysinline {
|
<8 x i32>) nounwind alwaysinline {
|
||||||
%old = load <8 x i8> * %0, align 1
|
%old = load <8 x i8> * %0, align 1
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old64 = bitcast <8 x i8> %old to i64
|
|
||||||
%new64 = bitcast <8 x i8> %1 to i64
|
|
||||||
|
|
||||||
%mask8 = trunc <8 x i32> %2 to <8 x i8>
|
%m = trunc <8 x i32> %2 to <8 x i1>
|
||||||
%mask64 = bitcast <8 x i8> %mask8 to i64
|
%resultvec = select <8 x i1> %m, <8 x i8> %1, <8 x i8> %old
|
||||||
%notmask64 = xor i64 %mask64, -1
|
|
||||||
|
|
||||||
%newmasked = and i64 %new64, %mask64
|
|
||||||
%oldmasked = and i64 %old64, %notmask64
|
|
||||||
%result = or i64 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i64 %result to <8 x i8>
|
|
||||||
',`
|
|
||||||
%m = trunc <8 x i32> %2 to <8 x i1>
|
|
||||||
%resultvec = select <8 x i1> %m, <8 x i8> %1, <8 x i8> %old
|
|
||||||
')
|
|
||||||
store <8 x i8> %resultvec, <8 x i8> * %0, align 1
|
store <8 x i8> %resultvec, <8 x i8> * %0, align 1
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -4038,23 +3981,10 @@ define void @__masked_store_blend_i8(<8 x i8>* nocapture, <8 x i8>,
|
|||||||
define void @__masked_store_blend_i16(<8 x i16>* nocapture, <8 x i16>,
|
define void @__masked_store_blend_i16(<8 x i16>* nocapture, <8 x i16>,
|
||||||
<8 x i32>) nounwind alwaysinline {
|
<8 x i32>) nounwind alwaysinline {
|
||||||
%old = load <8 x i16> * %0, align 2
|
%old = load <8 x i16> * %0, align 2
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old128 = bitcast <8 x i16> %old to i128
|
|
||||||
%new128 = bitcast <8 x i16> %1 to i128
|
|
||||||
|
|
||||||
%mask16 = trunc <8 x i32> %2 to <8 x i16>
|
%m = trunc <8 x i32> %2 to <8 x i1>
|
||||||
%mask128 = bitcast <8 x i16> %mask16 to i128
|
%resultvec = select <8 x i1> %m, <8 x i16> %1, <8 x i16> %old
|
||||||
%notmask128 = xor i128 %mask128, -1
|
|
||||||
|
|
||||||
%newmasked = and i128 %new128, %mask128
|
|
||||||
%oldmasked = and i128 %old128, %notmask128
|
|
||||||
%result = or i128 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i128 %result to <8 x i16>
|
|
||||||
',`
|
|
||||||
%m = trunc <8 x i32> %2 to <8 x i1>
|
|
||||||
%resultvec = select <8 x i1> %m, <8 x i16> %1, <8 x i16> %old
|
|
||||||
')
|
|
||||||
store <8 x i16> %resultvec, <8 x i16> * %0, align 2
|
store <8 x i16> %resultvec, <8 x i16> * %0, align 2
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -4065,23 +3995,10 @@ define(`masked_store_blend_8_16_by_16', `
|
|||||||
define void @__masked_store_blend_i8(<16 x i8>* nocapture, <16 x i8>,
|
define void @__masked_store_blend_i8(<16 x i8>* nocapture, <16 x i8>,
|
||||||
<16 x i32>) nounwind alwaysinline {
|
<16 x i32>) nounwind alwaysinline {
|
||||||
%old = load <16 x i8> * %0, align 1
|
%old = load <16 x i8> * %0, align 1
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old128 = bitcast <16 x i8> %old to i128
|
|
||||||
%new128 = bitcast <16 x i8> %1 to i128
|
|
||||||
|
|
||||||
%mask8 = trunc <16 x i32> %2 to <16 x i8>
|
%m = trunc <16 x i32> %2 to <16 x i1>
|
||||||
%mask128 = bitcast <16 x i8> %mask8 to i128
|
%resultvec = select <16 x i1> %m, <16 x i8> %1, <16 x i8> %old
|
||||||
%notmask128 = xor i128 %mask128, -1
|
|
||||||
|
|
||||||
%newmasked = and i128 %new128, %mask128
|
|
||||||
%oldmasked = and i128 %old128, %notmask128
|
|
||||||
%result = or i128 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i128 %result to <16 x i8>
|
|
||||||
',`
|
|
||||||
%m = trunc <16 x i32> %2 to <16 x i1>
|
|
||||||
%resultvec = select <16 x i1> %m, <16 x i8> %1, <16 x i8> %old
|
|
||||||
')
|
|
||||||
store <16 x i8> %resultvec, <16 x i8> * %0, align 1
|
store <16 x i8> %resultvec, <16 x i8> * %0, align 1
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
@@ -4089,23 +4006,10 @@ define void @__masked_store_blend_i8(<16 x i8>* nocapture, <16 x i8>,
|
|||||||
define void @__masked_store_blend_i16(<16 x i16>* nocapture, <16 x i16>,
|
define void @__masked_store_blend_i16(<16 x i16>* nocapture, <16 x i16>,
|
||||||
<16 x i32>) nounwind alwaysinline {
|
<16 x i32>) nounwind alwaysinline {
|
||||||
%old = load <16 x i16> * %0, align 2
|
%old = load <16 x i16> * %0, align 2
|
||||||
ifelse(LLVM_VERSION,LLVM_3_0,`
|
|
||||||
%old256 = bitcast <16 x i16> %old to i256
|
|
||||||
%new256 = bitcast <16 x i16> %1 to i256
|
|
||||||
|
|
||||||
%mask16 = trunc <16 x i32> %2 to <16 x i16>
|
%m = trunc <16 x i32> %2 to <16 x i1>
|
||||||
%mask256 = bitcast <16 x i16> %mask16 to i256
|
%resultvec = select <16 x i1> %m, <16 x i16> %1, <16 x i16> %old
|
||||||
%notmask256 = xor i256 %mask256, -1
|
|
||||||
|
|
||||||
%newmasked = and i256 %new256, %mask256
|
|
||||||
%oldmasked = and i256 %old256, %notmask256
|
|
||||||
%result = or i256 %newmasked, %oldmasked
|
|
||||||
|
|
||||||
%resultvec = bitcast i256 %result to <16 x i16>
|
|
||||||
',`
|
|
||||||
%m = trunc <16 x i32> %2 to <16 x i1>
|
|
||||||
%resultvec = select <16 x i1> %m, <16 x i16> %1, <16 x i16> %old
|
|
||||||
')
|
|
||||||
store <16 x i16> %resultvec, <16 x i16> * %0, align 2
|
store <16 x i16> %resultvec, <16 x i16> * %0, align 2
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|||||||
145
cbackend.cpp
145
cbackend.cpp
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "llvmutil.h"
|
#include "llvmutil.h"
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/CallingConv.h"
|
#include "llvm/CallingConv.h"
|
||||||
@@ -50,20 +50,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#if !defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
#if defined(LLVM_3_2)
|
#include "llvm/TypeFinder.h"
|
||||||
#include "llvm/TypeFinder.h"
|
#else // LLVM_3_3 +
|
||||||
#else // LLVM_3_3 +
|
#include "llvm/IR/TypeFinder.h"
|
||||||
#include "llvm/IR/TypeFinder.h"
|
#endif
|
||||||
#endif
|
|
||||||
#endif // LLVM_3_2 +
|
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Analysis/ConstantsScanner.h"
|
#include "llvm/Analysis/ConstantsScanner.h"
|
||||||
#include "llvm/Analysis/FindUsedTypes.h"
|
#include "llvm/Analysis/FindUsedTypes.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
#include "llvm/IR/Verifier.h"
|
#include "llvm/IR/Verifier.h"
|
||||||
#include <llvm/IR/IRPrintingPasses.h>
|
#include <llvm/IR/IRPrintingPasses.h>
|
||||||
#include "llvm/IR/CallSite.h"
|
#include "llvm/IR/CallSite.h"
|
||||||
@@ -96,7 +94,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#elif defined (LLVM_3_3) || defined (LLVM_3_4)
|
#elif defined (LLVM_3_3) || defined (LLVM_3_4)
|
||||||
#include "llvm/InstVisitor.h"
|
#include "llvm/InstVisitor.h"
|
||||||
@@ -107,7 +105,10 @@
|
|||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
#include "llvm/Support/Host.h"
|
#include "llvm/Support/Host.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Config/config.h"
|
|
||||||
|
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||||
|
#include "llvm/Config/config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <llvm/Transforms/IPO.h>
|
#include <llvm/Transforms/IPO.h>
|
||||||
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
|
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
|
||||||
@@ -250,7 +251,8 @@ namespace {
|
|||||||
class CBEMCAsmInfo : public llvm::MCAsmInfo {
|
class CBEMCAsmInfo : public llvm::MCAsmInfo {
|
||||||
public:
|
public:
|
||||||
CBEMCAsmInfo() {
|
CBEMCAsmInfo() {
|
||||||
#if !defined(LLVM_3_5)
|
|
||||||
|
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||||
GlobalPrefix = "";
|
GlobalPrefix = "";
|
||||||
#endif
|
#endif
|
||||||
PrivateGlobalPrefix = "";
|
PrivateGlobalPrefix = "";
|
||||||
@@ -269,14 +271,11 @@ namespace {
|
|||||||
const llvm::MCRegisterInfo *MRI;
|
const llvm::MCRegisterInfo *MRI;
|
||||||
const llvm::MCObjectFileInfo *MOFI;
|
const llvm::MCObjectFileInfo *MOFI;
|
||||||
llvm::MCContext *TCtx;
|
llvm::MCContext *TCtx;
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
const llvm::TargetData* TD;
|
|
||||||
#else
|
|
||||||
// FIXME: it's ugly to have the name be "TD" here, but it saves us
|
// FIXME: it's ugly to have the name be "TD" here, but it saves us
|
||||||
// lots of ifdefs in the below since the new DataLayout and the old
|
// lots of ifdefs in the below since the new DataLayout and the old
|
||||||
// TargetData have generally similar interfaces...
|
// TargetData have generally similar interfaces...
|
||||||
const llvm::DataLayout* TD;
|
const llvm::DataLayout* TD;
|
||||||
#endif
|
|
||||||
|
|
||||||
std::map<const llvm::ConstantFP *, unsigned> FPConstantMap;
|
std::map<const llvm::ConstantFP *, unsigned> FPConstantMap;
|
||||||
std::map<const llvm::ConstantDataVector *, unsigned> VectorConstantMap;
|
std::map<const llvm::ConstantDataVector *, unsigned> VectorConstantMap;
|
||||||
@@ -363,7 +362,7 @@ namespace {
|
|||||||
bool isSigned = false,
|
bool isSigned = false,
|
||||||
const std::string &VariableName = "",
|
const std::string &VariableName = "",
|
||||||
bool IgnoreName = false,
|
bool IgnoreName = false,
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL = llvm::AttrListPtr()
|
const llvm::AttrListPtr &PAL = llvm::AttrListPtr()
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL = llvm::AttributeSet()
|
const llvm::AttributeSet &PAL = llvm::AttributeSet()
|
||||||
@@ -374,7 +373,7 @@ namespace {
|
|||||||
const std::string &NameSoFar = "");
|
const std::string &NameSoFar = "");
|
||||||
|
|
||||||
void printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
void printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL,
|
const llvm::AttrListPtr &PAL,
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL,
|
const llvm::AttributeSet &PAL,
|
||||||
@@ -465,7 +464,8 @@ namespace {
|
|||||||
|
|
||||||
// Must not be used in inline asm, extractelement, or shufflevector.
|
// Must not be used in inline asm, extractelement, or shufflevector.
|
||||||
if (I.hasOneUse()) {
|
if (I.hasOneUse()) {
|
||||||
#if defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back());
|
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back());
|
||||||
#else
|
#else
|
||||||
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back());
|
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back());
|
||||||
@@ -477,7 +477,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only inline instruction it if it's use is in the same BB as the inst.
|
// Only inline instruction it if it's use is in the same BB as the inst.
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent();
|
return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent();
|
||||||
#else
|
#else
|
||||||
return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent();
|
return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent();
|
||||||
@@ -613,7 +613,7 @@ std::string CWriter::getArrayName(llvm::ArrayType *AT) {
|
|||||||
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
|
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
|
||||||
/// print it as "Struct (*)(...)", for struct return functions.
|
/// print it as "Struct (*)(...)", for struct return functions.
|
||||||
void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL,
|
const llvm::AttrListPtr &PAL,
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL,
|
const llvm::AttributeSet &PAL,
|
||||||
@@ -632,9 +632,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
|||||||
if (PrintedType)
|
if (PrintedType)
|
||||||
FunctionInnards << ", ";
|
FunctionInnards << ", ";
|
||||||
llvm::Type *ArgTy = *I;
|
llvm::Type *ArgTy = *I;
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||||
#else
|
#else
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||||
@@ -643,9 +641,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
|||||||
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
||||||
}
|
}
|
||||||
printType(FunctionInnards, ArgTy,
|
printType(FunctionInnards, ArgTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||||
@@ -662,9 +658,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
|||||||
}
|
}
|
||||||
FunctionInnards << ')';
|
FunctionInnards << ')';
|
||||||
printType(Out, RetTy,
|
printType(Out, RetTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||||
@@ -764,7 +758,7 @@ CWriter::printSimpleType(llvm::raw_ostream &Out, llvm::Type *Ty, bool isSigned,
|
|||||||
llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
||||||
bool isSigned, const std::string &NameSoFar,
|
bool isSigned, const std::string &NameSoFar,
|
||||||
bool IgnoreName,
|
bool IgnoreName,
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL
|
const llvm::AttrListPtr &PAL
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL
|
const llvm::AttributeSet &PAL
|
||||||
@@ -786,9 +780,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
|||||||
for (llvm::FunctionType::param_iterator I = FTy->param_begin(),
|
for (llvm::FunctionType::param_iterator I = FTy->param_begin(),
|
||||||
E = FTy->param_end(); I != E; ++I) {
|
E = FTy->param_end(); I != E; ++I) {
|
||||||
llvm::Type *ArgTy = *I;
|
llvm::Type *ArgTy = *I;
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||||
#else
|
#else
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||||
@@ -799,9 +791,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
|||||||
if (I != FTy->param_begin())
|
if (I != FTy->param_begin())
|
||||||
FunctionInnards << ", ";
|
FunctionInnards << ", ";
|
||||||
printType(FunctionInnards, ArgTy,
|
printType(FunctionInnards, ArgTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||||
@@ -818,9 +808,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
|||||||
}
|
}
|
||||||
FunctionInnards << ')';
|
FunctionInnards << ')';
|
||||||
printType(Out, FTy->getReturnType(),
|
printType(Out, FTy->getReturnType(),
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||||
@@ -1770,7 +1758,7 @@ std::string CWriter::GetValueName(const llvm::Value *Operand) {
|
|||||||
|
|
||||||
// Resolve potential alias.
|
// Resolve potential alias.
|
||||||
if (const llvm::GlobalAlias *GA = llvm::dyn_cast<llvm::GlobalAlias>(Operand)) {
|
if (const llvm::GlobalAlias *GA = llvm::dyn_cast<llvm::GlobalAlias>(Operand)) {
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
if (const llvm::Value *V = GA->getAliasee())
|
if (const llvm::Value *V = GA->getAliasee())
|
||||||
#else
|
#else
|
||||||
if (const llvm::Value *V = GA->resolveAliasedGlobal(false))
|
if (const llvm::Value *V = GA->resolveAliasedGlobal(false))
|
||||||
@@ -2003,11 +1991,7 @@ void CWriter::writeOperandWithCast(llvm::Value* Operand, const llvm::ICmpInst &C
|
|||||||
// directives to cater to specific compilers as need be.
|
// directives to cater to specific compilers as need be.
|
||||||
//
|
//
|
||||||
static void generateCompilerSpecificCode(llvm::formatted_raw_ostream& Out,
|
static void generateCompilerSpecificCode(llvm::formatted_raw_ostream& Out,
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
const llvm::TargetData *TD) {
|
|
||||||
#else
|
|
||||||
const llvm::DataLayout *TD) {
|
const llvm::DataLayout *TD) {
|
||||||
#endif
|
|
||||||
// We output GCC specific attributes to preserve 'linkonce'ness on globals.
|
// We output GCC specific attributes to preserve 'linkonce'ness on globals.
|
||||||
// If we aren't being compiled with GCC, just drop these attributes.
|
// If we aren't being compiled with GCC, just drop these attributes.
|
||||||
Out << "#ifndef __GNUC__ /* Can only support \"linkonce\" vars with GCC */\n"
|
Out << "#ifndef __GNUC__ /* Can only support \"linkonce\" vars with GCC */\n"
|
||||||
@@ -2163,7 +2147,7 @@ static SpecialGlobalClass getGlobalVariableClass(const llvm::GlobalVariable *GV)
|
|||||||
|
|
||||||
// Otherwise, if it is other metadata, don't print it. This catches things
|
// Otherwise, if it is other metadata, don't print it. This catches things
|
||||||
// like debug information.
|
// like debug information.
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
// Here we compare char *
|
// Here we compare char *
|
||||||
if (!strcmp(GV->getSection(), "llvm.metadata"))
|
if (!strcmp(GV->getSection(), "llvm.metadata"))
|
||||||
#else
|
#else
|
||||||
@@ -2206,11 +2190,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
// Initialize
|
// Initialize
|
||||||
TheModule = &M;
|
TheModule = &M;
|
||||||
|
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
TD = new llvm::TargetData(&M);
|
|
||||||
#else
|
|
||||||
TD = new llvm::DataLayout(&M);
|
TD = new llvm::DataLayout(&M);
|
||||||
#endif
|
|
||||||
IL = new llvm::IntrinsicLowering(*TD);
|
IL = new llvm::IntrinsicLowering(*TD);
|
||||||
IL->AddPrototypes(M);
|
IL->AddPrototypes(M);
|
||||||
|
|
||||||
@@ -2225,7 +2205,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
#endif
|
#endif
|
||||||
TAsm = new CBEMCAsmInfo();
|
TAsm = new CBEMCAsmInfo();
|
||||||
MRI = new llvm::MCRegisterInfo();
|
MRI = new llvm::MCRegisterInfo();
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||||
TCtx = new llvm::MCContext(TAsm, MRI, NULL);
|
TCtx = new llvm::MCContext(TAsm, MRI, NULL);
|
||||||
#else
|
#else
|
||||||
TCtx = new llvm::MCContext(*TAsm, *MRI, NULL);
|
TCtx = new llvm::MCContext(*TAsm, *MRI, NULL);
|
||||||
@@ -2349,7 +2329,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
|
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
|
||||||
I->hasCommonLinkage())
|
I->hasCommonLinkage())
|
||||||
Out << "extern ";
|
Out << "extern ";
|
||||||
#if defined (LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
else if (I->hasDLLImportStorageClass())
|
else if (I->hasDLLImportStorageClass())
|
||||||
#else
|
#else
|
||||||
else if (I->hasDLLImportLinkage())
|
else if (I->hasDLLImportLinkage())
|
||||||
@@ -2525,7 +2505,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
|
|
||||||
if (I->hasLocalLinkage())
|
if (I->hasLocalLinkage())
|
||||||
Out << "static ";
|
Out << "static ";
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||||
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||||
#else
|
#else
|
||||||
@@ -2699,15 +2679,11 @@ void CWriter::printModuleTypes() {
|
|||||||
|
|
||||||
// Get all of the struct types used in the module.
|
// Get all of the struct types used in the module.
|
||||||
std::vector<llvm::StructType*> StructTypes;
|
std::vector<llvm::StructType*> StructTypes;
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
TheModule->findUsedStructTypes(StructTypes);
|
|
||||||
#else
|
|
||||||
llvm::TypeFinder typeFinder;
|
llvm::TypeFinder typeFinder;
|
||||||
typeFinder.run(*TheModule, false);
|
typeFinder.run(*TheModule, false);
|
||||||
for (llvm::TypeFinder::iterator iter = typeFinder.begin();
|
for (llvm::TypeFinder::iterator iter = typeFinder.begin();
|
||||||
iter != typeFinder.end(); ++iter)
|
iter != typeFinder.end(); ++iter)
|
||||||
StructTypes.push_back(*iter);
|
StructTypes.push_back(*iter);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get all of the array types used in the module
|
// Get all of the array types used in the module
|
||||||
std::vector<llvm::ArrayType*> ArrayTypes;
|
std::vector<llvm::ArrayType*> ArrayTypes;
|
||||||
@@ -2810,7 +2786,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
bool isStructReturn = F->hasStructRetAttr();
|
bool isStructReturn = F->hasStructRetAttr();
|
||||||
|
|
||||||
if (F->hasLocalLinkage()) Out << "static ";
|
if (F->hasLocalLinkage()) Out << "static ";
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||||
if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||||
#else
|
#else
|
||||||
@@ -2833,7 +2809,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
|
|
||||||
// Loop over the arguments, printing them...
|
// Loop over the arguments, printing them...
|
||||||
llvm::FunctionType *FT = llvm::cast<llvm::FunctionType>(F->getFunctionType());
|
llvm::FunctionType *FT = llvm::cast<llvm::FunctionType>(F->getFunctionType());
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL = F->getAttributes();
|
const llvm::AttrListPtr &PAL = F->getAttributes();
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL = F->getAttributes();
|
const llvm::AttributeSet &PAL = F->getAttributes();
|
||||||
@@ -2867,9 +2843,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
else
|
else
|
||||||
ArgName = "";
|
ArgName = "";
|
||||||
llvm::Type *ArgTy = I->getType();
|
llvm::Type *ArgTy = I->getType();
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||||
#else
|
#else
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||||
@@ -2878,9 +2852,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
ByValParams.insert(I);
|
ByValParams.insert(I);
|
||||||
}
|
}
|
||||||
printType(FunctionInnards, ArgTy,
|
printType(FunctionInnards, ArgTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||||
@@ -2906,9 +2878,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
for (; I != E; ++I) {
|
for (; I != E; ++I) {
|
||||||
if (PrintedArg) FunctionInnards << ", ";
|
if (PrintedArg) FunctionInnards << ", ";
|
||||||
llvm::Type *ArgTy = *I;
|
llvm::Type *ArgTy = *I;
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||||
#else
|
#else
|
||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||||
@@ -2917,9 +2887,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
||||||
}
|
}
|
||||||
printType(FunctionInnards, ArgTy,
|
printType(FunctionInnards, ArgTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt)
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt)
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt)
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
||||||
@@ -2956,9 +2924,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
|
|
||||||
// Print out the return type and the signature built above.
|
// Print out the return type and the signature built above.
|
||||||
printType(Out, RetTy,
|
printType(Out, RetTy,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||||
@@ -3145,7 +3111,8 @@ void CWriter::visitSwitchInst(llvm::SwitchInst &SI) {
|
|||||||
Out << ":\n";
|
Out << ":\n";
|
||||||
printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
|
printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
|
||||||
printBranchToBlock(SI.getParent(), Succ, 2);
|
printBranchToBlock(SI.getParent(), Succ, 2);
|
||||||
#if defined (LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent())))
|
if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent())))
|
||||||
#else
|
#else
|
||||||
if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent())))
|
if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent())))
|
||||||
@@ -3170,7 +3137,7 @@ bool CWriter::isGotoCodeNecessary(llvm::BasicBlock *From, llvm::BasicBlock *To)
|
|||||||
/// FIXME: This should be reenabled, but loop reordering safe!!
|
/// FIXME: This should be reenabled, but loop reordering safe!!
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if defined (LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||||
#else
|
#else
|
||||||
if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||||
@@ -3775,7 +3742,7 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
|||||||
const char *BuiltinName = "";
|
const char *BuiltinName = "";
|
||||||
#define GET_GCC_BUILTIN_NAME
|
#define GET_GCC_BUILTIN_NAME
|
||||||
#define Intrinsic llvm::Intrinsic
|
#define Intrinsic llvm::Intrinsic
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include "llvm/Intrinsics.gen"
|
#include "llvm/Intrinsics.gen"
|
||||||
#else
|
#else
|
||||||
#include "llvm/IR/Intrinsics.gen"
|
#include "llvm/IR/Intrinsics.gen"
|
||||||
@@ -3788,7 +3755,7 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
|||||||
// All other intrinsic calls we must lower.
|
// All other intrinsic calls we must lower.
|
||||||
llvm::Instruction *Before = 0;
|
llvm::Instruction *Before = 0;
|
||||||
if (CI != &BB->front())
|
if (CI != &BB->front())
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||||
Before = std::prev(llvm::BasicBlock::iterator(CI));
|
Before = std::prev(llvm::BasicBlock::iterator(CI));
|
||||||
#else
|
#else
|
||||||
Before = prior(llvm::BasicBlock::iterator(CI));
|
Before = prior(llvm::BasicBlock::iterator(CI));
|
||||||
@@ -3844,7 +3811,7 @@ void CWriter::visitCallInst(llvm::CallInst &I) {
|
|||||||
|
|
||||||
// If this is a call to a struct-return function, assign to the first
|
// If this is a call to a struct-return function, assign to the first
|
||||||
// parameter instead of passing it to the call.
|
// parameter instead of passing it to the call.
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
const llvm::AttrListPtr &PAL = I.getAttributes();
|
const llvm::AttrListPtr &PAL = I.getAttributes();
|
||||||
#else
|
#else
|
||||||
const llvm::AttributeSet &PAL = I.getAttributes();
|
const llvm::AttributeSet &PAL = I.getAttributes();
|
||||||
@@ -3932,9 +3899,7 @@ void CWriter::visitCallInst(llvm::CallInst &I) {
|
|||||||
(*AI)->getType() != FTy->getParamType(ArgNo)) {
|
(*AI)->getType() != FTy->getParamType(ArgNo)) {
|
||||||
Out << '(';
|
Out << '(';
|
||||||
printType(Out, FTy->getParamType(ArgNo),
|
printType(Out, FTy->getParamType(ArgNo),
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
/*isSigned=*/PAL.paramHasAttr(ArgNo+1, llvm::Attribute::SExt)
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::Attributes::SExt)
|
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::Attributes::SExt)
|
||||||
#else
|
#else
|
||||||
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
||||||
@@ -3972,7 +3937,7 @@ bool CWriter::visitBuiltinCall(llvm::CallInst &I, llvm::Intrinsic::ID ID,
|
|||||||
const char *BuiltinName = "";
|
const char *BuiltinName = "";
|
||||||
#define GET_GCC_BUILTIN_NAME
|
#define GET_GCC_BUILTIN_NAME
|
||||||
#define Intrinsic llvm::Intrinsic
|
#define Intrinsic llvm::Intrinsic
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include "llvm/Intrinsics.gen"
|
#include "llvm/Intrinsics.gen"
|
||||||
#else
|
#else
|
||||||
#include "llvm/IR/Intrinsics.gen"
|
#include "llvm/IR/Intrinsics.gen"
|
||||||
@@ -4625,13 +4590,8 @@ SmearCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
smearType, NULL);
|
smearType, NULL);
|
||||||
smearFunc = llvm::dyn_cast<llvm::Function>(sf);
|
smearFunc = llvm::dyn_cast<llvm::Function>(sf);
|
||||||
assert(smearFunc != NULL);
|
assert(smearFunc != NULL);
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
smearFunc->setDoesNotThrow(true);
|
|
||||||
smearFunc->setDoesNotAccessMemory(true);
|
|
||||||
#else
|
|
||||||
smearFunc->setDoesNotThrow();
|
smearFunc->setDoesNotThrow();
|
||||||
smearFunc->setDoesNotAccessMemory();
|
smearFunc->setDoesNotAccessMemory();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(smearFunc != NULL);
|
assert(smearFunc != NULL);
|
||||||
@@ -4773,13 +4733,8 @@ AndCmpCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
LLVMTypes::MaskType, NULL);
|
LLVMTypes::MaskType, NULL);
|
||||||
andCmpFunc = llvm::dyn_cast<llvm::Function>(acf);
|
andCmpFunc = llvm::dyn_cast<llvm::Function>(acf);
|
||||||
Assert(andCmpFunc != NULL);
|
Assert(andCmpFunc != NULL);
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
andCmpFunc->setDoesNotThrow(true);
|
|
||||||
andCmpFunc->setDoesNotAccessMemory(true);
|
|
||||||
#else
|
|
||||||
andCmpFunc->setDoesNotThrow();
|
andCmpFunc->setDoesNotThrow();
|
||||||
andCmpFunc->setDoesNotAccessMemory();
|
andCmpFunc->setDoesNotAccessMemory();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the function call to the *_and_mask function; the
|
// Set up the function call to the *_and_mask function; the
|
||||||
@@ -4984,7 +4939,7 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
|
|||||||
pm.add(new llvm::TargetData(module));
|
pm.add(new llvm::TargetData(module));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
|
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
#else
|
#else
|
||||||
llvm::sys::fs::OpenFlags flags = llvm::sys::fs::F_None;
|
llvm::sys::fs::OpenFlags flags = llvm::sys::fs::F_None;
|
||||||
@@ -5009,7 +4964,7 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
|
|||||||
pm.add(llvm::createDeadCodeEliminationPass()); // clean up after smear pass
|
pm.add(llvm::createDeadCodeEliminationPass()); // clean up after smear pass
|
||||||
//CO pm.add(llvm::createPrintModulePass(&fos));
|
//CO pm.add(llvm::createPrintModulePass(&fos));
|
||||||
pm.add(new CWriter(fos, includeName, vectorWidth));
|
pm.add(new CWriter(fos, includeName, vectorWidth));
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
// This interface is depricated for 3.3+
|
// This interface is depricated for 3.3+
|
||||||
pm.add(llvm::createGCInfoDeleter());
|
pm.add(llvm::createGCInfoDeleter());
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
378
common.py
378
common.py
@@ -31,28 +31,38 @@
|
|||||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
# // Author: Filippov Ilia
|
# // Author: Filippov Ilia, Anton Mitrokhin, Vsevolod Livinskiy
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import errno
|
import errno
|
||||||
import shutil
|
import shutil
|
||||||
class ExecutionStatGatherer:
|
|
||||||
def __init__(self):
|
|
||||||
optimizations = ['O0', 'O2']
|
|
||||||
architectures = ['x86', 'x86-64']
|
|
||||||
all_est_targets = ['sse2-i32x4', 'sse2-i32x8', 'sse4-i32x4', 'sse4-i32x8', 'sse4-i16x8',
|
|
||||||
'sse4-i8x16', 'avx1-i32x8', 'avx1-i32x16', 'avx1.1-i32x8',
|
|
||||||
'avx1.1-i32x16', 'avx2-i32x8', 'avx2-i32x16', 'generic-x1',
|
|
||||||
'generic-x4', 'generic-x8', 'generic-x16', 'generic-x32',
|
|
||||||
'generic-x64', 'knc']
|
|
||||||
|
|
||||||
|
# generic empty class
|
||||||
|
class EmptyClass(object): pass
|
||||||
|
|
||||||
|
# load/save almost every object to a file (good for bug reproducing)
|
||||||
|
def dump(fname, obj):
|
||||||
|
import pickle
|
||||||
|
with open(fname, 'w') as fp:
|
||||||
|
pickle.dump(obj, fp)
|
||||||
|
|
||||||
|
def undump(fname):
|
||||||
|
import pickle
|
||||||
|
with open(fname, 'r') as fp:
|
||||||
|
obj = pickle.load(fp)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
# retrieve the host name
|
||||||
|
def get_host_name():
|
||||||
|
import socket
|
||||||
|
return socket.gethostname()
|
||||||
|
|
||||||
def write_to_file(filename, line):
|
def write_to_file(filename, line):
|
||||||
f = open(filename, 'a')
|
f = open(filename, 'a')
|
||||||
f.writelines(line)
|
f.writelines(line)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
#remove file if it exists
|
# remove file if it exists
|
||||||
def remove_if_exists(filename):
|
def remove_if_exists(filename):
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
if os.path.isdir(filename):
|
if os.path.isdir(filename):
|
||||||
@@ -144,3 +154,349 @@ def check_tools(m):
|
|||||||
if int(t11[j])>input_tools[t][0][j]:
|
if int(t11[j])>input_tools[t][0][j]:
|
||||||
break
|
break
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# regression testing functionality
|
||||||
|
class TestResult(object):
|
||||||
|
"""
|
||||||
|
this class stores basicly two integers which stand for the result
|
||||||
|
of the test: (runfail{0/1}, compfail{0/1}). other values are
|
||||||
|
deemed invalid. the __cmp__ function of this class is used to
|
||||||
|
define what test regression actually is.
|
||||||
|
"""
|
||||||
|
def __init__(self, runfailed, compfailed):
|
||||||
|
self.runfailed, self.compfailed = (runfailed, compfailed)
|
||||||
|
|
||||||
|
def __cmp__(self, other):
|
||||||
|
if isinstance(other, TestResult):
|
||||||
|
if self.runfailed == other.runfailed and \
|
||||||
|
self.compfailed == other.compfailed:
|
||||||
|
return 0
|
||||||
|
elif self.compfailed > other.compfailed:
|
||||||
|
return 1
|
||||||
|
elif self.runfailed > other.runfailed and \
|
||||||
|
self.compfailed == other.compfailed:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return -1
|
||||||
|
|
||||||
|
raise RuntimeError("Wrong type for comparioson")
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
if (self.runfailed < 0 or self.compfailed < 0):
|
||||||
|
return "(Undefined)"
|
||||||
|
return "(r%d c%d)" % (self.runfailed, self.compfailed)
|
||||||
|
|
||||||
|
|
||||||
|
class TestCase(object):
|
||||||
|
"""
|
||||||
|
the TestCase() is a combination of parameters the tast was run with:
|
||||||
|
the architecture (x86, x86-64 ...), compiler optimization (-O0, -O2 ...)
|
||||||
|
and target (sse, avx ...). we also store the result of the test here.
|
||||||
|
"""
|
||||||
|
def __init__(self, arch, opt, target):
|
||||||
|
self.arch, self.opt, self.target = (arch, opt, target)
|
||||||
|
self.result = TestResult(-1, -1)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = "%s %s %s: " % (self.arch, self.opt, self.target)
|
||||||
|
string = string + repr(self.result)
|
||||||
|
return string
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.arch + self.opt + self.target)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
if isinstance(other, TestCase):
|
||||||
|
if hash(self.arch + self.opt + self.target) != hash(other):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
raise RuntimeError("Wrong type for comparioson")
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if isinstance(other, TestCase):
|
||||||
|
return not self.__ne__(other)
|
||||||
|
raise RuntimeError("Wrong type for comparioson")
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
|
||||||
|
class Test(object):
|
||||||
|
"""
|
||||||
|
Test() stores all TestCase() objects for a given test file name
|
||||||
|
i.e. all archs/opts/targets/ and corresponding testing results.
|
||||||
|
"""
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
self.test_cases = []
|
||||||
|
|
||||||
|
def add_result(self, test_case):
|
||||||
|
if test_case in self.test_cases:
|
||||||
|
raise RuntimeError("This test case is already in the list: " + repr(test_case))
|
||||||
|
return
|
||||||
|
self.test_cases.append(test_case)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = self.name + '\n'
|
||||||
|
string = string.rjust(20)
|
||||||
|
for test_case in self.test_cases:
|
||||||
|
string += repr(test_case).rjust(60) + '\n'
|
||||||
|
return string
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.name)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
if isinstance(other, Test):
|
||||||
|
if hash(self) != hash(other):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if isinstance(other, Test):
|
||||||
|
return not self.__ne__(other)
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
|
||||||
|
class RegressionInfo(object):
|
||||||
|
"""
|
||||||
|
service class which provides some statistics on a given regression.
|
||||||
|
the regression test names and cases are given in a form of Test() objects
|
||||||
|
with empty (-1, -1) results
|
||||||
|
"""
|
||||||
|
def __init__(self, revision_old, revision_new, tests):
|
||||||
|
self.revision_old, self.revision_new = (revision_old, revision_new)
|
||||||
|
self.tests = tests
|
||||||
|
self.archfailes = {}
|
||||||
|
self.optfails = {}
|
||||||
|
self.targetfails = {}
|
||||||
|
self.testfails = {}
|
||||||
|
self.archs = []
|
||||||
|
self.opts = []
|
||||||
|
self.targets = []
|
||||||
|
|
||||||
|
for test in tests:
|
||||||
|
for test_case in test.test_cases:
|
||||||
|
self.inc_dictionary(self.testfails, test.name)
|
||||||
|
self.inc_dictionary(self.archfailes, test_case.arch)
|
||||||
|
self.inc_dictionary(self.optfails, test_case.opt)
|
||||||
|
self.inc_dictionary(self.targetfails, test_case.target)
|
||||||
|
|
||||||
|
self.archs = self.archfailes.keys()
|
||||||
|
self.opts = self.optfails.keys()
|
||||||
|
self.targets = self.targetfails.keys()
|
||||||
|
|
||||||
|
def inc_dictionary(self, dictionary, key):
|
||||||
|
if key not in dictionary:
|
||||||
|
dictionary[key] = 0
|
||||||
|
dictionary[key] += 1
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = "Regression of LLVM revision %s in comparison to %s\n" % (self.revision_new, self.revision_old)
|
||||||
|
string += repr(self.tests) + '\n'
|
||||||
|
string += str(self.testfails) + '\n'
|
||||||
|
string += str(self.archfailes) + '\n'
|
||||||
|
string += str(self.optfails) + '\n'
|
||||||
|
string += str(self.targetfails) + '\n'
|
||||||
|
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
class TestTable(object):
|
||||||
|
"""
|
||||||
|
the table which stores a tuple of Test() objects (one per revision) and has some
|
||||||
|
convenience methods for dealing with them
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
""" This dictionary contains {rev: [test1, test2, ...], ...}, where 'rev' is a string (revision name) and 'test#'
|
||||||
|
is a Test() object instance """
|
||||||
|
self.table = {}
|
||||||
|
|
||||||
|
def add_result(self, revision_name, test_name, arch, opt, target, runfailed, compfailed):
|
||||||
|
revision_name = str(revision_name)
|
||||||
|
if revision_name not in self.table:
|
||||||
|
self.table[revision_name] = []
|
||||||
|
|
||||||
|
test_case = TestCase(arch, opt, target)
|
||||||
|
test_case.result = TestResult(runfailed, compfailed)
|
||||||
|
|
||||||
|
for test in self.table[revision_name]:
|
||||||
|
if test.name == test_name:
|
||||||
|
test.add_result(test_case)
|
||||||
|
return
|
||||||
|
|
||||||
|
test = Test(test_name)
|
||||||
|
test.add_result(test_case)
|
||||||
|
self.table[revision_name].append(test)
|
||||||
|
|
||||||
|
def test_intersection(self, test1, test2):
|
||||||
|
""" Return test cases common for test1 and test2. If test names are different than there is nothing in common """
|
||||||
|
if test1.name != test2.name:
|
||||||
|
return []
|
||||||
|
return list(set(test1.test_cases) & set(test2.test_cases))
|
||||||
|
|
||||||
|
def test_regression(self, test1, test2):
|
||||||
|
""" Return the tuple of empty (i.e. with undefined results) TestCase() objects
|
||||||
|
corresponding to regression in test2 comparing to test1 """
|
||||||
|
if test1.name != test2.name:
|
||||||
|
return []
|
||||||
|
|
||||||
|
regressed = []
|
||||||
|
for tc1 in test1.test_cases:
|
||||||
|
for tc2 in test2.test_cases:
|
||||||
|
""" If test cases are equal (same arch, opt and target) but tc2 has more runfails or compfails """
|
||||||
|
if tc1 == tc2 and tc1.result < tc2.result:
|
||||||
|
regressed.append(TestCase(tc1.arch, tc1.opt, tc1.target))
|
||||||
|
return regressed
|
||||||
|
|
||||||
|
def regression(self, revision_old, revision_new):
|
||||||
|
""" Return a tuple of Test() objects containing TestCase() object which show regression along given revisions """
|
||||||
|
revision_old, revision_new = (str(revision_old), str(revision_new))
|
||||||
|
if revision_new not in self.table:
|
||||||
|
raise RuntimeError("This revision in not in the database: " + str(revision_new) + " (" + str(self.table.keys()) + ")")
|
||||||
|
return
|
||||||
|
|
||||||
|
if revision_old not in self.table:
|
||||||
|
raise RuntimeError("This revision in not in the database: " + str(revision_old) + " (" + str(self.table.keys()) + ")")
|
||||||
|
return
|
||||||
|
|
||||||
|
regressed = []
|
||||||
|
for test_old in self.table[revision_old]:
|
||||||
|
for test_new in self.table[revision_new]:
|
||||||
|
tr = self.test_regression(test_old, test_new)
|
||||||
|
if len(tr) == 0:
|
||||||
|
continue
|
||||||
|
test = Test(test_new.name)
|
||||||
|
for test_case in tr:
|
||||||
|
test.add_result(test_case)
|
||||||
|
regressed.append(test)
|
||||||
|
return RegressionInfo(revision_old, revision_new, regressed)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = ""
|
||||||
|
for rev in self.table.keys():
|
||||||
|
string += "[" + rev + "]:\n"
|
||||||
|
for test in self.table[rev]:
|
||||||
|
string += repr(test) + '\n'
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
class RevisionInfo(object):
|
||||||
|
"""
|
||||||
|
this class is intended to store some relevant information about curent LLVM revision
|
||||||
|
"""
|
||||||
|
def __init__(self, hostname, revision):
|
||||||
|
self.hostname, self.revision = hostname, revision
|
||||||
|
self.archs = []
|
||||||
|
self.opts = []
|
||||||
|
self.targets = []
|
||||||
|
self.succeed = 0
|
||||||
|
self.runfailed = 0
|
||||||
|
self.compfailed = 0
|
||||||
|
self.skipped = 0
|
||||||
|
self.testall = 0
|
||||||
|
self.regressions = {}
|
||||||
|
|
||||||
|
def register_test(self, arch, opt, target, succeed, runfailed, compfailed, skipped):
|
||||||
|
if arch not in self.archs:
|
||||||
|
self.archs.append(arch)
|
||||||
|
if opt not in self.opts:
|
||||||
|
self.opts.append(opt)
|
||||||
|
if target not in self.targets:
|
||||||
|
self.targets.append(target)
|
||||||
|
self.runfailed += runfailed
|
||||||
|
self.compfailed += compfailed
|
||||||
|
self.skipped += skipped
|
||||||
|
self.succeed += succeed
|
||||||
|
|
||||||
|
def add_regression(self, revision, regression_info):
|
||||||
|
""" input is intended to be from 'TestTable.regression(..)', 'regression_info' is a tuple of RegressionInfo() object
|
||||||
|
(regression.py) and 'revision' is tested (not current) LLVM revision name """
|
||||||
|
if revision == self.revision:
|
||||||
|
raise RuntimeError("No regression can be found along the same LLVM revision!")
|
||||||
|
|
||||||
|
if revision in self.regressions:
|
||||||
|
raise RuntimeError("This revision regression info is already in self.regressions!")
|
||||||
|
|
||||||
|
self.regressions[revision] = regression_info
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = "%s: LLVM(%s)\n" % (self.hostname, self.revision)
|
||||||
|
string += "archs : %s\n" % (str(self.archs))
|
||||||
|
string += "opts : %s\n" % (str(self.opts))
|
||||||
|
string += "targets: %s\n" % (str(self.targets))
|
||||||
|
string += "runfails: %d/%d\n" % (self.runfailed, self.testall)
|
||||||
|
string += "compfails: %d/%d\n" % (self.compfailed, self.testall)
|
||||||
|
string += "skipped: %d/%d\n" % (self.skipped, self.testall)
|
||||||
|
string += "succeed: %d/%d\n" % (self.succeed, self.testall)
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
class ExecutionStateGatherer(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.hostname = self.get_host_name()
|
||||||
|
self.revision = ""
|
||||||
|
self.rinf = []
|
||||||
|
self.tt = TestTable()
|
||||||
|
self.switch_revision("undefined")
|
||||||
|
|
||||||
|
def switch_revision(self, revision):
|
||||||
|
self.revision = revision
|
||||||
|
self.rinf.append(RevisionInfo(self.hostname, self.revision))
|
||||||
|
|
||||||
|
def current_rinf(self):
|
||||||
|
if len(self.rinf) == 0:
|
||||||
|
raise RuntimeError("self.rinf is empty. Apparently you've never invoked switch_revision")
|
||||||
|
return self.rinf[len(self.rinf) - 1]
|
||||||
|
|
||||||
|
def add_to_tt(self, test_name, arch, opt, target, runfailed, compfailed):
|
||||||
|
if len(self.rinf) == 0:
|
||||||
|
raise RuntimeError("self.rinf is empty. Apparently you've never invoked switch_revision")
|
||||||
|
self.tt.add_result(self.revision, test_name, arch, opt, target, runfailed, compfailed)
|
||||||
|
|
||||||
|
def add_to_rinf(self, arch, opt, target, succeed, runfailed, compfailed, skipped):
|
||||||
|
self.current_rinf().register_test(arch, opt, target, succeed, runfailed, compfailed, skipped)
|
||||||
|
|
||||||
|
def add_to_rinf_testall(self, tried_to_test):
|
||||||
|
self.current_rinf().testall += tried_to_test
|
||||||
|
|
||||||
|
def load_from_tt(self, tt):
|
||||||
|
# TODO: fill in self.rinf field!
|
||||||
|
self.tt = tt
|
||||||
|
REVISIONS = tt.table.keys()
|
||||||
|
self.revision = ""
|
||||||
|
if len(REVISIONS) != 0:
|
||||||
|
self.revision = REVISIONS[0]
|
||||||
|
print "ESG: loaded from 'TestTable()' with revisions", REVISIONS
|
||||||
|
|
||||||
|
def dump(self, fname, obj):
|
||||||
|
import pickle
|
||||||
|
with open(fname, 'w') as fp:
|
||||||
|
pickle.dump(obj, fp)
|
||||||
|
|
||||||
|
def undump(self, fname):
|
||||||
|
import pickle
|
||||||
|
with open(fname, 'r') as fp:
|
||||||
|
obj = pickle.load(fp)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def get_host_name(self):
|
||||||
|
import socket
|
||||||
|
return socket.gethostname()
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
string = "Hostname: %s\n" % (self.hostname)
|
||||||
|
string += "Current LLVM Revision = %s\n\n" % (self.revision)
|
||||||
|
for rev_info in self.rinf:
|
||||||
|
string += repr(rev_info) + '\n'
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
# this class instance is intended to gather and store all information
|
||||||
|
# regarding the testing process.
|
||||||
|
ex_state = ExecutionStateGatherer()
|
||||||
|
|||||||
10
ctx.cpp
10
ctx.cpp
@@ -46,7 +46,7 @@
|
|||||||
#include "sym.h"
|
#include "sym.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <llvm/Support/Dwarf.h>
|
#include <llvm/Support/Dwarf.h>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Metadata.h>
|
#include <llvm/Metadata.h>
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
@@ -340,7 +340,7 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
|
|||||||
diFile = funcStartPos.GetDIFile();
|
diFile = funcStartPos.GetDIFile();
|
||||||
AssertPos(currentPos, diFile.Verify());
|
AssertPos(currentPos, diFile.Verify());
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
|
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||||
llvm::DIScope scope = llvm::DIScope(m->diBuilder->getCU());
|
llvm::DIScope scope = llvm::DIScope(m->diBuilder->getCU());
|
||||||
#else // LLVM_3_4+
|
#else // LLVM_3_4+
|
||||||
llvm::DIScope scope = llvm::DIScope(m->diCompileUnit);
|
llvm::DIScope scope = llvm::DIScope(m->diCompileUnit);
|
||||||
@@ -356,7 +356,7 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
|
|||||||
AssertPos(currentPos, diSubprogramType.Verify());
|
AssertPos(currentPos, diSubprogramType.Verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||||
Assert(diSubprogramType.isCompositeType());
|
Assert(diSubprogramType.isCompositeType());
|
||||||
llvm::DICompositeType diSubprogramType_n =
|
llvm::DICompositeType diSubprogramType_n =
|
||||||
static_cast<llvm::DICompositeType>(diSubprogramType);
|
static_cast<llvm::DICompositeType>(diSubprogramType);
|
||||||
@@ -1636,7 +1636,7 @@ FunctionEmitContext::StartScope() {
|
|||||||
llvm::DILexicalBlock lexicalBlock =
|
llvm::DILexicalBlock lexicalBlock =
|
||||||
m->diBuilder->createLexicalBlock(parentScope, diFile,
|
m->diBuilder->createLexicalBlock(parentScope, diFile,
|
||||||
currentPos.first_line,
|
currentPos.first_line,
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
// Revision 202736 in LLVM adds support of DWARF discriminator
|
// Revision 202736 in LLVM adds support of DWARF discriminator
|
||||||
// to the last argument and revision 202737 in clang adds 0
|
// to the last argument and revision 202737 in clang adds 0
|
||||||
// for the last argument by default.
|
// for the last argument by default.
|
||||||
@@ -3429,7 +3429,7 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
|
|||||||
// alias analysis.
|
// alias analysis.
|
||||||
// TODO: what other attributes needs to be copied?
|
// TODO: what other attributes needs to be copied?
|
||||||
// TODO: do the same for varing path.
|
// TODO: do the same for varing path.
|
||||||
#if !defined (LLVM_3_1) && !defined (LLVM_3_2) // LLVM 3.3+
|
#if !defined (LLVM_3_2) // LLVM 3.3+
|
||||||
llvm::CallInst *cc = llvm::dyn_cast<llvm::CallInst>(ci);
|
llvm::CallInst *cc = llvm::dyn_cast<llvm::CallInst>(ci);
|
||||||
if (cc &&
|
if (cc &&
|
||||||
cc->getCalledFunction() &&
|
cc->getCalledFunction() &&
|
||||||
|
|||||||
4
ctx.h
4
ctx.h
@@ -40,14 +40,14 @@
|
|||||||
|
|
||||||
#include "ispc.h"
|
#include "ispc.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/InstrTypes.h>
|
#include <llvm/InstrTypes.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
#else
|
#else
|
||||||
#include <llvm/IR/InstrTypes.h>
|
#include <llvm/IR/InstrTypes.h>
|
||||||
#include <llvm/IR/Instructions.h>
|
#include <llvm/IR/Instructions.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/DebugInfo.h>
|
#include <llvm/IR/DebugInfo.h>
|
||||||
#include <llvm/IR/DIBuilder.h>
|
#include <llvm/IR/DIBuilder.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ InitTaskSystem() {
|
|||||||
|
|
||||||
threads = (pthread_t *)malloc(nThreads * sizeof(pthread_t));
|
threads = (pthread_t *)malloc(nThreads * sizeof(pthread_t));
|
||||||
for (int i = 0; i < nThreads; ++i) {
|
for (int i = 0; i < nThreads; ++i) {
|
||||||
err = pthread_create(&threads[i], NULL, &lTaskEntry, (void *)(i));
|
err = pthread_create(&threads[i], NULL, &lTaskEntry, (void *)((long long)i));
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf(stderr, "Error creating pthread %d: %s\n", i, strerror(err));
|
fprintf(stderr, "Error creating pthread %d: %s\n", i, strerror(err));
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
14
expr.cpp
14
expr.cpp
@@ -56,7 +56,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
#include <llvm/IR/CallingConv.h>
|
#include <llvm/IR/CallingConv.h>
|
||||||
#endif
|
#endif
|
||||||
#include <llvm/ExecutionEngine/GenericValue.h>
|
#include <llvm/ExecutionEngine/GenericValue.h>
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/InstIterator.h>
|
#include <llvm/IR/InstIterator.h>
|
||||||
#else
|
#else
|
||||||
#include <llvm/Support/InstIterator.h>
|
#include <llvm/Support/InstIterator.h>
|
||||||
@@ -3184,14 +3184,7 @@ static llvm::Value *
|
|||||||
lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test,
|
lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test,
|
||||||
llvm::Value *expr1, llvm::Value *expr2,
|
llvm::Value *expr1, llvm::Value *expr2,
|
||||||
const Type *type) {
|
const Type *type) {
|
||||||
#if 0 // !defined(LLVM_3_1)
|
|
||||||
// Though it should be equivalent, this seems to cause non-trivial
|
|
||||||
// performance regressions versus the below. This may be related to
|
|
||||||
// http://llvm.org/bugs/show_bug.cgi?id=16941.
|
|
||||||
if (test->getType() != LLVMTypes::Int1VectorType)
|
|
||||||
test = ctx->TruncInst(test, LLVMTypes::Int1VectorType);
|
|
||||||
return ctx->SelectInst(test, expr1, expr2, "select");
|
|
||||||
#else
|
|
||||||
llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp");
|
llvm::Value *resultPtr = ctx->AllocaInst(expr1->getType(), "selectexpr_tmp");
|
||||||
// Don't need to worry about masking here
|
// Don't need to worry about masking here
|
||||||
ctx->StoreInst(expr2, resultPtr);
|
ctx->StoreInst(expr2, resultPtr);
|
||||||
@@ -3200,7 +3193,6 @@ lEmitVaryingSelect(FunctionEmitContext *ctx, llvm::Value *test,
|
|||||||
PointerType::GetUniform(type)->LLVMType(g->ctx));
|
PointerType::GetUniform(type)->LLVMType(g->ctx));
|
||||||
ctx->StoreInst(expr1, resultPtr, test, type, PointerType::GetUniform(type));
|
ctx->StoreInst(expr1, resultPtr, test, type, PointerType::GetUniform(type));
|
||||||
return ctx->LoadInst(resultPtr, "selectexpr_final");
|
return ctx->LoadInst(resultPtr, "selectexpr_final");
|
||||||
#endif // !LLVM_3_1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
188
fail_db.txt
188
fail_db.txt
@@ -266,3 +266,191 @@
|
|||||||
./tests/ptr-22.ispc runfail x86-64 generic-16 Linux LLVM 3.4 clang++3.4 -O0 *
|
./tests/ptr-22.ispc runfail x86-64 generic-16 Linux LLVM 3.4 clang++3.4 -O0 *
|
||||||
./tests/ptr-22.ispc runfail x86-64 generic-4 Linux LLVM 3.5 clang++3.4 -O0 *
|
./tests/ptr-22.ispc runfail x86-64 generic-4 Linux LLVM 3.5 clang++3.4 -O0 *
|
||||||
./tests/ptr-22.ispc runfail x86-64 generic-16 Linux LLVM 3.5 clang++3.4 -O0 *
|
./tests/ptr-22.ispc runfail x86-64 generic-16 Linux LLVM 3.5 clang++3.4 -O0 *
|
||||||
|
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O2 *
|
||||||
|
./tests/ptr-22.ispc runfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-8.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-9.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-or-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-1.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-10.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-12.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-13.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-2.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-3.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-4.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-5.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-6.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-8.ispc compfail x86-64 knc Linux LLVM 3.4 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/paddus_vi16.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/paddus_vi8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/pmuls_i64.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i16.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i32.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i64.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-9.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-or-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-1.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-10.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-12.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-13.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-2.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-3.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-4.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-5.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-6.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-8.ispc compfail x86-64 knc Linux LLVM 3.5 icpc13.1 -O0 *
|
||||||
|
./tests/masked-scatter-struct.ispc runfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-2.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-5.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-6.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/exclusive-scan-add-7.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/short-vec-8.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/half-1.ispc runfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/ptr-15.ispc runfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-10.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-11.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-12.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-13.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-14.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-2.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-3.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-4.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-9.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-8.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-9.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-and-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-and-2.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-or-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-1.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-10.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-12.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-13.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-2.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-3.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-4.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-5.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-6.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-8.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/short-vec-8.ispc compfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/test-143.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O2 *
|
||||||
|
./tests/half-1.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/ptr-15.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/ptr-19.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/test-143.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-10.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-11.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-12.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-13.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-14.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-2.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-3.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-4.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-9.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-8.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-add-9.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-and-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-and-2.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/exclusive-scan-or-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-1.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-10.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-12.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-13.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-2.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-3.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-4.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-5.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-6.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/reduce-equal-8.ispc compfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
.\tests\foreach-double-1.ispc runfail x86 avx2-i32x8 Windows LLVM 3.6 cl -O2 *
|
||||||
|
.\tests\foreach-double-1.ispc runfail x86 avx2-i32x16 Windows LLVM 3.6 cl -O2 *
|
||||||
|
.\tests\foreach-double-1.ispc runfail x86 avx2-i64x4 Windows LLVM 3.6 cl -O2 *
|
||||||
|
./tests/ptr-22.ispc runfail x86-64 generic-4 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/ptr-22.ispc runfail x86-64 generic-16 Linux LLVM 3.6 clang++3.4 -O0 *
|
||||||
|
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/paddus_vi16.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/paddus_vi8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/pmuls_i64.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i16.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i32.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i64.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/pmulus_i8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O2 *
|
||||||
|
./tests/atomics-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-11.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-12.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-13.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-14.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-3.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-4.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-uniform-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/atomics-uniform-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-add-9.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-and-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/exclusive-scan-or-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-1.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-10.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-12.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-13.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-2.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-3.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-4.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-5.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-6.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
./tests/reduce-equal-8.ispc compfail x86-64 knc Linux LLVM 3.6 icpc13.1 -O0 *
|
||||||
|
|||||||
19
func.cpp
19
func.cpp
@@ -46,7 +46,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
#include <llvm/Metadata.h>
|
#include <llvm/Metadata.h>
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
#include <llvm/Target/TargetMachine.h>
|
#include <llvm/Target/TargetMachine.h>
|
||||||
#include <llvm/Target/TargetOptions.h>
|
#include <llvm/Target/TargetOptions.h>
|
||||||
#include <llvm/PassManager.h>
|
#include <llvm/PassManager.h>
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/Verifier.h>
|
#include <llvm/IR/Verifier.h>
|
||||||
#include <llvm/IR/IRPrintingPasses.h>
|
#include <llvm/IR/IRPrintingPasses.h>
|
||||||
#include <llvm/IR/CFG.h>
|
#include <llvm/IR/CFG.h>
|
||||||
@@ -381,9 +381,7 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
// isn't worth the code bloat / overhead.
|
// isn't worth the code bloat / overhead.
|
||||||
bool checkMask = (type->isTask == true) ||
|
bool checkMask = (type->isTask == true) ||
|
||||||
(
|
(
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
(function->hasFnAttr(llvm::Attribute::AlwaysInline) == false)
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
(function->getFnAttributes().hasAttribute(llvm::Attributes::AlwaysInline) == false)
|
(function->getFnAttributes().hasAttribute(llvm::Attributes::AlwaysInline) == false)
|
||||||
#else // LLVM 3.3+
|
#else // LLVM 3.3+
|
||||||
(function->getAttributes().getFnAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::AlwaysInline) == false)
|
(function->getAttributes().getFnAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::AlwaysInline) == false)
|
||||||
@@ -504,7 +502,8 @@ Function::GenerateIR() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m->errorCount == 0) {
|
if (m->errorCount == 0) {
|
||||||
#if defined (LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (llvm::verifyFunction(*function) == true) {
|
if (llvm::verifyFunction(*function) == true) {
|
||||||
#else
|
#else
|
||||||
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
|
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
|
||||||
@@ -543,11 +542,8 @@ Function::GenerateIR() {
|
|||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
llvm::Function *appFunction =
|
llvm::Function *appFunction =
|
||||||
llvm::Function::Create(ftype, linkage, functionName.c_str(), m->module);
|
llvm::Function::Create(ftype, linkage, functionName.c_str(), m->module);
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
appFunction->setDoesNotThrow(true);
|
|
||||||
#else
|
|
||||||
appFunction->setDoesNotThrow();
|
appFunction->setDoesNotThrow();
|
||||||
#endif
|
|
||||||
// We should iterate from 1 because zero parameter is return.
|
// We should iterate from 1 because zero parameter is return.
|
||||||
// We should iterate till getNumParams instead of getNumParams+1 because new
|
// We should iterate till getNumParams instead of getNumParams+1 because new
|
||||||
// function is export function and doesn't contain the last parameter "mask".
|
// function is export function and doesn't contain the last parameter "mask".
|
||||||
@@ -569,7 +565,8 @@ Function::GenerateIR() {
|
|||||||
emitCode(&ec, appFunction, firstStmtPos);
|
emitCode(&ec, appFunction, firstStmtPos);
|
||||||
if (m->errorCount == 0) {
|
if (m->errorCount == 0) {
|
||||||
sym->exportedFunction = appFunction;
|
sym->exportedFunction = appFunction;
|
||||||
#if defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
if (llvm::verifyFunction(*appFunction) == true) {
|
if (llvm::verifyFunction(*appFunction) == true) {
|
||||||
#else
|
#else
|
||||||
if (llvm::verifyFunction(*appFunction,
|
if (llvm::verifyFunction(*appFunction,
|
||||||
|
|||||||
40
ispc.cpp
40
ispc.cpp
@@ -48,7 +48,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/LLVMContext.h>
|
#include <llvm/LLVMContext.h>
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
@@ -57,19 +57,20 @@
|
|||||||
#include <llvm/IR/Module.h>
|
#include <llvm/IR/Module.h>
|
||||||
#include <llvm/IR/Instructions.h>
|
#include <llvm/IR/Instructions.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) // LLVM 3.6+
|
||||||
|
#include <llvm/Target/TargetSubtargetInfo.h>
|
||||||
|
#endif
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/DebugInfo.h>
|
#include <llvm/IR/DebugInfo.h>
|
||||||
#include <llvm/IR/DIBuilder.h>
|
#include <llvm/IR/DIBuilder.h>
|
||||||
#else
|
#else // LLVM 3.2, 3.3, 3.4
|
||||||
#include <llvm/DebugInfo.h>
|
#include <llvm/DebugInfo.h>
|
||||||
#include <llvm/DIBuilder.h>
|
#include <llvm/DIBuilder.h>
|
||||||
#endif
|
#endif
|
||||||
#include <llvm/Support/Dwarf.h>
|
#include <llvm/Support/Dwarf.h>
|
||||||
#include <llvm/Target/TargetMachine.h>
|
#include <llvm/Target/TargetMachine.h>
|
||||||
#include <llvm/Target/TargetOptions.h>
|
#include <llvm/Target/TargetOptions.h>
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Target/TargetData.h>
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
#include <llvm/DataLayout.h>
|
#include <llvm/DataLayout.h>
|
||||||
#else // LLVM 3.3+
|
#else // LLVM 3.3+
|
||||||
#include <llvm/IR/DataLayout.h>
|
#include <llvm/IR/DataLayout.h>
|
||||||
@@ -165,10 +166,8 @@ static const char *supportedCPUs[] = {
|
|||||||
"cortex-a9", "cortex-a15",
|
"cortex-a9", "cortex-a15",
|
||||||
#endif
|
#endif
|
||||||
"atom", "penryn", "core2", "corei7", "corei7-avx"
|
"atom", "penryn", "core2", "corei7", "corei7-avx"
|
||||||
#if !defined(LLVM_3_1)
|
|
||||||
, "core-avx-i", "core-avx2"
|
, "core-avx-i", "core-avx2"
|
||||||
#endif // LLVM 3.2+
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
|
||||||
, "slm"
|
, "slm"
|
||||||
#endif // LLVM 3.4+
|
#endif // LLVM 3.4+
|
||||||
};
|
};
|
||||||
@@ -176,18 +175,14 @@ static const char *supportedCPUs[] = {
|
|||||||
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
||||||
m_target(NULL),
|
m_target(NULL),
|
||||||
m_targetMachine(NULL),
|
m_targetMachine(NULL),
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
m_targetData(NULL),
|
|
||||||
#else
|
|
||||||
m_dataLayout(NULL),
|
m_dataLayout(NULL),
|
||||||
#endif
|
|
||||||
m_valid(false),
|
m_valid(false),
|
||||||
m_isa(SSE2),
|
m_isa(SSE2),
|
||||||
m_arch(""),
|
m_arch(""),
|
||||||
m_is32Bit(true),
|
m_is32Bit(true),
|
||||||
m_cpu(""),
|
m_cpu(""),
|
||||||
m_attributes(""),
|
m_attributes(""),
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
m_tf_attributes(NULL),
|
m_tf_attributes(NULL),
|
||||||
#endif
|
#endif
|
||||||
m_nativeVectorWidth(-1),
|
m_nativeVectorWidth(-1),
|
||||||
@@ -666,10 +661,8 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
|||||||
m_isa == Target::NEON32)
|
m_isa == Target::NEON32)
|
||||||
options.FloatABIType = llvm::FloatABI::Hard;
|
options.FloatABIType = llvm::FloatABI::Hard;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LLVM_3_1)
|
|
||||||
if (g->opt.disableFMA == false)
|
if (g->opt.disableFMA == false)
|
||||||
options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
|
options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
|
||||||
#endif // !LLVM_3_1
|
|
||||||
|
|
||||||
#ifdef ISPC_IS_WINDOWS
|
#ifdef ISPC_IS_WINDOWS
|
||||||
if (strcmp("x86", arch) == 0) {
|
if (strcmp("x86", arch) == 0) {
|
||||||
@@ -688,12 +681,12 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
|||||||
// Initialize TargetData/DataLayout in 3 steps.
|
// Initialize TargetData/DataLayout in 3 steps.
|
||||||
// 1. Get default data layout first
|
// 1. Get default data layout first
|
||||||
std::string dl_string;
|
std::string dl_string;
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
dl_string = m_targetMachine->getTargetData()->getStringRepresentation();
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) // LLVM 3.6+
|
||||||
|
dl_string = m_targetMachine->getSubtargetImpl()->getDataLayout()->getStringRepresentation();
|
||||||
#else
|
#else
|
||||||
dl_string = m_targetMachine->getDataLayout()->getStringRepresentation();
|
dl_string = m_targetMachine->getDataLayout()->getStringRepresentation();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 2. Adjust for generic
|
// 2. Adjust for generic
|
||||||
if (m_isa == Target::GENERIC) {
|
if (m_isa == Target::GENERIC) {
|
||||||
// <16 x i1> vectors only need 16 bit / 2 byte alignment, so add
|
// <16 x i1> vectors only need 16 bit / 2 byte alignment, so add
|
||||||
@@ -707,19 +700,16 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. Finally set member data
|
// 3. Finally set member data
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
m_targetData = new llvm::TargetData(dl_string);
|
|
||||||
#else
|
|
||||||
m_dataLayout = new llvm::DataLayout(dl_string);
|
m_dataLayout = new llvm::DataLayout(dl_string);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set is32Bit
|
// Set is32Bit
|
||||||
// This indicates if we are compiling for 32 bit platform
|
// This indicates if we are compiling for 32 bit platform
|
||||||
// and can assume 32 bit runtime.
|
// and can assume 32 bit runtime.
|
||||||
// FIXME: all generic targets are handled as 64 bit, which is incorrect.
|
// FIXME: all generic targets are handled as 64 bit, which is incorrect.
|
||||||
|
|
||||||
this->m_is32Bit = (getDataLayout()->getPointerSize() == 4);
|
this->m_is32Bit = (getDataLayout()->getPointerSize() == 4);
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
// This is LLVM 3.3+ feature.
|
// This is LLVM 3.3+ feature.
|
||||||
// Initialize target-specific "target-feature" attribute.
|
// Initialize target-specific "target-feature" attribute.
|
||||||
if (!m_attributes.empty()) {
|
if (!m_attributes.empty()) {
|
||||||
@@ -1013,7 +1003,7 @@ Target::StructOffset(llvm::Type *type, int element,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Target::markFuncWithTargetAttr(llvm::Function* func) {
|
void Target::markFuncWithTargetAttr(llvm::Function* func) {
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
if (m_tf_attributes) {
|
if (m_tf_attributes) {
|
||||||
func->addAttributes(llvm::AttributeSet::FunctionIndex, *m_tf_attributes);
|
func->addAttributes(llvm::AttributeSet::FunctionIndex, *m_tf_attributes);
|
||||||
}
|
}
|
||||||
|
|||||||
19
ispc.h
19
ispc.h
@@ -40,8 +40,8 @@
|
|||||||
|
|
||||||
#define ISPC_VERSION "1.7.1dev"
|
#define ISPC_VERSION "1.7.1dev"
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) && !defined(LLVM_3_6)
|
||||||
#error "Only LLVM 3.1, 3.2, 3.3, 3.4 and the 3.5 development branch are supported"
|
#error "Only LLVM 3.2, 3.3, 3.4, 3.5 and the 3.6 development branch are supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
@@ -76,11 +76,7 @@ namespace llvm {
|
|||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Constant;
|
class Constant;
|
||||||
class ConstantValue;
|
class ConstantValue;
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
class TargetData;
|
|
||||||
#else
|
|
||||||
class DataLayout;
|
class DataLayout;
|
||||||
#endif
|
|
||||||
class DIBuilder;
|
class DIBuilder;
|
||||||
class DIDescriptor;
|
class DIDescriptor;
|
||||||
class DIFile;
|
class DIFile;
|
||||||
@@ -244,11 +240,7 @@ public:
|
|||||||
|
|
||||||
// Note the same name of method for 3.1 and 3.2+, this allows
|
// Note the same name of method for 3.1 and 3.2+, this allows
|
||||||
// to reduce number ifdefs on client side.
|
// to reduce number ifdefs on client side.
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
llvm::TargetData *getDataLayout() const {return m_targetData;}
|
|
||||||
#else
|
|
||||||
llvm::DataLayout *getDataLayout() const {return m_dataLayout;}
|
llvm::DataLayout *getDataLayout() const {return m_dataLayout;}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Reports if Target object has valid state. */
|
/** Reports if Target object has valid state. */
|
||||||
bool isValid() const {return m_valid;}
|
bool isValid() const {return m_valid;}
|
||||||
@@ -305,12 +297,7 @@ private:
|
|||||||
must not be used.
|
must not be used.
|
||||||
*/
|
*/
|
||||||
llvm::TargetMachine *m_targetMachine;
|
llvm::TargetMachine *m_targetMachine;
|
||||||
|
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
llvm::TargetData *m_targetData;
|
|
||||||
#else
|
|
||||||
llvm::DataLayout *m_dataLayout;
|
llvm::DataLayout *m_dataLayout;
|
||||||
#endif
|
|
||||||
|
|
||||||
/** flag to report invalid state after construction
|
/** flag to report invalid state after construction
|
||||||
(due to bad parameters passed to constructor). */
|
(due to bad parameters passed to constructor). */
|
||||||
@@ -331,7 +318,7 @@ private:
|
|||||||
/** Target-specific attribute string to pass along to the LLVM backend */
|
/** Target-specific attribute string to pass along to the LLVM backend */
|
||||||
std::string m_attributes;
|
std::string m_attributes;
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
/** Target-specific LLVM attribute, which has to be attached to every
|
/** Target-specific LLVM attribute, which has to be attached to every
|
||||||
function to ensure that it is generated for correct target architecture.
|
function to ensure that it is generated for correct target architecture.
|
||||||
This is requirement was introduced in LLVM 3.3 */
|
This is requirement was introduced in LLVM 3.3 */
|
||||||
|
|||||||
@@ -403,7 +403,7 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalDependencies Condition="'$(LLVM_VERSION)'!='LLVM_3_1'AND'$(LLVM_VERSION)'!='LLVM_3_2'AND'$(LLVM_VERSION)'!='LLVM_3_3'">LLVMOption.lib;LLVMSupport.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies Condition="'$(LLVM_VERSION)'!='LLVM_3_2'AND'$(LLVM_VERSION)'!='LLVM_3_3'">LLVMOption.lib;LLVMSupport.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalDependencies Condition="'$(LLVM_VERSION)'!='LLVM_3_1'AND'$(LLVM_VERSION)'!='LLVM_3_2'AND'$(LLVM_VERSION)'!='LLVM_3_3'">LLVMOption.lib;LLVMSupport.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies Condition="'$(LLVM_VERSION)'!='LLVM_3_2'AND'$(LLVM_VERSION)'!='LLVM_3_3'">LLVMOption.lib;LLVMSupport.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# This patch needs to be applied only to 3.4 (not 3.4.2), so this has the name,
|
||||||
|
# which doesn't trigger automatic application of the patch (no 3_4 in the name).
|
||||||
Index: include/llvm/IR/IntrinsicsX86.td
|
Index: include/llvm/IR/IntrinsicsX86.td
|
||||||
===================================================================
|
===================================================================
|
||||||
--- include/llvm/IR/IntrinsicsX86.td (revision 201125)
|
--- include/llvm/IR/IntrinsicsX86.td (revision 201125)
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "llvmutil.h"
|
#include "llvmutil.h"
|
||||||
#include "ispc.h"
|
#include "ispc.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
#include <llvm/BasicBlock.h>
|
#include <llvm/BasicBlock.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#ifndef ISPC_LLVMUTIL_H
|
#ifndef ISPC_LLVMUTIL_H
|
||||||
#define ISPC_LLVMUTIL_H 1
|
#define ISPC_LLVMUTIL_H 1
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/LLVMContext.h>
|
#include <llvm/LLVMContext.h>
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
#include <llvm/DerivedTypes.h>
|
#include <llvm/DerivedTypes.h>
|
||||||
|
|||||||
12
main.cpp
12
main.cpp
@@ -62,9 +62,7 @@ static void
|
|||||||
lPrintVersion() {
|
lPrintVersion() {
|
||||||
printf("Intel(r) SPMD Program Compiler (ispc), %s (build %s @ %s, LLVM %s)\n",
|
printf("Intel(r) SPMD Program Compiler (ispc), %s (build %s @ %s, LLVM %s)\n",
|
||||||
ISPC_VERSION, BUILD_VERSION, BUILD_DATE,
|
ISPC_VERSION, BUILD_VERSION, BUILD_DATE,
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
"3.1"
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
"3.2"
|
"3.2"
|
||||||
#elif defined(LLVM_3_3)
|
#elif defined(LLVM_3_3)
|
||||||
"3.3"
|
"3.3"
|
||||||
@@ -72,6 +70,8 @@ lPrintVersion() {
|
|||||||
"3.4"
|
"3.4"
|
||||||
#elif defined(LLVM_3_5)
|
#elif defined(LLVM_3_5)
|
||||||
"3.5"
|
"3.5"
|
||||||
|
#elif defined(LLVM_3_6)
|
||||||
|
"3.6"
|
||||||
#else
|
#else
|
||||||
#error "Unhandled LLVM version"
|
#error "Unhandled LLVM version"
|
||||||
#endif
|
#endif
|
||||||
@@ -166,7 +166,8 @@ devUsage(int ret) {
|
|||||||
printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\n");
|
printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\n");
|
||||||
printf(" [--yydebug]\t\t\t\tPrint debugging information during parsing\n");
|
printf(" [--yydebug]\t\t\t\tPrint debugging information during parsing\n");
|
||||||
printf(" [--debug-phase=<value>]\t\tSet optimization phases to dump. --debug-phase=first,210:220,300,305,310:last\n");
|
printf(" [--debug-phase=<value>]\t\tSet optimization phases to dump. --debug-phase=first,210:220,300,305,310:last\n");
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.4+
|
||||||
printf(" [--debug-ir=<value>]\t\tSet optimization phase to generate debugIR after it\n");
|
printf(" [--debug-ir=<value>]\t\tSet optimization phase to generate debugIR after it\n");
|
||||||
#endif
|
#endif
|
||||||
printf(" [--off-phase=<value>]\t\tSwitch off optimization phases. --off-phase=first,210:220,300,305,310:last\n");
|
printf(" [--off-phase=<value>]\t\tSwitch off optimization phases. --off-phase=first,210:220,300,305,310:last\n");
|
||||||
@@ -556,7 +557,8 @@ int main(int Argc, char *Argv[]) {
|
|||||||
"away or introduce the new ones.\n");
|
"away or introduce the new ones.\n");
|
||||||
g->debug_stages = ParsingPhases(argv[i] + strlen("--debug-phase="));
|
g->debug_stages = ParsingPhases(argv[i] + strlen("--debug-phase="));
|
||||||
}
|
}
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.4+
|
||||||
else if (strncmp(argv[i], "--debug-ir=", 11) == 0) {
|
else if (strncmp(argv[i], "--debug-ir=", 11) == 0) {
|
||||||
g->debugIR = ParsingPhaseName(argv[i] + strlen("--debug-ir="));
|
g->debugIR = ParsingPhaseName(argv[i] + strlen("--debug-ir="));
|
||||||
}
|
}
|
||||||
|
|||||||
68
module.cpp
68
module.cpp
@@ -67,7 +67,7 @@
|
|||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/LLVMContext.h>
|
#include <llvm/LLVMContext.h>
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
#include <llvm/IR/DataLayout.h>
|
#include <llvm/IR/DataLayout.h>
|
||||||
#include <llvm/Analysis/TargetTransformInfo.h>
|
#include <llvm/Analysis/TargetTransformInfo.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/Verifier.h>
|
#include <llvm/IR/Verifier.h>
|
||||||
#include <llvm/IR/IRPrintingPasses.h>
|
#include <llvm/IR/IRPrintingPasses.h>
|
||||||
#include <llvm/IR/CFG.h>
|
#include <llvm/IR/CFG.h>
|
||||||
@@ -215,7 +215,7 @@ lStripUnusedDebugInfo(llvm::Module *module) {
|
|||||||
// stuff and remove it later on. Removing it is useful, as it
|
// stuff and remove it later on. Removing it is useful, as it
|
||||||
// reduces size of the binary significantly (manyfold for small
|
// reduces size of the binary significantly (manyfold for small
|
||||||
// programs).
|
// programs).
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
llvm::MDNode *nodeSPMD =
|
llvm::MDNode *nodeSPMD =
|
||||||
llvm::dyn_cast<llvm::MDNode>(cuNode->getOperand(12));
|
llvm::dyn_cast<llvm::MDNode>(cuNode->getOperand(12));
|
||||||
Assert(nodeSPMD != NULL);
|
Assert(nodeSPMD != NULL);
|
||||||
@@ -320,7 +320,7 @@ Module::Module(const char *fn) {
|
|||||||
sprintf(producerString, "ispc version %s (built on %s)",
|
sprintf(producerString, "ispc version %s (built on %s)",
|
||||||
ISPC_VERSION, __DATE__);
|
ISPC_VERSION, __DATE__);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||||
diCompileUnit =
|
diCompileUnit =
|
||||||
#endif // LLVM_3_4+
|
#endif // LLVM_3_4+
|
||||||
diBuilder->createCompileUnit(llvm::dwarf::DW_LANG_C99, /* lang */
|
diBuilder->createCompileUnit(llvm::dwarf::DW_LANG_C99, /* lang */
|
||||||
@@ -854,7 +854,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
|||||||
isInline)
|
isInline)
|
||||||
#ifdef LLVM_3_2
|
#ifdef LLVM_3_2
|
||||||
function->addFnAttr(llvm::Attributes::AlwaysInline);
|
function->addFnAttr(llvm::Attributes::AlwaysInline);
|
||||||
#else // LLVM 3.1 and 3.3+
|
#else // LLVM 3.3+
|
||||||
function->addFnAttr(llvm::Attribute::AlwaysInline);
|
function->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -864,11 +864,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
|||||||
if (g->target->getISA() != Target::NVPTX)
|
if (g->target->getISA() != Target::NVPTX)
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
// This also applies transitively to members I think?
|
// This also applies transitively to members I think?
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
function->setDoesNotAlias(1, true);
|
|
||||||
#else // LLVM 3.2+
|
|
||||||
function->setDoesNotAlias(1);
|
function->setDoesNotAlias(1);
|
||||||
#endif
|
|
||||||
|
|
||||||
g->target->markFuncWithTargetAttr(function);
|
g->target->markFuncWithTargetAttr(function);
|
||||||
|
|
||||||
@@ -934,12 +930,7 @@ Module::AddFunctionDeclaration(const std::string &name,
|
|||||||
|
|
||||||
// NOTE: LLVM indexes function parameters starting from 1.
|
// NOTE: LLVM indexes function parameters starting from 1.
|
||||||
// This is unintuitive.
|
// This is unintuitive.
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
function->setDoesNotAlias(i+1, true);
|
|
||||||
#else
|
|
||||||
function->setDoesNotAlias(i+1);
|
function->setDoesNotAlias(i+1);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int align = 4 * RoundUpPow2(g->target->nativeVectorWidth);
|
int align = 4 * RoundUpPow2(g->target->nativeVectorWidth);
|
||||||
function->addAttribute(i+1, llvm::Attribute::constructAlignmentFromInt(align));
|
function->addAttribute(i+1, llvm::Attribute::constructAlignmentFromInt(align));
|
||||||
@@ -1026,7 +1017,7 @@ Module::writeOutput(OutputType outputType, const char *outFileName,
|
|||||||
lStripUnusedDebugInfo(module);
|
lStripUnusedDebugInfo(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (LLVM_3_4) || defined (LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.4+
|
||||||
// In LLVM_3_4 after r195494 and r195504 revisions we should pass
|
// In LLVM_3_4 after r195494 and r195504 revisions we should pass
|
||||||
// "Debug Info Version" constant to the module. LLVM will ignore
|
// "Debug Info Version" constant to the module. LLVM will ignore
|
||||||
// our Debug Info metadata without it.
|
// our Debug Info metadata without it.
|
||||||
@@ -1285,7 +1276,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
|
|||||||
llvm::TargetMachine::CodeGenFileType fileType = (outputType == Object) ?
|
llvm::TargetMachine::CodeGenFileType fileType = (outputType == Object) ?
|
||||||
llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
|
llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
|
||||||
bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
|
bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
|
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||||
unsigned int flags = binary ? llvm::raw_fd_ostream::F_Binary : 0;
|
unsigned int flags = binary ? llvm::raw_fd_ostream::F_Binary : 0;
|
||||||
#elif defined(LLVM_3_4)
|
#elif defined(LLVM_3_4)
|
||||||
llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_Binary :
|
llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_Binary :
|
||||||
@@ -1304,7 +1295,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
|
|||||||
}
|
}
|
||||||
|
|
||||||
llvm::PassManager pm;
|
llvm::PassManager pm;
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
||||||
#else
|
#else
|
||||||
pm.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
pm.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
||||||
@@ -2185,53 +2176,55 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre
|
|||||||
|
|
||||||
llvm::raw_fd_ostream stderrRaw(2, false);
|
llvm::raw_fd_ostream stderrRaw(2, false);
|
||||||
|
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
clang::TextDiagnosticPrinter *diagPrinter =
|
|
||||||
new clang::TextDiagnosticPrinter(stderrRaw, clang::DiagnosticOptions());
|
|
||||||
#else
|
|
||||||
clang::DiagnosticOptions *diagOptions = new clang::DiagnosticOptions();
|
clang::DiagnosticOptions *diagOptions = new clang::DiagnosticOptions();
|
||||||
clang::TextDiagnosticPrinter *diagPrinter =
|
clang::TextDiagnosticPrinter *diagPrinter =
|
||||||
new clang::TextDiagnosticPrinter(stderrRaw, diagOptions);
|
new clang::TextDiagnosticPrinter(stderrRaw, diagOptions);
|
||||||
#endif
|
|
||||||
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs(new clang::DiagnosticIDs);
|
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs(new clang::DiagnosticIDs);
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
clang::DiagnosticsEngine *diagEngine =
|
|
||||||
new clang::DiagnosticsEngine(diagIDs, diagPrinter);
|
|
||||||
#else
|
|
||||||
clang::DiagnosticsEngine *diagEngine =
|
clang::DiagnosticsEngine *diagEngine =
|
||||||
new clang::DiagnosticsEngine(diagIDs, diagOptions, diagPrinter);
|
new clang::DiagnosticsEngine(diagIDs, diagOptions, diagPrinter);
|
||||||
#endif
|
|
||||||
inst.setDiagnostics(diagEngine);
|
inst.setDiagnostics(diagEngine);
|
||||||
|
|
||||||
|
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||||
clang::TargetOptions &options = inst.getTargetOpts();
|
clang::TargetOptions &options = inst.getTargetOpts();
|
||||||
|
#else // LLVM 3.5+
|
||||||
|
const std::shared_ptr< clang::TargetOptions > &options =
|
||||||
|
std::make_shared< clang::TargetOptions >(inst.getTargetOpts());
|
||||||
|
#endif
|
||||||
|
|
||||||
llvm::Triple triple(module->getTargetTriple());
|
llvm::Triple triple(module->getTargetTriple());
|
||||||
if (triple.getTriple().empty()) {
|
if (triple.getTriple().empty()) {
|
||||||
triple.setTriple(llvm::sys::getDefaultTargetTriple());
|
triple.setTriple(llvm::sys::getDefaultTargetTriple());
|
||||||
}
|
}
|
||||||
options.Triple = triple.getTriple();
|
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||||
|
options.Triple = triple.getTriple();
|
||||||
|
#else // LLVM 3.5+
|
||||||
|
options->Triple = triple.getTriple();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LLVM_3_2)
|
||||||
clang::TargetInfo *target =
|
clang::TargetInfo *target =
|
||||||
clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(), options);
|
clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(), options);
|
||||||
#else // LLVM 3.3+
|
#elif defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||||
clang::TargetInfo *target =
|
clang::TargetInfo *target =
|
||||||
clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(), &options);
|
clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(), &options);
|
||||||
|
#else // LLVM 3.5+
|
||||||
|
clang::TargetInfo *target =
|
||||||
|
clang::TargetInfo::CreateTargetInfo(inst.getDiagnostics(), options);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inst.setTarget(target);
|
inst.setTarget(target);
|
||||||
inst.createSourceManager(inst.getFileManager());
|
inst.createSourceManager(inst.getFileManager());
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
inst.InitializeSourceManager(infilename);
|
|
||||||
#else
|
|
||||||
clang::FrontendInputFile inputFile(infilename, clang::IK_None);
|
clang::FrontendInputFile inputFile(infilename, clang::IK_None);
|
||||||
inst.InitializeSourceManager(inputFile);
|
inst.InitializeSourceManager(inputFile);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Don't remove comments in the preprocessor, so that we can accurately
|
// Don't remove comments in the preprocessor, so that we can accurately
|
||||||
// track the source file position by handling them ourselves.
|
// track the source file position by handling them ourselves.
|
||||||
inst.getPreprocessorOutputOpts().ShowComments = 1;
|
inst.getPreprocessorOutputOpts().ShowComments = 1;
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) // LLVM 3.3+
|
#if !defined(LLVM_3_2) // LLVM 3.3+
|
||||||
inst.getPreprocessorOutputOpts().ShowCPP = 1;
|
inst.getPreprocessorOutputOpts().ShowCPP = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2243,7 +2236,7 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre
|
|||||||
headerOpts.Verbose = 1;
|
headerOpts.Verbose = 1;
|
||||||
for (int i = 0; i < (int)g->includePath.size(); ++i) {
|
for (int i = 0; i < (int)g->includePath.size(); ++i) {
|
||||||
headerOpts.AddPath(g->includePath[i], clang::frontend::Angled,
|
headerOpts.AddPath(g->includePath[i], clang::frontend::Angled,
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
true /* is user supplied */,
|
true /* is user supplied */,
|
||||||
#endif
|
#endif
|
||||||
false /* not a framework */,
|
false /* not a framework */,
|
||||||
@@ -2321,7 +2314,8 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre
|
|||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
|
|
||||||
inst.getLangOpts().LineComment = 1;
|
inst.getLangOpts().LineComment = 1;
|
||||||
#if defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
inst.createPreprocessor(clang::TU_Complete);
|
inst.createPreprocessor(clang::TU_Complete);
|
||||||
#else
|
#else
|
||||||
inst.createPreprocessor();
|
inst.createPreprocessor();
|
||||||
|
|||||||
4
module.h
4
module.h
@@ -44,7 +44,7 @@
|
|||||||
#if defined(LLVM_3_4)
|
#if defined(LLVM_3_4)
|
||||||
#include <llvm/DebugInfo.h>
|
#include <llvm/DebugInfo.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/DebugInfo.h>
|
#include <llvm/IR/DebugInfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
/** The diBuilder manages generating debugging information */
|
/** The diBuilder manages generating debugging information */
|
||||||
llvm::DIBuilder *diBuilder;
|
llvm::DIBuilder *diBuilder;
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||||
llvm::DICompileUnit diCompileUnit;
|
llvm::DICompileUnit diCompileUnit;
|
||||||
#endif // LLVM_3_4+
|
#endif // LLVM_3_4+
|
||||||
|
|
||||||
|
|||||||
21
opt.cpp
21
opt.cpp
@@ -48,7 +48,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <llvm/Pass.h>
|
#include <llvm/Pass.h>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
#include <llvm/Intrinsics.h>
|
#include <llvm/Intrinsics.h>
|
||||||
@@ -69,12 +69,12 @@
|
|||||||
#include <llvm/IR/InlineAsm.h>
|
#include <llvm/IR/InlineAsm.h>
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
#endif
|
#endif
|
||||||
#if defined (LLVM_3_4) || defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.4+
|
||||||
#include <llvm/Transforms/Instrumentation.h>
|
#include <llvm/Transforms/Instrumentation.h>
|
||||||
#endif
|
#endif
|
||||||
#include <llvm/PassManager.h>
|
#include <llvm/PassManager.h>
|
||||||
#include <llvm/PassRegistry.h>
|
#include <llvm/PassRegistry.h>
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/Verifier.h>
|
#include <llvm/IR/Verifier.h>
|
||||||
#include <llvm/IR/IRPrintingPasses.h>
|
#include <llvm/IR/IRPrintingPasses.h>
|
||||||
#include <llvm/IR/PatternMatch.h>
|
#include <llvm/IR/PatternMatch.h>
|
||||||
@@ -453,7 +453,8 @@ DebugPassManager::add(llvm::Pass * P, int stage = -1) {
|
|||||||
number, P->getPassName());
|
number, P->getPassName());
|
||||||
PM.add(CreateDebugPass(buf));
|
PM.add(CreateDebugPass(buf));
|
||||||
}
|
}
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) // LLVM 3.4+
|
||||||
if (g->debugIR == number) {
|
if (g->debugIR == number) {
|
||||||
// adding generating of LLVM IR debug after optimization
|
// adding generating of LLVM IR debug after optimization
|
||||||
char buf[100];
|
char buf[100];
|
||||||
@@ -478,7 +479,7 @@ Optimize(llvm::Module *module, int optLevel) {
|
|||||||
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
|
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
|
||||||
optPM.add(targetLibraryInfo);
|
optPM.add(targetLibraryInfo);
|
||||||
|
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
||||||
#else
|
#else
|
||||||
optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
||||||
@@ -603,7 +604,7 @@ Optimize(llvm::Module *module, int optLevel) {
|
|||||||
optPM.add(llvm::createCFGSimplificationPass());
|
optPM.add(llvm::createCFGSimplificationPass());
|
||||||
|
|
||||||
optPM.add(llvm::createArgumentPromotionPass());
|
optPM.add(llvm::createArgumentPromotionPass());
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
|
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||||
// Starting from 3.4 this functionality was moved to
|
// Starting from 3.4 this functionality was moved to
|
||||||
// InstructionCombiningPass. See r184459 for details.
|
// InstructionCombiningPass. See r184459 for details.
|
||||||
optPM.add(llvm::createSimplifyLibCallsPass(), 240);
|
optPM.add(llvm::createSimplifyLibCallsPass(), 240);
|
||||||
@@ -4781,7 +4782,7 @@ PeepholePass::PeepholePass()
|
|||||||
: BasicBlockPass(ID) {
|
: BasicBlockPass(ID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
|
|
||||||
using namespace llvm::PatternMatch;
|
using namespace llvm::PatternMatch;
|
||||||
|
|
||||||
@@ -5102,7 +5103,7 @@ lMatchAvgDownInt16(llvm::Value *inst) {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // !LLVM_3_1 && !LLVM_3_2
|
#endif // !LLVM_3_2
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -5115,7 +5116,7 @@ PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::Instruction *inst = &*iter;
|
llvm::Instruction *inst = &*iter;
|
||||||
|
|
||||||
llvm::Instruction *builtinCall = NULL;
|
llvm::Instruction *builtinCall = NULL;
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
if (!builtinCall)
|
if (!builtinCall)
|
||||||
builtinCall = lMatchAvgUpUInt8(inst);
|
builtinCall = lMatchAvgUpUInt8(inst);
|
||||||
if (!builtinCall)
|
if (!builtinCall)
|
||||||
@@ -5132,7 +5133,7 @@ PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
builtinCall = lMatchAvgDownInt8(inst);
|
builtinCall = lMatchAvgDownInt8(inst);
|
||||||
if (!builtinCall)
|
if (!builtinCall)
|
||||||
builtinCall = lMatchAvgDownInt16(inst);
|
builtinCall = lMatchAvgDownInt16(inst);
|
||||||
#endif // !LLVM_3_1 && !LLVM_3_2
|
#endif // !LLVM_3_2
|
||||||
if (builtinCall != NULL) {
|
if (builtinCall != NULL) {
|
||||||
llvm::ReplaceInstWithInst(inst, builtinCall);
|
llvm::ReplaceInstWithInst(inst, builtinCall);
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
|
|||||||
2
parse.yy
2
parse.yy
@@ -83,7 +83,7 @@ struct ForeachDimension;
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Constants.h>
|
#include <llvm/Constants.h>
|
||||||
#else
|
#else
|
||||||
#include <llvm/IR/Constants.h>
|
#include <llvm/IR/Constants.h>
|
||||||
|
|||||||
137
run_tests.py
137
run_tests.py
@@ -336,8 +336,8 @@ def run_test(testname):
|
|||||||
# pull tests to run from the given queue and run them. Multiple copies of
|
# pull tests to run from the given queue and run them. Multiple copies of
|
||||||
# this function will be running in parallel across all of the CPU cores of
|
# this function will be running in parallel across all of the CPU cores of
|
||||||
# the system.
|
# the system.
|
||||||
def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test_length_arg, counter, mutex, glob_var):
|
def run_tasks_from_queue(queue, queue_ret, queue_error, queue_finish, total_tests_arg, max_test_length_arg, counter, mutex, glob_var):
|
||||||
# This is needed on windows because windows doen't copy globals from parent process whili multiprocessing
|
# This is needed on windows because windows doesn't copy globals from parent process while multiprocessing
|
||||||
global is_windows
|
global is_windows
|
||||||
is_windows = glob_var[0]
|
is_windows = glob_var[0]
|
||||||
global options
|
global options
|
||||||
@@ -361,13 +361,44 @@ def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test
|
|||||||
else:
|
else:
|
||||||
olddir = ""
|
olddir = ""
|
||||||
|
|
||||||
|
# by default, the thread is presumed to fail
|
||||||
|
queue_error.put('ERROR')
|
||||||
compile_error_files = [ ]
|
compile_error_files = [ ]
|
||||||
|
run_succeed_files = [ ]
|
||||||
run_error_files = [ ]
|
run_error_files = [ ]
|
||||||
skip_files = [ ]
|
skip_files = [ ]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
filename = queue.get()
|
if not queue.empty():
|
||||||
if (filename == 'STOP'):
|
filename = queue.get()
|
||||||
queue_ret.put((compile_error_files, run_error_files, skip_files))
|
if check_test(filename):
|
||||||
|
try:
|
||||||
|
(compile_error, run_error) = run_test(filename)
|
||||||
|
except:
|
||||||
|
# This is in case the child has unexpectedly died or some other exception happened
|
||||||
|
# it`s not what we wanted, so we leave ERROR in queue_error
|
||||||
|
print_debug("ERROR: run_test function raised an exception: %s\n" % (sys.exc_info()[1]), s, run_tests_log)
|
||||||
|
# minus one thread, minus one STOP
|
||||||
|
queue_finish.get()
|
||||||
|
# needed for queue join
|
||||||
|
queue_finish.task_done()
|
||||||
|
# exiting the loop, returning from the thread
|
||||||
|
break
|
||||||
|
|
||||||
|
if compile_error == 0 and run_error == 0:
|
||||||
|
run_succeed_files += [ filename ]
|
||||||
|
if compile_error != 0:
|
||||||
|
compile_error_files += [ filename ]
|
||||||
|
if run_error != 0:
|
||||||
|
run_error_files += [ filename ]
|
||||||
|
|
||||||
|
with mutex:
|
||||||
|
update_progress(filename, total_tests_arg, counter, max_test_length_arg)
|
||||||
|
else:
|
||||||
|
skip_files += [ filename ]
|
||||||
|
|
||||||
|
else:
|
||||||
|
queue_ret.put((compile_error_files, run_error_files, skip_files, run_succeed_files))
|
||||||
if is_windows:
|
if is_windows:
|
||||||
try:
|
try:
|
||||||
os.remove("test_static.obj")
|
os.remove("test_static.obj")
|
||||||
@@ -381,24 +412,15 @@ def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test
|
|||||||
except:
|
except:
|
||||||
None
|
None
|
||||||
|
|
||||||
sys.exit(0)
|
# the next line is crucial for error indication!
|
||||||
|
# this thread ended correctly, so take ERROR back
|
||||||
if check_test(filename):
|
queue_error.get()
|
||||||
try:
|
# minus one thread, minus one STOP
|
||||||
(compile_error, run_error) = run_test(filename)
|
queue_finish.get()
|
||||||
except:
|
# needed for queue join
|
||||||
print_debug("ERROR: run_test function raised an exception: %s\n" % (sys.exc_info()[1]), s, run_tests_log)
|
queue_finish.task_done()
|
||||||
sys.exit(-1) # This is in case the child has unexpectedly died or some other exception happened
|
# exiting the loop, returning from the thread
|
||||||
|
break
|
||||||
if compile_error != 0:
|
|
||||||
compile_error_files += [ filename ]
|
|
||||||
if run_error != 0:
|
|
||||||
run_error_files += [ filename ]
|
|
||||||
|
|
||||||
with mutex:
|
|
||||||
update_progress(filename, total_tests_arg, counter, max_test_length_arg)
|
|
||||||
else:
|
|
||||||
skip_files += [ filename ]
|
|
||||||
|
|
||||||
|
|
||||||
def sigint(signum, frame):
|
def sigint(signum, frame):
|
||||||
@@ -518,7 +540,7 @@ def verify():
|
|||||||
f_lines = f.readlines()
|
f_lines = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
check = [["g++", "clang++", "cl"],["-O0", "-O2"],["x86","x86-64"],
|
check = [["g++", "clang++", "cl"],["-O0", "-O2"],["x86","x86-64"],
|
||||||
["Linux","Windows","Mac"],["LLVM 3.1","LLVM 3.2","LLVM 3.3","LLVM 3.4","LLVM trunk"],
|
["Linux","Windows","Mac"],["LLVM 3.2","LLVM 3.3","LLVM 3.4","LLVM 3.5","LLVM trunk"],
|
||||||
["sse2-i32x4", "sse2-i32x8", "sse4-i32x4", "sse4-i32x8", "sse4-i16x8",
|
["sse2-i32x4", "sse2-i32x8", "sse4-i32x4", "sse4-i32x8", "sse4-i16x8",
|
||||||
"sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8",
|
"sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8",
|
||||||
"avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4",
|
"avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4",
|
||||||
@@ -543,7 +565,7 @@ def run_tests(options1, args, print_version):
|
|||||||
global s
|
global s
|
||||||
s = options.silent
|
s = options.silent
|
||||||
|
|
||||||
# prepare run_tests_log and fail_db files
|
# prepare run_tests_log and fail_db file
|
||||||
global run_tests_log
|
global run_tests_log
|
||||||
if options.in_file:
|
if options.in_file:
|
||||||
run_tests_log = os.getcwd() + os.sep + options.in_file
|
run_tests_log = os.getcwd() + os.sep + options.in_file
|
||||||
@@ -715,6 +737,7 @@ def run_tests(options1, args, print_version):
|
|||||||
total_tests = len(files)
|
total_tests = len(files)
|
||||||
|
|
||||||
compile_error_files = [ ]
|
compile_error_files = [ ]
|
||||||
|
run_succeed_files = [ ]
|
||||||
run_error_files = [ ]
|
run_error_files = [ ]
|
||||||
skip_files = [ ]
|
skip_files = [ ]
|
||||||
|
|
||||||
@@ -726,10 +749,16 @@ def run_tests(options1, args, print_version):
|
|||||||
q = multiprocessing.Queue()
|
q = multiprocessing.Queue()
|
||||||
for fn in files:
|
for fn in files:
|
||||||
q.put(fn)
|
q.put(fn)
|
||||||
for x in range(nthreads):
|
# qret is a queue for returned data
|
||||||
q.put('STOP')
|
|
||||||
qret = multiprocessing.Queue()
|
qret = multiprocessing.Queue()
|
||||||
qskip = multiprocessing.Queue()
|
# qerr is an error indication queue
|
||||||
|
qerr = multiprocessing.Queue()
|
||||||
|
# qfin is a waiting queue: JoinableQueue has join() and task_done() methods
|
||||||
|
qfin = multiprocessing.JoinableQueue()
|
||||||
|
|
||||||
|
# for each thread, there is a STOP in qfin to synchronize execution
|
||||||
|
for x in range(nthreads):
|
||||||
|
qfin.put('STOP')
|
||||||
|
|
||||||
# need to catch sigint so that we can terminate all of the tasks if
|
# need to catch sigint so that we can terminate all of the tasks if
|
||||||
# we're interrupted
|
# we're interrupted
|
||||||
@@ -744,31 +773,59 @@ def run_tests(options1, args, print_version):
|
|||||||
global task_threads
|
global task_threads
|
||||||
task_threads = [0] * nthreads
|
task_threads = [0] * nthreads
|
||||||
for x in range(nthreads):
|
for x in range(nthreads):
|
||||||
task_threads[x] = multiprocessing.Process(target=run_tasks_from_queue, args=(q, qret, qskip, total_tests,
|
task_threads[x] = multiprocessing.Process(target=run_tasks_from_queue, args=(q, qret, qerr, qfin, total_tests,
|
||||||
max_test_length, finished_tests_counter, finished_tests_counter_lock, glob_var))
|
max_test_length, finished_tests_counter, finished_tests_counter_lock, glob_var))
|
||||||
task_threads[x].start()
|
task_threads[x].start()
|
||||||
|
|
||||||
# wait for them to all finish and then return the number that failed
|
# wait for them all to finish and rid the queue of STOPs
|
||||||
# (i.e. return 0 if all is ok)
|
# join() here just waits for synchronization
|
||||||
for t in task_threads:
|
qfin.join()
|
||||||
t.join()
|
|
||||||
if options.non_interactive == False:
|
if options.non_interactive == False:
|
||||||
print_debug("\n", s, run_tests_log)
|
print_debug("\n", s, run_tests_log)
|
||||||
|
|
||||||
|
|
||||||
for jb in task_threads:
|
|
||||||
if not jb.exitcode == 0:
|
|
||||||
raise OSError(2, 'Some test subprocess has thrown an exception', '')
|
|
||||||
|
|
||||||
|
|
||||||
temp_time = (time.time() - start_time)
|
temp_time = (time.time() - start_time)
|
||||||
elapsed_time = time.strftime('%Hh%Mm%Ssec.', time.gmtime(temp_time))
|
elapsed_time = time.strftime('%Hh%Mm%Ssec.', time.gmtime(temp_time))
|
||||||
|
|
||||||
while not qret.empty():
|
while not qret.empty():
|
||||||
(c, r, skip) = qret.get()
|
(c, r, skip, ss) = qret.get()
|
||||||
compile_error_files += c
|
compile_error_files += c
|
||||||
run_error_files += r
|
run_error_files += r
|
||||||
skip_files += skip
|
skip_files += skip
|
||||||
|
run_succeed_files += ss
|
||||||
|
|
||||||
|
# Detect opt_set
|
||||||
|
if options.no_opt == True:
|
||||||
|
opt = "-O0"
|
||||||
|
else:
|
||||||
|
opt = "-O2"
|
||||||
|
|
||||||
|
try:
|
||||||
|
common.ex_state.add_to_rinf_testall(total_tests)
|
||||||
|
for fname in skip_files:
|
||||||
|
# We do not add skipped tests to test table as we do not know the test result
|
||||||
|
common.ex_state.add_to_rinf(options.arch, opt, options.target, 0, 0, 0, 1)
|
||||||
|
|
||||||
|
for fname in compile_error_files:
|
||||||
|
common.ex_state.add_to_tt(fname, options.arch, opt, options.target, 0, 1)
|
||||||
|
common.ex_state.add_to_rinf(options.arch, opt, options.target, 0, 0, 1, 0)
|
||||||
|
|
||||||
|
for fname in run_error_files:
|
||||||
|
common.ex_state.add_to_tt(fname, options.arch, opt, options.target, 1, 0)
|
||||||
|
common.ex_state.add_to_rinf(options.arch, opt, options.target, 0, 1, 0, 0)
|
||||||
|
|
||||||
|
for fname in run_succeed_files:
|
||||||
|
common.ex_state.add_to_tt(fname, options.arch, opt, options.target, 0, 0)
|
||||||
|
common.ex_state.add_to_rinf(options.arch, opt, options.target, 1, 0, 0, 0)
|
||||||
|
|
||||||
|
except:
|
||||||
|
print_debug("Exception in ex_state. Skipping...", s, run_tests_log)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# if all threads ended correctly, qerr is empty
|
||||||
|
if not qerr.empty():
|
||||||
|
raise OSError(2, 'Some test subprocess has thrown an exception', '')
|
||||||
|
|
||||||
if options.non_interactive:
|
if options.non_interactive:
|
||||||
print_debug(" Done %d / %d\n" % (finished_tests_counter.value, total_tests), s, run_tests_log)
|
print_debug(" Done %d / %d\n" % (finished_tests_counter.value, total_tests), s, run_tests_log)
|
||||||
|
|||||||
2
stmt.cpp
2
stmt.cpp
@@ -48,7 +48,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
|
|||||||
137
tt_dump_read.py
Executable file
137
tt_dump_read.py
Executable file
@@ -0,0 +1,137 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014, Intel Corporation
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are
|
||||||
|
# met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# * Neither the name of Intel Corporation nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived from
|
||||||
|
# this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# // Authors: Anton Mitrokhin
|
||||||
|
|
||||||
|
from optparse import OptionParser
|
||||||
|
from common import *
|
||||||
|
import pickle, re
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def read_test_table(filename):
|
||||||
|
with open(filename, 'r') as fp:
|
||||||
|
tt = pickle.load(fp)
|
||||||
|
return tt
|
||||||
|
|
||||||
|
|
||||||
|
def print_with_specific_results(tests, runfailed, compfailed):
|
||||||
|
for test in tests:
|
||||||
|
for test_case in test.test_cases:
|
||||||
|
if test_case.result == TestResult(runfailed, compfailed):
|
||||||
|
print test.name.rjust(40) + repr(test_case).rjust(50)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def check_rev_in_tt(tt, rev, tt_location):
|
||||||
|
if not rev in tt.table.keys():
|
||||||
|
print "Unable to locate", rev, "in table", tt_location
|
||||||
|
print "Available LLVM revisions:", tt.table.keys()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# parsing options
|
||||||
|
class MyParser(OptionParser):
|
||||||
|
def format_epilog(self, formatter):
|
||||||
|
return self.epilog
|
||||||
|
|
||||||
|
examples = ("Examples:\n" +
|
||||||
|
"Load test_table object\n\tregression_read.py -l 'test_table.dump'\n" +
|
||||||
|
"Show runfailed, compfailed and succeed tests in rev '213493'\n\t" +
|
||||||
|
"regression_read.py -l 'test_table.dump' -r '213493' --succeed --runfailed --compfailed\n" +
|
||||||
|
"Show regression between two revisions\n\t" +
|
||||||
|
"regression_read.py -l 'test_table.dump' -R '210929 213493'\n")
|
||||||
|
|
||||||
|
parser = MyParser(usage="Usage: regression_read.py -l [options]", epilog=examples)
|
||||||
|
parser.add_option('-l', '--load-tt', dest='load_tt',
|
||||||
|
help='load TestTable() from file', default=None)
|
||||||
|
parser.add_option('-r', '--revision', dest='revision',
|
||||||
|
help='show only specified revision', default=None)
|
||||||
|
parser.add_option('--runfailed', dest='runfailed',
|
||||||
|
help='show runfailed tests', default=False, action='store_true')
|
||||||
|
parser.add_option('--compfailed', dest='compfailed',
|
||||||
|
help='show compfailed tests', default=False, action='store_true')
|
||||||
|
parser.add_option('--succeed', dest='succeed',
|
||||||
|
help='show succeed tests', default=False, action='store_true')
|
||||||
|
parser.add_option('-R', '--regression', dest='regression',
|
||||||
|
help='show regression between two specified revisions', default="")
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
if (options.load_tt == None):
|
||||||
|
parser.print_help()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
tt = read_test_table(options.load_tt)
|
||||||
|
print "Available LLVM revisions:", tt.table.keys()
|
||||||
|
|
||||||
|
if options.revision != None:
|
||||||
|
check_rev_in_tt(tt, options.revision, options.load_tt)
|
||||||
|
revisions = [options.revision]
|
||||||
|
else:
|
||||||
|
revisions = tt.table.keys()
|
||||||
|
|
||||||
|
|
||||||
|
# print test cases
|
||||||
|
if (options.succeed):
|
||||||
|
print "\n\n Succeed:"
|
||||||
|
for rev in revisions:
|
||||||
|
print "Revision %s" % (rev)
|
||||||
|
print_with_specific_results(tt.table[rev], 0, 0)
|
||||||
|
|
||||||
|
if (options.runfailed):
|
||||||
|
print "\n\n Runfailed:"
|
||||||
|
for rev in revisions:
|
||||||
|
print "Revision %s" % (rev)
|
||||||
|
print_with_specific_results(tt.table[rev], 1, 0)
|
||||||
|
|
||||||
|
if (options.compfailed):
|
||||||
|
print "\n\n Compfailed:"
|
||||||
|
for rev in revisions:
|
||||||
|
print "Revision %s" % (rev)
|
||||||
|
print_with_specific_results(tt.table[rev], 0, 1)
|
||||||
|
|
||||||
|
|
||||||
|
# print regression
|
||||||
|
if options.regression != "":
|
||||||
|
regr_revs = re.split('\ ', options.regression)
|
||||||
|
if len(regr_revs) != 2:
|
||||||
|
print "Invalid input:", regr_revs
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
check_rev_in_tt(tt, regr_revs[0], options.load_tt)
|
||||||
|
check_rev_in_tt(tt, regr_revs[1], options.load_tt)
|
||||||
|
|
||||||
|
print tt.regression(regr_revs[0], regr_revs[1])
|
||||||
|
|
||||||
|
|
||||||
23
type.cpp
23
type.cpp
@@ -43,14 +43,14 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Value.h>
|
#include <llvm/Value.h>
|
||||||
#include <llvm/Module.h>
|
#include <llvm/Module.h>
|
||||||
#else
|
#else
|
||||||
#include <llvm/IR/Value.h>
|
#include <llvm/IR/Value.h>
|
||||||
#include <llvm/IR/Module.h>
|
#include <llvm/IR/Module.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LLVM_3_5)
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
#include <llvm/IR/DebugInfo.h>
|
#include <llvm/IR/DebugInfo.h>
|
||||||
#include <llvm/IR/DIBuilder.h>
|
#include <llvm/IR/DIBuilder.h>
|
||||||
#else
|
#else
|
||||||
@@ -830,9 +830,7 @@ EnumType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
32 /* size in bits */,
|
32 /* size in bits */,
|
||||||
32 /* align in bits */,
|
32 /* align in bits */,
|
||||||
elementArray
|
elementArray
|
||||||
#if !defined(LLVM_3_1)
|
|
||||||
, llvm::DIType()
|
, llvm::DIType()
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -2205,7 +2203,7 @@ StructType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
currentSize, // Size in bits
|
currentSize, // Size in bits
|
||||||
align, // Alignment in bits
|
align, // Alignment in bits
|
||||||
0, // Flags
|
0, // Flags
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
llvm::DIType(), // DerivedFrom
|
llvm::DIType(), // DerivedFrom
|
||||||
#endif
|
#endif
|
||||||
elements);
|
elements);
|
||||||
@@ -2448,7 +2446,7 @@ UndefinedStructType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
0, // Size
|
0, // Size
|
||||||
0, // Align
|
0, // Align
|
||||||
0, // Flags
|
0, // Flags
|
||||||
#if !defined(LLVM_3_1) && !defined(LLVM_3_2)
|
#if !defined(LLVM_3_2)
|
||||||
llvm::DIType(), // DerivedFrom
|
llvm::DIType(), // DerivedFrom
|
||||||
#endif
|
#endif
|
||||||
elements);
|
elements);
|
||||||
@@ -2711,12 +2709,8 @@ ReferenceType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
llvm::DIType diTargetType = targetType->GetDIType(scope);
|
llvm::DIType diTargetType = targetType->GetDIType(scope);
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
return m->diBuilder->createReferenceType(diTargetType);
|
|
||||||
#else
|
|
||||||
return m->diBuilder->createReferenceType(llvm::dwarf::DW_TAG_reference_type,
|
return m->diBuilder->createReferenceType(llvm::dwarf::DW_TAG_reference_type,
|
||||||
diTargetType);
|
diTargetType);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2987,7 +2981,8 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
for (int i = 0; i < GetNumParameters(); ++i) {
|
for (int i = 0; i < GetNumParameters(); ++i) {
|
||||||
const Type *t = GetParameterType(i);
|
const Type *t = GetParameterType(i);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
#if defined(LLVM_3_4) || defined(LLVM_3_5)
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)// LLVM 3.4+
|
||||||
return llvm::DICompositeType();
|
return llvm::DICompositeType();
|
||||||
#else
|
#else
|
||||||
return llvm::DIType();
|
return llvm::DIType();
|
||||||
@@ -2995,8 +2990,14 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
|
|||||||
retArgTypes.push_back(t->GetDIType(scope));
|
retArgTypes.push_back(t->GetDIType(scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) // LLVM 3.6+
|
||||||
|
llvm::DITypeArray retArgTypesArray =
|
||||||
|
m->diBuilder->getOrCreateTypeArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
|
||||||
|
#else
|
||||||
llvm::DIArray retArgTypesArray =
|
llvm::DIArray retArgTypesArray =
|
||||||
m->diBuilder->getOrCreateArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
|
m->diBuilder->getOrCreateArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
|
||||||
|
#endif
|
||||||
|
|
||||||
llvm::DIType diType =
|
llvm::DIType diType =
|
||||||
// FIXME: DIFile
|
// FIXME: DIFile
|
||||||
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);
|
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);
|
||||||
|
|||||||
2
type.h
2
type.h
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "ispc.h"
|
#include "ispc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Type.h>
|
#include <llvm/Type.h>
|
||||||
#include <llvm/DerivedTypes.h>
|
#include <llvm/DerivedTypes.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
10
util.cpp
10
util.cpp
@@ -65,9 +65,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_2)
|
||||||
#include <llvm/Target/TargetData.h>
|
|
||||||
#elif defined(LLVM_3_2)
|
|
||||||
#include <llvm/DataLayout.h>
|
#include <llvm/DataLayout.h>
|
||||||
#else // LLVM 3.3+
|
#else // LLVM 3.3+
|
||||||
#include <llvm/IR/DataLayout.h>
|
#include <llvm/IR/DataLayout.h>
|
||||||
@@ -616,13 +614,9 @@ VerifyDataLayoutCompatibility(const std::string &module_dl,
|
|||||||
// which contradic: f80:128:128 followed by f80:32:32. This is a bug, but
|
// which contradic: f80:128:128 followed by f80:32:32. This is a bug, but
|
||||||
// correct thing to do is to interpret this exactly how LLVM would treat it,
|
// correct thing to do is to interpret this exactly how LLVM would treat it,
|
||||||
// so we create a DataLayout class and take its string representation.
|
// so we create a DataLayout class and take its string representation.
|
||||||
#if defined(LLVM_3_1)
|
|
||||||
llvm::TargetData d1(module_dl);
|
|
||||||
llvm::TargetData d2(lib_dl);
|
|
||||||
#else // LLVM 3.2+
|
|
||||||
llvm::DataLayout d1(module_dl);
|
llvm::DataLayout d1(module_dl);
|
||||||
llvm::DataLayout d2(lib_dl);
|
llvm::DataLayout d2(lib_dl);
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string module_dl_canonic = d1.getStringRepresentation();
|
std::string module_dl_canonic = d1.getStringRepresentation();
|
||||||
std::string lib_dl_canonic = d2.getStringRepresentation();
|
std::string lib_dl_canonic = d2.getStringRepresentation();
|
||||||
|
|||||||
Reference in New Issue
Block a user