Claims
- 1. An instruction fetch control apparatus having a branch history in which an instruction address of a branch instruction and an address of a branched-to instruction for use when a branch is taken are registered as a set of data for the branch instruction, and a return address stack storing a returned-to instruction address of a subroutine when a subroutine call instruction is completely executed, comprising:
an entry designation unit designating, when an instruction fetched from a main storage device and detected as a hit in the branch history is a return instruction of a subroutine, an entry in a plurality of entries in the return address stack as an entry storing a return address of the return instruction, wherein
an instruction is fetched using the return address stored in said designated entry.
- 2. The apparatus according to claim 1, further comprising:
a return flag storage area, in the branch history, storing a flag indicating a return instruction when the branch instruction is a subroutine return instruction, wherein
said entry designation unit recognizes according to contents of said return flag storage area that the instruction fetched from the main storage device is a return instruction of a subroutine.
- 3. The apparatus according to claim 2, wherein when it is recognized according to the contents of the return flag storage area that the instruction fetched from the main storage device and detected as a hit in the branch history is a return instruction of a subroutine, a number of the entry designated by said entry designation unit is increased by one prior to execution of the branch instruction.
- 4. The apparatus according to claim 3 wherein said entry designation unit decreases the number of the designated entry by one when the return instruction of the subroutine is completely executed.
- 5. The apparatus according to claim 1, further comprising:
a call flag storage area, in the branch history, storing a flag indicating a call instruction when the branch instruction is a subroutine call instruction; wherein
when it is recognized according to the contents of the call flag storage area that the instruction fetched from the main storage device and detected as a hit in the branch history is a call instruction of a subroutine, a number of the entry designated by said entry designation unit is decreased by one prior to execution of the branch instruction.
- 6. The apparatus according to claim 5 wherein said entry designation unit increases the number of the designated entry by one when the call instruction of the subroutine is completely executed.
- 7. The apparatus according to claim 1, wherein said fetched instruction is not to be executed, and, when an instruction to be executed is re-fetched, said entry designation unit returns the designated entry to a leading entry having a smallest entry number.
- 8. The apparatus according to claim 1, wherein when said entry designation unit designates an invalid entry in the return address stack, an instruction is fetched using a branched-to address stored in the branch history.
- 9. The apparatus according to claim 1, wherein said entry designation unit can designate a non-existing virtual entry.
- 10. An instruction fetch control apparatus, comprising:
a branch history in which an instruction address of a branch instruction and an address of a branched-to instruction for use when a branch is taken are registered as a set of data for the branch instruction; a return address stack storing a returned-to instruction address of a subroutine when a subroutine call instruction is completely executed; and entry designation means for designating, when an instruction fetched from a main storage device and detected as a hit in the branch history is a return instruction of a subroutine, an entry in a plurality of entries in the return address stack as an entry storing a return address of the return instruction, wherein an instruction is fetched using the return address stored in said designated entry.
Priority Claims (1)
Number |
Date |
Country |
Kind |
10-350924 |
Dec 1998 |
JP |
|
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application is a Divisional of application Ser. No. 09/456,523, filed Dec. 8, 1999, now pending.
Divisions (1)
|
Number |
Date |
Country |
Parent |
09456523 |
Dec 1999 |
US |
Child |
10337870 |
Jan 2003 |
US |