Programming microcontrollers in ASM or C & how it's done
A compiler can (for the purpose of your question) be divided in two parts:


The first part reads your code, analyzes it and checks it for errors, and does all kinds of clever things with it that have no relation with the target computer
The second part takes the output of the first part and translates it into a sequence of machine instructions (either in textual form, or in binary form, or both).


The second part is specific for the CPU on which your program must run. If you want to run on a PIC 16F, you must have a compiler that generates machine instructions for that specific chip, and often the compiler will need to know the exact chip for which you are compiling. 

For an AVR, ARM, Cortex, MIPs, etc CPU you will need a different compiler. There are compilers that contain the second part (the back-end) for more than one target. In that case you must somehow specify which of the back-ends must be used.