文章目录
Contents
- 1Hardware implementation
- 2Consequences in machine architecture
- 3Consequences in high-level programming
- 4Symbol
- 5See also
synopsis
- Theprogram counter(PC), commonly called theinstruction pointer(IP) inIntelx86 andItaniummicroprocessors, and sometimes called theinstruction address register(IAR),[1] theinstruction counter,[2] or just part of the instruction sequencer,[3] is aprocessor register that indicates where acomputer is in itsprogram sequence.[nb 1]
- Usually, the PC is incremented after fetching aninstruction, and holds thememory address of (“points to”) the next instruction that would be executed.[4][nb 2]
- Processors usually fetch instructions sequentially from memory, butcontrol transferinstructions change the sequence by placing a new value in the PC. These includebranches (sometimes called jumps),subroutine calls, andreturns. A transfer that is conditional on the truth of some assertion lets the computer follow a different sequence under different conditions.
- A branch provides that the next instruction is fetched from elsewhere in memory. A subroutine call not only branches but saves the preceding contents of the PC somewhere. A return retrieves the saved contents of the PC and places it back in the PC, resuming sequential execution with the instruction following the subroutine call.