aboutsummaryrefslogtreecommitdiffstats
path: root/ia32/CBuiltins.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2016-10-01 17:38:24 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2016-10-01 17:38:24 +0200
commita14b9578ee5297d954103e05d7b2d322816ddd8f (patch)
tree93b7c2b6bd7de8a4dedaf399088257e0660959b8 /ia32/CBuiltins.ml
parent3bef0962079cf971673b4267b0142bd5fe092509 (diff)
downloadcompcert-a14b9578ee5297d954103e05d7b2d322816ddd8f.tar.gz
compcert-a14b9578ee5297d954103e05d7b2d322816ddd8f.zip
Support for 64-bit architectures: x86 in 64-bit mode
This commit enriches the IA32 port so that it supports x86 processors in 64-bit mode as well as in 32-bit mode, depending on the value of Archi.ptr64, which itself is set from the configuration model. To activate x86-64 bit support, configure with "x86_64-linux". Main steps: - Enrich Op.v and Asm.v with 64-bit operations - SelectLong: in 64-bit mode, use 64-bit operations directly; in 32-bit mode, fall back on the old implementation based on pairs of 32-bit integers - Conventions1: support x86-64 ABI in addition to the 32-bit ABI. - Add support for the new 64-bit operations everywhere. - runtime/x86_64: implementation of the supporting library appropriate for x86 in 64-bit mode To do: - More optimizations are possible on 64-bit integer arithmetic operations. - Could add new chunks to load, say, an unsigned byte into a 64-bit long (currently we load as a 32-bit int then zero-extend). - Implements the wrong ABI for struct passing.
Diffstat (limited to 'ia32/CBuiltins.ml')
-rw-r--r--ia32/CBuiltins.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/ia32/CBuiltins.ml b/ia32/CBuiltins.ml
index 79a839f3..1fe3b200 100644
--- a/ia32/CBuiltins.ml
+++ b/ia32/CBuiltins.ml
@@ -19,12 +19,15 @@ open C
let builtins = {
Builtins.typedefs = [
- "__builtin_va_list", TPtr(TVoid [], [])
+ (* Actually a struct passed by reference; equivalent to 3 64-bit words *)
+ "__builtin_va_list", TArray(TInt(IULong, []), Some 3L, [])
];
Builtins.functions = [
(* Integer arithmetic *)
"__builtin_bswap",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap64",
+ (TInt(IULongLong, []), [TInt(IULongLong, [])], false);
"__builtin_bswap32",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
"__builtin_bswap16",
@@ -79,8 +82,8 @@ let builtins = {
]
}
-let size_va_list = 4
-let va_list_scalar = true
+let size_va_list = 3*8
+let va_list_scalar = false
(* Expand memory references inside extended asm statements. Used in C2C. *)