change makefile for a VEX benchmark to use in LLVM-to-VEX chain
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
change makefile for a VEX benchmark to use in LLVM-to-VEX chain
Hi Everyone,
The thing I would like to do is changing a benchmark Makefile; to be precise "H264decoder", which is placed inside the VEX open-source compiler "apps" folder; in a way that I can reuse it in my so-far built automated scripts. My scripts gett the .c file as the input and enter it to a chain of LLVM-to-VEX compilation with optimization parameters.
The only difference between the (gsm.c) becnhmark (which I already did) and the new one is that h264decoder has lots of inter-nested source and header files in which practically there won't be an easy way to combine them into just one clean file ( I tried, you can see the the thread still opens after a month here :
So to wrap up the question, Does anyone can help me change this part of my scripts (which was for gsm.c- one file) and use the h264 makefile of VEX to do the same for h264 ?
my Scripts:
Code:
#########################################################
echo "Compiling\n"
mkdir -p log bin opt opt/tmp
echo "C to C"
/home/user/gw_opt_order/tools/C2C/C-opt-C.sh -c opt.cfg -s $TARGET_FILE_DIR -w opt/tmp -o opt > log/swat_opt.log 2>&1
mv opt/*.c opt/llvm_transformed.c
#mv opt/ldecod.c opt/llvm_transformed.c
#sed -i 's/signed long long/unsigned long/g' opt/llvm_transformed.c
sed -i 's/0ull/0ul/g' opt/llvm_transformed.c
sed -i 's/1ull/1ul/g' opt/llvm_transformed.c
sed -i 's/2ull/2ul/g' opt/llvm_transformed.c
sed -i 's/3ull/3ul/g' opt/llvm_transformed.c
sed -i 's/4ull/4ul/g' opt/llvm_transformed.c
sed -i 's/5ull/5ul/g' opt/llvm_transformed.c
sed -i 's/6ull/6ul/g' opt/llvm_transformed.c
sed -i 's/7ull/7ul/g' opt/llvm_transformed.c
sed -i 's/8ull/8ul/g' opt/llvm_transformed.c
sed -i 's/9ull/9ul/g' opt/llvm_transformed.c
echo "C to Vex"
#/home/user/VEX/vex-3.43/bin/cc -ms -O1 -c99inline -fmm=MachConf.mm -I/usr/include/ -c opt/llvm_transformed.c > log/vex.log 2>&1
/home/user/VEX/vex-3.43/bin/cc -ms -O1 -c99inline -fmm=MachConf.mm -I/usr/include/ -c opt/llvm_transformed.c
echo "Vex to obj"
/home/user/VEX/vex-3.43/bin/cc -o bin/run_inst llvm_transformed.o -lm
bin/run_inst
1- get the parameters
2- Compile with LLVM (with the mentioned -o levels)
3- get the transformed files
4- input and compile with VEX
5- ./RUN
6- get the log file
BUT, h264 has to be like this:
1- get the parameters
2- for each of the .c files (around 10-15 files)
{
- Compile with LLVM
- get the transformed file
- input and compile with VEX
}
3- ./RUN
4- get the log file
sed -i 's/0ull/0ul/g' opt/llvm_transformed.c
sed -i 's/1ull/1ul/g' opt/llvm_transformed.c
sed -i 's/2ull/2ul/g' opt/llvm_transformed.c
sed -i 's/3ull/3ul/g' opt/llvm_transformed.c
sed -i 's/4ull/4ul/g' opt/llvm_transformed.c
sed -i 's/5ull/5ul/g' opt/llvm_transformed.c
sed -i 's/6ull/6ul/g' opt/llvm_transformed.c
sed -i 's/7ull/7ul/g' opt/llvm_transformed.c
sed -i 's/8ull/8ul/g' opt/llvm_transformed.c
sed -i 's/9ull/9ul/g' opt/llvm_transformed.c
Can be replaced with
Code:
sed -i 's/\([0-9]\)ull/\1ul/g' opt/llvm_transformed.c
Code:
echo "C to Vex" # this is really "C to Vex obj"
#/home/user/VEX/vex-3.43/bin/cc -ms -O1 -c99inline -fmm=MachConf.mm -I/usr/include/ -c opt/llvm_transformed.c > log/vex.log 2>&1
/home/user/VEX/vex-3.43/bin/cc -ms -O1 -c99inline -fmm=MachConf.mm -I/usr/include/ -c opt/llvm_transformed.c
echo "Vex to obj" # this is really "Vex obj to Vex executable"
/home/user/VEX/vex-3.43/bin/cc -o bin/run_inst llvm_transformed.o -lm
bin/run_inst
Putting the transformation and compilation in a loop should go something like this (untested):
Code:
for cfile in opt/*.c ; do
llvm_cfile=opt/llvm_transformed_$(basename "$cfile")
mv "$cfile" "$llvm_cfile"
sed -i 's/\([0-9]\)ull/\1ul/g' "$llvm_cfile"
echo "C to Vex obj"
/home/user/VEX/vex-3.43/bin/cc -ms -O1 -c99inline -fmm=MachConf.mm -I/usr/include/ -c "$llvm_cfile"
done
echo "Vex objs to Vex executable"
/home/user/VEX/vex-3.43/bin/cc -o bin/run_inst llvm_transformed_*.o -lm
bin/run_inst
Oh Sorry, I forgot to comment the first remaining line (mv opt/*.c opt/llvm_transformed.c) , you nicely included those loop in your codes before as I saw now
I executed the iterations, these are the errors now:
Code:
Compiling
C to C
C to Vex obj
opt/llvm_transformed_annexb.c:30: warning: `__attribute__' redefined
/usr/include/sys/cdefs.h:200: warning: this is the location of the previous definition
"opt/llvm_transformed_annexb.c", line 1416: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1435: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1445: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1521: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1597: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1631: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1658: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1670: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1713: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1740: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1814: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1824: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1833: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1839: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1848: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1884: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1893: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1899: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1908: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1987: error: parameter of incompatible type passed to arg `1'
"opt/llvm_transformed_annexb.c", line 904: error: redeclaration of formal parameter, llvm_cbe_fn
"opt/llvm_transformed_annexb.c", line 1020: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1020: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1021: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1021: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1021: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1021: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1022: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1022: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1022: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1023: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1023: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1023: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1024: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1024: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1024: warning: illegal combination of pointer and integer, op <
"opt/llvm_transformed_annexb.c", line 1025: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1025: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1025: warning: illegal combination of pointer and integer, op >
"opt/llvm_transformed_annexb.c", line 1026: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1026: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1026: warning: illegal combination of pointer and integer, op <=
"opt/llvm_transformed_annexb.c", line 1027: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1027: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1027: warning: illegal combination of pointer and integer, op >=
"opt/llvm_transformed_annexb.c", line 1028: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1028: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1028: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1029: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1029: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1029: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1030: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1030: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1030: warning: illegal combination of pointer and integer, op <
"opt/llvm_transformed_annexb.c", line 1031: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1031: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1031: warning: illegal combination of pointer and integer, op >
"opt/llvm_transformed_annexb.c", line 1032: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1032: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1032: warning: illegal combination of pointer and integer, op <=
"opt/llvm_transformed_annexb.c", line 1033: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1033: compiler error: too many errors
--(MGW)--> WARNING Execution Failed
Here I attached the .c file. (opt/llvm_transformed_annexb.c)
The line numbers in the error messages don't seem to match up to the file you attached. The error messages mention line 1987, but there are only 1938 lines in the file you attached.
Is the Vex a 16bit machine? It looks like the code assumes ints are 32bit.
Sorry man, the point is I think, i attached the wrong file. Since each iteration error's line is different from the other!!
so this is the new errors :
Code:
C to C
C to Vex obj
opt/llvm_transformed_annexb.c:30: warning: `__attribute__' redefined
/usr/include/sys/cdefs.h:200: warning: this is the location of the previous definition
"opt/llvm_transformed_annexb.c", line 1386: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1408: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1418: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1493: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1578: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1583: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1596: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1617: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1644: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1671: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1760: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1787: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1802: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1819: warning: loop not entered at top
"opt/llvm_transformed_annexb.c", line 1824: error: value too large to represent
"opt/llvm_transformed_annexb.c", line 1837: warning: statement not reached
"opt/llvm_transformed_annexb.c", line 1912: error: parameter of incompatible type passed to arg `1'
"opt/llvm_transformed_annexb.c", line 904: error: redeclaration of formal parameter, llvm_cbe_fn
"opt/llvm_transformed_annexb.c", line 1020: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1020: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1021: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1021: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1021: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1021: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1022: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1022: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1022: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1023: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1023: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1023: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1024: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1024: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1024: warning: illegal combination of pointer and integer, op <
"opt/llvm_transformed_annexb.c", line 1025: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1025: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1025: warning: illegal combination of pointer and integer, op >
"opt/llvm_transformed_annexb.c", line 1026: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1026: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1026: warning: illegal combination of pointer and integer, op <=
"opt/llvm_transformed_annexb.c", line 1027: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1027: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1027: warning: illegal combination of pointer and integer, op >=
"opt/llvm_transformed_annexb.c", line 1028: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1028: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1028: warning: illegal combination of pointer and integer, op ==
"opt/llvm_transformed_annexb.c", line 1029: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1029: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1029: warning: illegal combination of pointer and integer, op !=
"opt/llvm_transformed_annexb.c", line 1030: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1030: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1030: warning: illegal combination of pointer and integer, op <
"opt/llvm_transformed_annexb.c", line 1031: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1031: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1031: warning: illegal combination of pointer and integer, op >
"opt/llvm_transformed_annexb.c", line 1032: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1032: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1032: warning: illegal combination of pointer and integer, op <=
"opt/llvm_transformed_annexb.c", line 1033: error: redeclaration of formal parameter, X
"opt/llvm_transformed_annexb.c", line 1033: error: redeclaration of formal parameter, Y
"opt/llvm_transformed_annexb.c", line 1033: warning: illegal combination of pointer and integer, op >=
"opt/llvm_transformed_annexb.c", line 1047: warning: illegal combination of pointer and integer, op =
"opt/llvm_transformed_annexb.c", line 1048: warning: illegal combination of pointer and integer, op =
"opt/llvm_transformed_annexb.c", line 1059: error: redeclaration of formal parameter, llvm_cbe_a
"opt/llvm_transformed_annexb.c", line 1059: compiler error: too many errors
--(MGW)--> WARNING Execution Failed
and attached please consider the corresponding .c file.
The comment goes with following code line, not the preceding:
Code:
### Generate 32 bit executable : 1=yes, 0=no
M32?= 0
The rest of the Makefile doesn't actually use M32 for anything, so I'm not sure what it's good for. Also it's unclear to me what happens when 32bit is no: do we get a 16bit or 64bit executable?
You never explained why you have the sed ull --> ul thing in the first place; did you try removing it?
As far as I know, we used this to change from unsigned long long to long format in case of inputting them into vex which has the 32bit input architecture, but I don't know why it is working with gsm.c but not with h264, the point is I am using the h264decoder which is placed inside the vex embedded benchmarks, so it should be a problem with my scripts because when I directly use the make command, the MakeFile use the cc of the vex and make it without any problem...
As far as I know, we used this to change from unsigned long long to long format in case of inputting them into vex which has the 32bit input architecture, but I don't know why it is working with gsm.c but not with h264
Maybe gsm.c didn't use long long constants so your sed command didn't do anything. In general, I don't think that command makes sense.
Quote:
the MakeFile use the cc of the vex and make it without any problem...
The Makefile is compiling completely different source files, ie the ones before the "C to C" transformation. Perhaps you need to tell C-opt-C.sh to use only 32bit constants (by changing opt.cfg)?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.