On Sun, Nov 5, 2017 at 10:07 AM, Alek Mabry <alekmabr...@gmail.com> wrote:
> > > However in the C code, I have no idea what it's actually doing in assembly. > > Take a function for example, if I make a void function, will the assembler > have a command that jumps to that part of the code, and then jumps back > (adding two cycles or so), or will it just insert that code into wherever > the function is called? > Well, the C compiler is just essentially generating machine code, just lilke assembler---it's just that in assembler you specify the instructions, so there's a simple 1:1 correspondence. You can force the compiler to list the generated assembly and count instructions. You can also inject assembly into your function using asm() compiler extensions; typically, you would insert such assembly in the middle of a function. You can also call your C functions from such assembly but it's a little tricky because you have to observe the compiler ABI for register saving, stack operations and parameter passing. > > Is there any way to force the C program to do something in a specified > number of cycles, figure out how many cycles the C code is taking, or just > write assembly for time-critical parts directly into the C code itself? > You can inspect the generated code, and count instructions to get the cycles. You obviously can't force the compiler to use less cycles than it already uses in an optimized compile, but you can in principle pad with NOPs to artificially increase the cycle count. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgE6st78w%3DWSqc%3DviFEvdWvJ%2BPFP9oEWXjHxQ13cjMkq%2Bw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.