Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 724:6de2ed4f0abe

Show
Ignore:
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
  • gen/functions.cpp

    r723 r724  
    109109        paramvec.push_back(getPtrToType(LLType::Int8Ty)); 
    110110    } 
    111     else if (arrayVararg) 
    112     { 
    113         // do nothing? 
    114     } 
    115111 
    116112    // number of formal params 
    117113    size_t n = Argument::dim(f->parameters); 
    118114 
     115#if X86_REVERSE_PARAMS 
    119116    // on x86 we need to reverse the formal params in some cases to match the ABI 
    120117    if (global.params.cpu == ARCHx86) 
     
    129126        } 
    130127    } 
     128#endif // X86_REVERSE_PARAMS 
    131129 
    132130 
     
    195193    llvm::FunctionType* functype = llvm::FunctionType::get(actualRettype, paramvec, isvararg); 
    196194 
     195#if X86_PASS_IN_EAX 
    197196    // tell first param to be passed in a register if we can 
    198197    // ONLY extern(D) functions ! 
     
    214213            { 
    215214                int inreg = f->reverseParams ? n - 1 : 0; 
    216                 Argument* arg = Argument::getNth(f->parameters, 0); 
     215                Argument* arg = Argument::getNth(f->parameters, inreg); 
    217216                Type* t = arg->type->toBasetype(); 
    218217 
    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 
    220220                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) && 
    222223                    (t->size() <= PTRSIZE)) 
    223224                { 
     
    227228        } 
    228229    } 
     230#endif // X86_PASS_IN_EAX 
    229231 
    230232    // done 
  • premake.lua

    r711 r724  
    3737 
    3838io.write("Default target: '"..TRIPLE.."'\n"); 
     39 
     40-- x86 ABI support 
     41X86_REVERSE_PARAMS = 0 --disabled for now 
     42X86_PASS_IN_EAX = 1 
    3943 
    4044-- D version - don't change these !!! 
     
    8387    "POSIX="..POSIX, 
    8488    "DEFAULT_TARGET_TRIPLE=\\\""..TRIPLE.."\\\"", 
     89    "X86_REVERSE_PARAMS="..X86_REVERSE_PARAMS, 
     90    "X86_PASS_IN_EAX="..X86_PASS_IN_EAX, 
    8591} 
    8692package.config.Release.defines = { "LLVMD_NO_LOGGER" } 
Copyright © 2008, LDC Development Team.