Skip to content

Commit

Permalink
added prototype of a flag --use_clang_opt to ck compile program
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Mar 8, 2019
1 parent cc65731 commit 1eb7606
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* 2019.03.08 - [FGG] added prototype of a flag --use_clang_opt to ck compile program

* 2019.03.05 - [FGG] added link to http://ReuseResearch.com

* 2019.02.08 - [FGG] improved problem reporting in third-party program workflows (pipelines)
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,9 @@ E: GitHub: @w-simon
O:
C: improving autotuning documentation and fixing bugs
W:

N: David Fernadez Lobon & Guillermo Vigueras
E:
O:
C: suggesting how to add clang/opt compilation
W:
29 changes: 27 additions & 2 deletions module/program/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ def process_in_dir(i):
or
(static or dynamic)
(use_clang_opt) - use Clang opt optimizer
(repeat) - repeat kernel via environment CT_REPEAT_MAIN if supported
(sudo) - if 'yes', force using sudo
Expand Down Expand Up @@ -383,6 +385,8 @@ def process_in_dir(i):
env=i.get('env',{})
xparams=i.get('params',{})

uco=i.get('use_clang_opt','')=='yes'

deps=i.get('deps',{})
reuse_deps=i.get('reuse_deps','')
deps_cache=i.get('deps_cache',[])
Expand Down Expand Up @@ -421,6 +425,9 @@ def process_in_dir(i):
cons=i.get('console','')

flags=i.get('flags','')
if uco:
split_flags=flags.split(' ')

lflags=i.get('lflags','')
cv=i.get('compiler_vars',{})
ncv=i.get('no_vars',{})
Expand Down Expand Up @@ -1298,7 +1305,11 @@ def process_in_dir(i):

if sbcv!='': xcfb+=' '+sbcv
if sin!='': xcfb+=' '+sin
xcfb+=' '+flags

if uco:
xcfb+=' -emit-llvm'
else:
xcfb+=' '+flags

# Linking flags
slfb=svarb+'CK_COMPILER_FLAGS_OBLIGATORY'+svare
Expand Down Expand Up @@ -1403,7 +1414,10 @@ def process_in_dir(i):
sf00=os.path.basename(sf)
sf00a,sf00b=os.path.splitext(sf00)

sfobj=sf00a+sobje
if uco:
sfobj=sf00a+'.bc'
else:
sfobj=sf00a+sobje
if sofs!='': sofs+=' '
sofs+=sfobj
xsofs.append(sfobj)
Expand All @@ -1427,6 +1441,17 @@ def process_in_dir(i):

sb+='\n'

# Check if clang opt
if uco:
for clang_opt_flag in split_flags:
sb+='\necho "\nopt '+clang_opt_flag+' -o '+sfobj+' '+sfobj+'"\n'
sb+='opt '+clang_opt_flag+' -o '+sfobj+' '+sfobj+'\n'

# Convert Clang BC to .o
if uco:
sb+='\necho "\nllc -filetype=obj '+sfobj+'"\n'
sb+='llc -filetype=obj '+sfobj+'\n\n'

# Obtaining link CMD (first from program entry, then default from this module)
if sofs!='':
linker_env=meta.get('linker_env','')
Expand Down

0 comments on commit 1eb7606

Please sign in to comment.