diff options
author | Qing Zhao <qing.zhao@oracle.com> | 2025-07-09 21:31:55 +0000 |
---|---|---|
committer | Qing Zhao <qing.zhao@oracle.com> | 2025-07-10 20:31:22 +0000 |
commit | e53f481141f1415847329f3bef906e5eb91226ad (patch) | |
tree | 97a4acaa1c2ef2b0f2a7a3128c8da3b32a915bfb /libgcc | |
parent | 1cf8d08a977f528c6e81601b7586ccf8bc8aa2a6 (diff) | |
download | gcc-e53f481141f1415847329f3bef906e5eb91226ad.zip gcc-e53f481141f1415847329f3bef906e5eb91226ad.tar.gz gcc-e53f481141f1415847329f3bef906e5eb91226ad.tar.bz2 |
Reduce the # of arguments of .ACCESS_WITH_SIZE from 6 to 4.
This is an improvement to the design of internal function .ACCESS_WITH_SIZE.
Currently, the .ACCESS_WITH_SIZE is designed as:
ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE, CLASS_OF_SIZE,
TYPE_OF_SIZE, ACCESS_MODE, TYPE_SIZE_UNIT for element)
which returns the REF_TO_OBJ same as the 1st argument;
1st argument REF_TO_OBJ: The reference to the object;
2nd argument REF_TO_SIZE: The reference to the size of the object,
3rd argument CLASS_OF_SIZE: The size referenced by the REF_TO_SIZE represents
0: the number of bytes.
1: the number of the elements of the object type;
4th argument TYPE_OF_SIZE: A constant 0 with its TYPE being the same as the
TYPE of the object referenced by REF_TO_SIZE
5th argument ACCESS_MODE:
-1: Unknown access semantics
0: none
1: read_only
2: write_only
3: read_write
6th argument: The TYPE_SIZE_UNIT of the element TYPE of the FAM when 3rd
argument is 1. NULL when 3rd argument is 0.
Among the 6 arguments:
A. The 3rd argument CLASS_OF_SIZE is not needed. If the REF_TO_SIZE represents
the number of bytes, simply pass 1 to the TYPE_SIZE_UNIT argument.
B. The 4th and the 5th arguments can be combined into 1 argument, whose TYPE
represents the TYPE_OF_SIZE, and the constant value represents the
ACCESS_MODE.
As a result, the new design of the .ACCESS_WITH_SIZE is:
ACCESS_WITH_SIZE (REF_TO_OBJ, REF_TO_SIZE,
TYPE_OF_SIZE + ACCESS_MODE, TYPE_SIZE_UNIT for element)
which returns the REF_TO_OBJ same as the 1st argument;
1st argument REF_TO_OBJ: The reference to the object;
2nd argument REF_TO_SIZE: The reference to the size of the object,
3rd argument TYPE_OF_SIZE + ACCESS_MODE: An integer constant with a pointer
TYPE.
The pointee TYPE of the pointer TYPE is the TYPE of the object referenced
by REF_TO_SIZE.
The integer constant value represents the ACCESS_MODE:
0: none
1: read_only
2: write_only
3: read_write
4th argument: The TYPE_SIZE_UNIT of the element TYPE of the array.
gcc/c-family/ChangeLog:
* c-ubsan.cc (get_bound_from_access_with_size): Adjust the position
of the arguments per the new design.
gcc/c/ChangeLog:
* c-typeck.cc (build_access_with_size_for_counted_by): Update comments.
Adjust the arguments per the new design.
gcc/ChangeLog:
* internal-fn.cc (expand_ACCESS_WITH_SIZE): Update comments.
* internal-fn.def (ACCESS_WITH_SIZE): Update comments.
* tree-object-size.cc (access_with_size_object_size): Update comments.
Adjust the arguments per the new design.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions