OLD | NEW |
1 //===- subzero/crosstest/xdefs.h - Definitions for the crosstests. --------===// | 1 //===- subzero/crosstest/xdefs.h - Definitions for the crosstests. --------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Defines the int64 and uint64 types to avoid link-time errors when compiling | 10 // Defines the int64 and uint64 types to avoid link-time errors when compiling |
11 // the crosstests in LP64. | 11 // the crosstests in LP64. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef SUBZERO_CROSSTEST_XDEFS_H_ | 15 #ifndef SUBZERO_CROSSTEST_XDEFS_H_ |
16 #define SUBZERO_CROSSTEST_XDEFS_H_ | 16 #define SUBZERO_CROSSTEST_XDEFS_H_ |
17 | 17 |
18 typedef unsigned int int32; | 18 typedef unsigned int int32; |
19 typedef unsigned int uint32; | 19 typedef unsigned int uint32; |
20 typedef long long int64; | 20 typedef long long int64; |
21 typedef unsigned long long uint64; | 21 typedef unsigned long long uint64; |
22 typedef unsigned int SizeT; | 22 typedef unsigned int SizeT; |
23 | 23 |
24 #ifdef X8664_STACK_HACK | |
25 | |
26 // the X86_STACK_HACK is an intrusive way of getting the crosstests to run in | |
27 // x86_64 LP64 even with an ILP32 model. This hack allocates a new stack for | |
28 // running the tests in the low 4GB of the address space. | |
29 | |
30 #ifdef __cplusplus | |
31 #define XTEST_EXTERN extern "C" | |
32 #else // !defined(__cplusplus) | |
33 #define XTEST_EXTERN extern | |
34 #endif // __cplusplus | |
35 | |
36 /// xAllocStack allocates the memory chunk [StackEnd - Size - 1, StackEnd). It | |
37 /// requires StackEnd to be less than 32-bits long. Conversely, xDeallocStack | |
38 /// frees that memory chunk. | |
39 /// {@ | |
40 XTEST_EXTERN unsigned char *xAllocStack(uint64 StackEnd, uint32 Size); | |
41 XTEST_EXTERN void xDeallocStack(uint64 StackEnd, uint32 Size); | |
42 /// @} | |
43 | |
44 // wrapped_main is invoked by the x86-64 stack hack main. We declare a prototype | |
45 // so the compiler (and not the linker) can yell if a test's wrapped_main | |
46 // prototype does not match what we want. | |
47 XTEST_EXTERN int wrapped_main(int argc, char *argv[]); | |
48 | |
49 #undef XTEST_EXTERN | |
50 | |
51 #endif // X8664_STACK_HACK | |
52 | |
53 #endif // SUBZERO_CROSSTEST_XDEFS_H_ | 24 #endif // SUBZERO_CROSSTEST_XDEFS_H_ |
OLD | NEW |