LoongArch: Implement option save/restore
commitea2a9c76a1dcffbbec6e53655bef9236d3a8e691
authorYang Yujie <yangyujie@loongson.cn>
Thu, 11 Jan 2024 01:07:10 +0000 (11 09:07 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 11 Jan 2024 11:03:08 +0000 (11 19:03 +0800)
tree27b9fd96ad2069ad8f56478f1be1f290b9948158
parentb89ef3d40afc4604c279e8802bf279f6e4060f67
LoongArch: Implement option save/restore

LTO option streaming and target attributes both require per-function
target configuration, which is achieved via option save/restore.

We implement TARGET_OPTION_{SAVE,RESTORE} to switch the la_target
context in addition to other automatically maintained option states
(via the "Save" option property in the .opt files).

Tested on loongarch64-linux-gnu without regression.

PR target/113233

gcc/ChangeLog:

* config/loongarch/genopts/loongarch.opt.in: Mark options with
the "Save" property.
* config/loongarch/loongarch.opt: Same.
* config/loongarch/loongarch-opts.cc: Refresh -mcmodel= state
according to la_target.
* config/loongarch/loongarch.cc: Implement TARGET_OPTION_{SAVE,
RESTORE} for the la_target structure; Rename option conditions
to have the same "la_" prefix.
* config/loongarch/loongarch.h: Same.
gcc/config/loongarch/genopts/loongarch.opt.in
gcc/config/loongarch/loongarch-opts.cc
gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/loongarch.h
gcc/config/loongarch/loongarch.opt