My Fault. Sorry about that.
Can you check which pre-processor macros that are defined by default? With GNUC it's done something like this:
touch foo.h; cpp -dD foo.h
You may need to add the proper command line arguments to tell the preprocessor which target you want, i.e. the iphone.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I'm hoping you might be the one to do it. Even if the native calling conventions doesn't actually work for the iphone, I'd very much like to know what preprocessor defines that might be used to identify the platform.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I think you may be able to enable native calling conventions with the following changes to as_config.h:
Exchange the current MacOSX config for the below. It's around lines 426 to 462.
// MacOSX and IPhone #ifdef __APPLE__ // Is this a Mac or an IPhone? #ifdef TARGET_OS_IPHONE #define AS_IPHONE #else #define AS_MAC #endif // The sizeof bool is different depending on the target CPU #undef AS_SIZEOF_BOOL #if defined(__ppc__) #define AS_SIZEOF_BOOL 4 // STDCALL is not available on PPC #undef STDCALL #define STDCALL #else #define AS_SIZEOF_BOOL 1 #endif #if defined(i386) && !defined(__LP64__) // Support native calling conventions on Mac OS X + Intel 32bit CPU #define AS_X86 #elif (defined(__ppc__) || defined(__PPC__)) && !defined(__LP64__) // Support native calling conventions on Mac OS X + PPC 32bit CPU #define AS_PPC #define THISCALL_RETURN_SIMPLE_IN_MEMORY #define CDECL_RETURN_SIMPLE_IN_MEMORY #define STDCALL_RETURN_SIMPLE_IN_MEMORY #elif (defined(__ppc__) || defined(__PPC__)) && defined(__LP64__) #define AS_PPC_64 #elif (defined(_ARM_) // The IPhone use an ARM processor // TODO: Can we support native calling conventions on the IPhone? // These flags are only guesswork. They need to be confirmed. #define AS_ARM #define AS_ALIGN #define CDECL_RETURN_SIMPLE_IN_MEMORY #define STDCALL_RETURN_SIMPLE_IN_MEMORY #define COMPLEX_OBJS_PASSED_BY_REF #define COMPLEX_MASK asOBJ_APP_CLASS_ASSIGNMENT #else // No support for native calling conventions yet #define AS_MAX_PORTABILITY #endif #define AS_POSIX_THREADS
I used TARGET_OS_IPHONE to identify the IPhone instead of a MacOSX, and I used _ARM_ to identify the ARM CPU to enable the native calling conventions.
Please check if the macros __APPLE__ and _ARM_ are defined by default.
Also, if you make these changes in as_config.h, you need to add the as_callfunc_armasm.asm assembler module to the project so that it is compiled as well.
Let me know if any problems happen when making these changes.
---
Depending on the target system the generic calling convention may actually be faster than the native calling conventions. The PS3 for example has such a complex calling convention that the code to dynamically setup the stack at runtime gets really complicated and inefficient.
The ARM processor uses a simpler calling convention, so here it is difficult to say whether the native calling convention or the generic calling convention is faster. It would only be possible to determine this through testing.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
19:38 asjit 28> arm-apple-darwin9-gcc-4.0.1 -E -dM test.c#define __DBL_MIN_EXP__ (-1021)#define __FLT_MIN__ 1.17549435e-38F#define __CHAR_BIT__ 8#define __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ 20000#define __WCHAR_MAX__ 2147483647#define __DBL_DENORM_MIN__ 4.9406564584124654e-324#define __FLT_EVAL_METHOD__ 0#define __DBL_MIN_10_EXP__ (-307)#define __FINITE_MATH_ONLY__ 0#define __ARMEL__ 1#define __GNUC_PATCHLEVEL__ 1#define __ARM_ARCH_4T__ 1#define __SHRT_MAX__ 32767#define __LDBL_MAX__ 1.7976931348623157e+308L#define __APPLE_CC__ 5490#define __UINTMAX_TYPE__ long long unsigned int#define __LDBL_MAX_EXP__ 1024#define __SCHAR_MAX__ 127#define __USER_LABEL_PREFIX__ _#define __STDC_HOSTED__ 1#define __LDBL_HAS_INFINITY__ 1#define __DBL_DIG__ 15#define __FLT_EPSILON__ 1.19209290e-7F#define __APCS_32__ 1#define __LDBL_MIN__ 2.2250738585072014e-308L#define __strong #define __APPLE__ 1#define __DECIMAL_DIG__ 17#define __LDBL_HAS_QUIET_NAN__ 1#define __DYNAMIC__ 1#define __GNUC__ 4#define __DBL_MAX__ 1.7976931348623157e+308#define __DBL_HAS_INFINITY__ 1#define OBJC_NEW_PROPERTIES 1#define __USING_SJLJ_EXCEPTIONS__ 1#define __weak #define __DBL_MAX_EXP__ 1024#define __LONG_LONG_MAX__ 9223372036854775807LL#define __GXX_ABI_VERSION 1002#define __FLT_MIN_EXP__ (-125)#define __DBL_MIN__ 2.2250738585072014e-308#define __DBL_HAS_QUIET_NAN__ 1#define __REGISTER_PREFIX__ #define __NO_INLINE__ 1#define __FLT_MANT_DIG__ 24#define __VERSION__ "4.0.1 (Apple Inc. build 5490)"#define __SOFTFP__ 1#define __arm 1#define __SIZE_TYPE__ long unsigned int#define __FLT_RADIX__ 2#define __LDBL_EPSILON__ 2.2204460492503131e-16L#define __VFP_FP__ 1#define __FLT_HAS_QUIET_NAN__ 1#define __FLT_MAX_10_EXP__ 38#define __LONG_MAX__ 2147483647L#define __FLT_HAS_INFINITY__ 1#define __LITTLE_ENDIAN__ 1#define __LDBL_MANT_DIG__ 53#define __CONSTANT_CFSTRINGS__ 1#define __WCHAR_TYPE__ int#define __FLT_DIG__ 6#define __INT_MAX__ 2147483647#define __FLT_MAX_EXP__ 128#define __DBL_MANT_DIG__ 53#define __WINT_TYPE__ int#define __LDBL_MIN_EXP__ (-1021)#define __arm__ 1#define __MACH__ 1#define __LDBL_MAX_10_EXP__ 308#define __DBL_EPSILON__ 2.2204460492503131e-16#define __INTMAX_MAX__ 9223372036854775807LL#define __FLT_DENORM_MIN__ 1.40129846e-45F#define __PIC__ 1#define __FLT_MAX__ 3.40282347e+38F#define __FLT_MIN_10_EXP__ (-37)#define __INTMAX_TYPE__ long long int#define __GNUC_MINOR__ 0#define __DBL_MAX_10_EXP__ 308#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L#define __PTRDIFF_TYPE__ int#define __LDBL_MIN_10_EXP__ (-307)#define __LDBL_DIG__ 15#define __GNUC_GNU_INLINE__ 119:38 asjit 29>
Also note that gcc's assembler can't assemble as_callfunc_armasm.asm as is. The opcodes themselves don't need to change, but the comment character and other keywords are different.
Thanks for the information.
BornToCode:
I've made a few changes in the as_config.h (in the SVN) to identify the IPhone according to the information that you and Quarnster gave me. I'd appreciate it if you could give it a try. I didn't enable the native calling conventions, since according to Quarnster it wouldn't compile on GCC anyway without further changes.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Would you like to give it a try? It's in the SVN (revision 475), file as_callfunc_armasm.s.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game