aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c/CBuiltins.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2018-02-21 17:45:44 +0100
committerCyril SIX <cyril.six@kalray.eu>2018-04-04 16:30:06 +0200
commit6a3f3a62452670380827f9e39dd28c5092741099 (patch)
tree98f3ac276cec9c64d0b8ee030e65a41713295b34 /mppa_k1c/CBuiltins.ml
parentadbefdc338c921f1b05dcf4996d32a3ca8b5f486 (diff)
downloadcompcert-kvx-6a3f3a62452670380827f9e39dd28c5092741099.tar.gz
compcert-kvx-6a3f3a62452670380827f9e39dd28c5092741099.zip
Hook for MPPA_K1c (generates Risc-V code for now)
Diffstat (limited to 'mppa_k1c/CBuiltins.ml')
-rw-r--r--mppa_k1c/CBuiltins.ml61
1 files changed, 61 insertions, 0 deletions
diff --git a/mppa_k1c/CBuiltins.ml b/mppa_k1c/CBuiltins.ml
new file mode 100644
index 00000000..0c981d11
--- /dev/null
+++ b/mppa_k1c/CBuiltins.ml
@@ -0,0 +1,61 @@
+(* *********************************************************************)
+(* *)
+(* The Compcert verified compiler *)
+(* *)
+(* Xavier Leroy, INRIA Paris-Rocquencourt *)
+(* *)
+(* Copyright Institut National de Recherche en Informatique et en *)
+(* Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the GNU General Public License as published by *)
+(* the Free Software Foundation, either version 2 of the License, or *)
+(* (at your option) any later version. This file is also distributed *)
+(* under the terms of the INRIA Non-Commercial License Agreement. *)
+(* *)
+(* *********************************************************************)
+
+(* Processor-dependent builtin C functions *)
+
+open C
+
+let builtins = {
+ Builtins.typedefs = [
+ "__builtin_va_list", TPtr(TVoid [], [])
+ ];
+ Builtins.functions = [
+ (* Synchronization *)
+ "__builtin_fence",
+ (TVoid [], [], false);
+ (* Integer arithmetic *)
+ "__builtin_bswap64",
+ (TInt(IULongLong, []), [TInt(IULongLong, [])], false);
+ (* Float arithmetic *)
+ "__builtin_fmadd",
+ (TFloat(FDouble, []),
+ [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])],
+ false);
+ "__builtin_fmsub",
+ (TFloat(FDouble, []),
+ [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])],
+ false);
+ "__builtin_fnmadd",
+ (TFloat(FDouble, []),
+ [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])],
+ false);
+ "__builtin_fnmsub",
+ (TFloat(FDouble, []),
+ [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])],
+ false);
+ "__builtin_fmax",
+ (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, [])], false);
+ "__builtin_fmin",
+ (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, [])], false);
+ ]
+}
+
+let va_list_type = TPtr(TVoid [], []) (* to check! *)
+let size_va_list = if Archi.ptr64 then 8 else 4
+let va_list_scalar = true
+
+(* Expand memory references inside extended asm statements. Used in C2C. *)
+
+let asm_mem_argument arg = Printf.sprintf "0(%s)" arg