asm output

This is a discussion on asm output within the C Programming forums, part of the General Programming Boards category; How can I tell Bloodshed+minGW to produce assembler output? I'm curious to see what it's doing with my code, but ...

  1. #1
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192

    asm output

    How can I tell Bloodshed+minGW to produce assembler output? I'm curious to see what it's doing with my code, but can't find anything in the GCC/Bloodshed docs.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,443
    gcc -S prog.c
    Produces
    prog.s
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Ah! I was using lower case -s. I'll try again. Ta.

  4. #4
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    I'm glad you brought this up Jez! I'm going to be reading this after school today:
    Inline Assembly HowTO GCC I've always been afraid of Assembly.
    --EDIT--
    Or you were asking something else, nvm :(

  5. #5
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Funny, I read that yesterday kleid-0.

    No, I just wan't the intermediate assembler code that is produced from my C code. (To see why it runs so incredibly fast). In particular I'm wondering how minGW is implementing a large switch statement.

    BTW what's nvm?

  6. #6
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    nvm = nevermind :)

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Switches are ugly in asm. Lots of short jumps and conditionals. You'd be surprised how much code goes into a simple C switch.

  8. #8
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Well, I looked at it, I think it's produced a jumptable, which is nice. It'll save me making one.
    Is there a way I can get the compiler to add the source lines as comment to the assembler?

  9. #9
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Not really. And if you could it wouldn't really follow that well. The compiler will optimize some basic stuff without you even asking so the assembly code might not follow your C code. And once you turn on the optimization levels it can really look nothing like your C code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 02:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 02:29 PM
  3. ASM floating point problem
    By parad0x13 in forum C++ Programming
    Replies: 10
    Last Post: 07-22-2008, 04:54 AM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21