gcc의 소스에 하드 코딩되었거나 프로그래밍 방식으로 가져온 것입니까?gcc는 특정 플랫폼에서 각 유형의 정렬을 어떻게 얻습니까?
3
A
답변
5
아치 관련 폴더에 하드 코드 된 것 같습니다. http://www.google.com/codesearch#Yj7Hz1ZInUg/trunk/gcc-4.2.1/gcc/config/sparc/sparc.h
SPARC
/* No data type wants to be aligned rounder than this. */
#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)
/* The best alignment to use in cases where we have a choice. */
#define FASTEST_ALIGNMENT 64
...
/* Make strings word-aligned so strcpy from constants will be faster. */
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
((TREE_CODE (EXP) == STRING_CST \
&& (ALIGN) < FASTEST_ALIGNMENT) \
? FASTEST_ALIGNMENT : (ALIGN))
/* Make arrays of chars word-aligned for the same reasons. */
#define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == ARRAY_TYPE \
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
&& (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
과 같은 폴더에 sparc.c합니다.
일부 기본 정렬 규칙은 gcc/tree.c에 정의되어 있습니다. void의 경우 :
/* We are not going to have real types in C with less than byte alignment,
so we might as well not have any types that claim to have it. */
TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
TYPE_USER_ALIGN (void_type_node) = 0;
빌드 프로세스에서 gcc로 컴파일됩니다.
따라서 기본 정렬은 컴파일되지만 gcc 코드에서 TREE 유형 객체를 조작하여 변경할 수 있습니다.
UPDATE : 팔, MIPS, SPARC 용
/* Minimum size in bits of the largest boundary to which any
and all fundamental data types supported by the hardware
might need to be aligned. No data type wants to be aligned
rounder than this.
Pentium+ prefers DFmode values to be aligned to 64 bit boundary
and Pentium Pro XFmode values at 128 bit boundaries. */
#define BIGGEST_ALIGNMENT 128
/* Decide whether a variable of mode MODE should be 128 bit aligned. */
#define ALIGN_MODE_128(MODE) \
((MODE) == XFmode || SSE_REG_MODE_P (MODE))
/* The published ABIs say that doubles should be aligned on word
boundaries, so lower the alignment for structure fields unless
-malign-double is set. */
/* ??? Blah -- this macro is used directly by libobjc. Since it
supports no vector modes, cut out the complexity and fall back
on BIGGEST_FIELD_ALIGNMENT. */
...
#define BIGGEST_FIELD_ALIGNMENT 32
...
/* If defined, a C expression to compute the alignment given to a
constant that is being placed in memory. EXP is the constant
and ALIGN is the alignment that the object would ordinarily have.
The value of this macro is used instead of that alignment to align
the object.
If this macro is not defined, then ALIGN is used.
The typical use of this macro is to increase alignment for string
constants to be word aligned so that `strcpy' calls that copy
constants can be done inline. */
#define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN))
/* If defined, a C expression to compute the alignment for a static
variable. TYPE is the data type, and ALIGN is the alignment that
the object would ordinarily have. The value of this macro is used
instead of that alignment to align the object.
If this macro is not defined, then ALIGN is used.
One use of this macro is to increase alignment of medium-size
data to make it all fit in fewer cache lines. Another is to
cause character arrays to be word-aligned so that `strcpy' calls
that copy constants to character arrays can be done inline. */
#define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment ((TYPE), (ALIGN))
/* If defined, a C expression to compute the alignment for a local
variable. TYPE is the data type, and ALIGN is the alignment that
the object would ordinarily have. The value of this macro is used
instead of that alignment to align the object.
If this macro is not defined, then ALIGN is used.
One use of this macro is to increase alignment of medium-size
data to make it all fit in fewer cache lines. */
#define LOCAL_ALIGNMENT(TYPE, ALIGN) ix86_local_alignment ((TYPE), (ALIGN))
...
/* Set this nonzero if move instructions will actually fail to work
when given unaligned data. */
#define STRICT_ALIGNMENT 0
및 정렬 아치에 기록 될 수있는 기계 명령어의 필요 (메모리에 정렬되지 않은 액세스를 제한하는) 다른 사람의 아치 : 86의 설정은 더 좋은 의견을 가지고있다. md 파일 (예 : sparc.md)
관련 문제
- 1. Eclipselink : 각 번들에서 EntityManager를 어떻게 얻습니까?
- 2. 일회용 위치를 특정 정확도로 어떻게 얻습니까?
- 3. 특정 유형의 각 열에 대한 SQL 적용 기능
- 4. 특정 유형의 배열을 설정 파일에 어떻게 저장합니까?
- 5. 어떻게 안정적인 정렬을 계산합니까?
- 6. GridView의 정렬을 어떻게 재설정합니까?
- 7. GCC는 명령 파일을 지원합니까?
- 8. 폴더의 크기는 어떻게 얻습니까?
- 9. 모델로부터 어떻게 가치를 얻습니까?
- 10. 마우스 위치는 어떻게 얻습니까?
- 11. PHP에서 'referer'헤더를 어떻게 얻습니까?
- 12. 관리자 권한은 어떻게 얻습니까?
- 13. 스핑크스에서 모든 기록을 어떻게 얻습니까?
- 14. GCC는 최적화
- 15. 특정 유형의 IQueryable을 반복할까요?
- 16. BeautifulSoup를 사용하여 특정 테이블의 모든 행을 어떻게 얻습니까?
- 17. IIS에서 사이트 사용을 어떻게 얻습니까?
- 18. 연락처 그룹의 회원을 어떻게 얻습니까?
- 19. JavaScript에서 객체의 이름은 어떻게 얻습니까?
- 20. 테스트중인 격리 클래스는 어떻게 얻습니까?
- 21. 이미지의 너비와 높이를 어떻게 얻습니까?
- 22. Java에서 프로세스 ID를 어떻게 얻습니까?
- 23. 까다로운 함수 참조는 어떻게 얻습니까?
- 24. 제네릭 형식의 기본값은 어떻게 얻습니까?
- 25. WMD 편집기의 가치는 어떻게 얻습니까?
- 26. 내 파일의 경로는 어떻게 얻습니까?
- 27. 쿠키 ASPXANONYMOUS에서 AnonymousID를 어떻게 얻습니까?
- 28. xPy의 모든 순열은 어떻게 얻습니까?
- 29. C++로 파일을 어떻게 얻습니까?
- 30. IPrincipal은 어떻게 그것의 역할을 얻습니까?
"어떻게 든 가져 오는"것은 a) 크로스 컴파일을 위해 작동하지 않으며, b) 일부 아키텍처에서는 충돌이 일어날 것이기 때문에 _ 하드 코딩해야합니다. – Damon