Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,693 Views

Optimize a single file in a project

What is the easiest way with NIOS II EDS 10.1sp1 to setup the auto-generated Makefile to optimize a single file? By default the project has optimization turned off, but I'd like to enable it on a single file to check the performance. 

 

I've tried using the optimize attribute directive, but that is getting ignored. Same with a gcc# pragma. Is there a way to do this without having to roll the file into a library? 

 

Thanks.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor I
27 Views

Personally I'd use -O2 (or -O3) all the time, unless I really suspect a compiler bug.

Altera_Forum
Honored Contributor I
27 Views

I'm doing a lot of debugging, so I don't want to optimize the entire project yet. I just want to optimize one file so I can determine how the optimization level affects the performance of one of the functions. Is there a way to do that?

Altera_Forum
Honored Contributor I
27 Views

Assuming you don't want to be writing your own makefiles I'm guessing this would work: 

 

1) Compile the code you want optimized as a library with -O2/3 and other flags 

2) Associate the compiled library to your project 

3) Compile the entire project using -O0 

 

There might be other ways to do this..... this seemed like the simplest way to me.
Altera_Forum
Honored Contributor I
27 Views

I'm trying to do that right now, but the SBT doesn't give me the option to set the optimization flags with the library. Either I'm doing something wrong, or the "New Library" path does not following the documentation at all.

Altera_Forum
Honored Contributor I
27 Views

Well that was weird. Now the library is showing up like I would have expected all along. Now I can see if the optimization of this file will help.

Altera_Forum
Honored Contributor I
27 Views

I have never created a library in the GUI but if that doesn't work you can always do that from the command line.