The following tip reliably confirms the names you should use for special function registers in C code. This is useful since the C identifiers used to access registers might not always be identical to those shown in the data sheet.
Create a trivial test program (for example main.c) such as the following, which includes <xc.h>.
Compile this on the command line for your device of interest and with a command such as:
xc8 --chip=18f4520 --pre main.c
if you are using MPLAB® XC8, or something similar to:
xc32-gcc -mprocessor=32MX795F512L -E -o main.i main.c
if you are using MPLAB XC16 or XC32.
These commands use the --PRE or -E options to stop compilation after the preprocessing stage so that you will be able to examine the pre-processed output file (main.pre or main.i, respectively for this example). This output file will contain the definitions for all the device-specific special function registers and bits within those registers.
Using this technique means you do not need to find which are the relevant header files for your device and determine if conditional code is appropriate for your build; however, if you would like a list of all the files included, do the following. For XC8 compile as above, but replace the --PRE with --DEP=list,sys,stop. For XC16 or XC32, replace -E with -MD. These options will create for example main.dep or main.d dependency file which will list the full path of all headers that were included into your source.