レジスタ割り当てとは?
レジスタ割り当ては、プログラムが使う多数の値を、CPUの小さく固定された数のレジスタに割り当てるコード生成のフェーズです。レジスタよりも生存している値が多い場合、一部はメモリへスピルされ、後で再ロードされます。しばしばグラフ彩色としてモデル化される良い割り当ては、そのコストの高いスピルを最小化します。
なぜ重要か
レジスタはメモリよりはるかに高速なので、値がどのように割り当てられるかは生成コードの速度を直接左右します。過度なスピルは、コンパイル結果が期待より遅くなる一般的な原因です。
関連ガイド
What Is Instruction Scheduling?Instruction scheduling reorders machine instructions to keep the CPU pipeline busy and hide latencies, withou…
What Is Strength Reduction?Strength reduction replaces expensive operations with cheaper equivalent ones, such as turning a multiplicati…
What Is a Basic Block?A basic block is a straight-line sequence of instructions with one entry and one exit, used as the unit of an…