Changeset 724:6de2ed4f0abe
- Timestamp:
- 10/25/08 12:12:07
(3 months ago)
- Author:
- Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
- branch:
- default
- Message:
Disabled parameter reversing by default, it broke mini/typeinfo10.d
Fixed 'inreg' property placement for functions with reversed parameters.
Made parameter reversal and inreg passing of first arg configurable in premake.lua
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r723 |
r724 |
|
| 109 | 109 | paramvec.push_back(getPtrToType(LLType::Int8Ty)); |
|---|
| 110 | 110 | } |
|---|
| 111 | | else if (arrayVararg) |
|---|
| 112 | | { |
|---|
| 113 | | // do nothing? |
|---|
| 114 | | } |
|---|
| 115 | 111 | |
|---|
| 116 | 112 | // number of formal params |
|---|
| 117 | 113 | size_t n = Argument::dim(f->parameters); |
|---|
| 118 | 114 | |
|---|
| | 115 | #if X86_REVERSE_PARAMS |
|---|
| 119 | 116 | // on x86 we need to reverse the formal params in some cases to match the ABI |
|---|
| 120 | 117 | if (global.params.cpu == ARCHx86) |
|---|
| … | … | |
| 129 | 126 | } |
|---|
| 130 | 127 | } |
|---|
| | 128 | #endif // X86_REVERSE_PARAMS |
|---|
| 131 | 129 | |
|---|
| 132 | 130 | |
|---|
| … | … | |
| 195 | 193 | llvm::FunctionType* functype = llvm::FunctionType::get(actualRettype, paramvec, isvararg); |
|---|
| 196 | 194 | |
|---|
| | 195 | #if X86_PASS_IN_EAX |
|---|
| 197 | 196 | // tell first param to be passed in a register if we can |
|---|
| 198 | 197 | // ONLY extern(D) functions ! |
|---|
| … | … | |
| 214 | 213 | { |
|---|
| 215 | 214 | int inreg = f->reverseParams ? n - 1 : 0; |
|---|
| 216 | | Argument* arg = Argument::getNth(f->parameters, 0); |
|---|
| | 215 | Argument* arg = Argument::getNth(f->parameters, inreg); |
|---|
| 217 | 216 | Type* t = arg->type->toBasetype(); |
|---|
| 218 | 217 | |
|---|
| 219 | | // 32bit ints, pointers, classes and static arrays are candidate for being passed in EAX |
|---|
| | 218 | // 32bit ints, pointers, classes, static arrays and AAs |
|---|
| | 219 | // are candidate for being passed in EAX |
|---|
| 220 | 220 | if ((arg->storageClass & STCin) && |
|---|
| 221 | | ((t->isscalar() && !t->isfloating()) || t->ty == Tclass || t->ty == Tsarray) && |
|---|
| | 221 | ((t->isscalar() && !t->isfloating()) || |
|---|
| | 222 | t->ty == Tclass || t->ty == Tsarray || t->ty == Taarray) && |
|---|
| 222 | 223 | (t->size() <= PTRSIZE)) |
|---|
| 223 | 224 | { |
|---|
| … | … | |
| 227 | 228 | } |
|---|
| 228 | 229 | } |
|---|
| | 230 | #endif // X86_PASS_IN_EAX |
|---|
| 229 | 231 | |
|---|
| 230 | 232 | // done |
|---|
| r711 |
r724 |
|
| 37 | 37 | |
|---|
| 38 | 38 | io.write("Default target: '"..TRIPLE.."'\n"); |
|---|
| | 39 | |
|---|
| | 40 | -- x86 ABI support |
|---|
| | 41 | X86_REVERSE_PARAMS = 0 --disabled for now |
|---|
| | 42 | X86_PASS_IN_EAX = 1 |
|---|
| 39 | 43 | |
|---|
| 40 | 44 | -- D version - don't change these !!! |
|---|
| … | … | |
| 83 | 87 | "POSIX="..POSIX, |
|---|
| 84 | 88 | "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"", |
|---|
| | 89 | "X86_REVERSE_PARAMS="..X86_REVERSE_PARAMS, |
|---|
| | 90 | "X86_PASS_IN_EAX="..X86_PASS_IN_EAX, |
|---|
| 85 | 91 | } |
|---|
| 86 | 92 | package.config.Release.defines = { "LLVMD_NO_LOGGER" } |
|---|