bpf: Use pattern_cost() for instruction cost estimation
BPF backend now uses a generic pattern_cost() function instead of hardcoding instruction costs.
The BPF backend has been updated to use the generic pattern_cost() function for estimating instruction costs, replacing a hardcoded value of 1. This change aligns the BPF backend with practices in other GCC backends, providing a more consistent and flexible way to manage instruction costs. The cost of a default instruction is now determined by its associated pattern, allowing for finer-grained cost modeling.
In Details
This commit modifies the TARGET_INSN_COST definition for the BPF backend. Previously, it hardcoded a cost of 1 for all instructions. Now, it delegates to pattern_cost(), a common function across GCC backends that retrieves the cost associated with an instruction's pattern in the machine description. This change allows for more accurate cost modeling, as different instruction patterns can now have distinct costs, influencing optimization decisions.
- BPF
- Berkeley Packet Filter, a technology allowing sandboxed programs to make safe network packet filtering and handling.
- TARGET_INSN_COST
- A GCC target hook that provides a cost for a given instruction, used by the optimizer to select the most efficient code sequences.
- pattern_cost()
- A function in GCC that returns the cost associated with a specific instruction pattern defined in the machine description.