aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--target-x86.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/target-x86.c b/target-x86.c
index d770349c..01117bb6 100644
--- a/target-x86.c
+++ b/target-x86.c
@@ -3,17 +3,28 @@
#include "machine.h"
-static void init_x86(const struct target *target)
+static void predefine_i386(const struct target *self)
+{
+ predefine("__i386__", 1, "1");
+ predefine("__i386", 1, "1");
+ predefine_nostd("i386");
+}
+
+static void predefine_x86_64(const struct target *self)
+{
+ predefine("__x86_64__", 1, "1");
+ predefine("__x86_64", 1, "1");
+ predefine("__amd64__", 1, "1");
+ predefine("__amd64", 1, "1");
+}
+
+
+static void init_x86_common(const struct target *target)
{
switch (arch_os) {
case OS_CYGWIN:
wchar_ctype = &ushort_ctype;
break;
- case OS_DARWIN:
- int64_ctype = &llong_ctype;
- uint64_ctype = &ullong_ctype;
- wint_ctype = &int_ctype;
- break;
case OS_FREEBSD:
wint_ctype = &int_ctype;
break;
@@ -25,11 +36,9 @@ static void init_x86(const struct target *target)
}
-static void predefine_i386(const struct target *self)
+static void init_i386(const struct target *target)
{
- predefine("__i386__", 1, "1");
- predefine("__i386", 1, "1");
- predefine_nostd("i386");
+ init_x86_common(target);
}
const struct target target_i386 = {
@@ -42,19 +51,28 @@ const struct target target_i386 = {
.bits_in_longdouble = 96,
.max_fp_alignment = 4,
- .init = init_x86,
.target_64bit = &target_x86_64,
+ .init = init_i386,
.predefine = predefine_i386,
};
-static void predefine_x86_64(const struct target *self)
+static void init_x86_64(const struct target *target)
{
- predefine("__x86_64__", 1, "1");
- predefine("__x86_64", 1, "1");
- predefine("__amd64__", 1, "1");
- predefine("__amd64", 1, "1");
+ init_x86_common(target);
+
+ switch (arch_os) {
+ case OS_CYGWIN:
+ break;
+ case OS_DARWIN:
+ int64_ctype = &llong_ctype;
+ uint64_ctype = &ullong_ctype;
+ wint_ctype = &int_ctype;
+ break;
+ case OS_FREEBSD:
+ break;
+ }
}
const struct target target_x86_64 = {
@@ -67,8 +85,8 @@ const struct target target_x86_64 = {
.bits_in_longdouble = 128,
.max_fp_alignment = 16,
- .init = init_x86,
.target_32bit = &target_i386,
+ .init = init_x86_64,
.predefine = predefine_x86_64,
};