Compiling strong and weak branching behavior instruction blocks to separate caches for dynamic and static prediction

A method and apparatus varies branch prediction strategy associated with branch instructions in a trace of program code. The present invention first profiles branch instructions within a trace to record branching behavior. Next, the present invention partitions branch instructions into groups of bra...

Full description

Saved in:
Bibliographic Details
Main Authors SHAH; LACKY V, BUZBEE; WILLIAM B, MATTSON, JR.; JAMES S
Format Patent
LanguageEnglish
Published 05.09.2000
Edition7
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:A method and apparatus varies branch prediction strategy associated with branch instructions in a trace of program code. The present invention first profiles branch instructions within a trace to record branching behavior. Next, the present invention partitions branch instructions into groups of branch instructions that can be statically predicted and groups of branch instructions that can be dynamically predicted. Branch instructions that are profiled to have "strong" branching behavior (e.g., the same branch direction is taken 80% of the time) are placed in the group of branch instruction that are statically predicted. Branch instructions that are profiled to have "weak" branching behavior (e.g., the same branch direction is taken 60% of the time) are placed in the group of branch instruction that are dynamically predicted. Finally, branch instructions are adjusted by associating an indication of prediction strategy with each profiled branch instruction. In an embodiment of the present invention, dynamic and static code caches are defined in physical memory by allocating pools of memory pages that have prediction flags set to dynamic and static, respectively. In this embodiment, the trace is translated into the dynamic and static caches by moving branch instruction and basic blocks of code associated with branch instructions into the appropriate code cache based on the groups into which the branch instructions were partitioned. The present invention may be used when a program is originally compiled or when a program is recompiled after a profile-based optimization run. Additionally, the present invention may be used as part of a run-time optimization strategy.
Bibliography:Application Number: US19980070442