| 1 |
(* m2builtins.def definition module for m2builtins.cc. |
| 2 |
|
| 3 |
Copyright (C) 2003-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. *) |
| 21 |
|
| 22 |
DEFINITION MODULE FOR "C" m2builtins ; |
| 23 |
|
| 24 |
FROM CDataTypes IMPORT CharStar, ConstCharStar ; |
| 25 |
FROM gcctypes IMPORT location_t, tree ; |
| 26 |
|
| 27 |
|
| 28 |
(* |
| 29 |
GetBuiltinConst - returns the gcc tree of a built in constant, name. |
| 30 |
NIL is returned if the constant is unknown. |
| 31 |
*) |
| 32 |
|
| 33 |
PROCEDURE GetBuiltinConst (name: CharStar) : tree ; |
| 34 |
|
| 35 |
|
| 36 |
(* |
| 37 |
GetBuiltinConstType - returns the type of a builtin constant, name. |
| 38 |
|
| 39 |
0 = unknown constant name |
| 40 |
1 = integer |
| 41 |
2 = real |
| 42 |
*) |
| 43 |
|
| 44 |
PROCEDURE GetBuiltinConstType (name: CharStar) : CARDINAL ; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
(* |
| 49 |
GetBuiltinTypeInfoType - returns value: |
| 50 |
0 is ident is unknown. |
| 51 |
1 if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow, |
| 52 |
exception, extend. |
| 53 |
2 if ident is radix, places, exponentmin, exponentmax, |
| 54 |
noofmodes. |
| 55 |
3 if ident is large, small. |
| 56 |
*) |
| 57 |
|
| 58 |
PROCEDURE GetBuiltinTypeInfoType (ident: ConstCharStar) : CARDINAL ; |
| 59 |
|
| 60 |
|
| 61 |
(* |
| 62 |
GetBuiltinTypeInfo - returns a tree value: |
| 63 |
|
| 64 |
NULL_TREE if ident is unknown. |
| 65 |
boolean tree if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow, |
| 66 |
exception, extend. |
| 67 |
ZType tree if ident is radix, places, exponentmin, exponentmax, |
| 68 |
noofmodes. |
| 69 |
RType tree if ident is large, small. |
| 70 |
*) |
| 71 |
|
| 72 |
PROCEDURE GetBuiltinTypeInfo (location: location_t; type: tree; ident: ConstCharStar) : tree ; |
| 73 |
|
| 74 |
|
| 75 |
(* |
| 76 |
BuiltinExists - returns TRUE if the builtin function, name, exists |
| 77 |
for this target architecture. |
| 78 |
*) |
| 79 |
|
| 80 |
PROCEDURE BuiltinExists (name: CharStar) : BOOLEAN ; |
| 81 |
|
| 82 |
|
| 83 |
(* |
| 84 |
BuildBuiltinTree - returns a tree containing the builtin function, name. |
| 85 |
*) |
| 86 |
|
| 87 |
PROCEDURE BuildBuiltinTree (location: location_t; name: CharStar) : tree ; |
| 88 |
|
| 89 |
|
| 90 |
(* |
| 91 |
BuiltinMemCopy and BuiltinAlloca - are called by M2GenGCC to implement open arrays. |
| 92 |
*) |
| 93 |
|
| 94 |
PROCEDURE BuiltinMemCopy (location: location_t; dest, src, n: tree) : tree ; |
| 95 |
|
| 96 |
|
| 97 |
(* |
| 98 |
BuiltinMemSet is called by M2GenGCC to implement the set type. |
| 99 |
*) |
| 100 |
|
| 101 |
PROCEDURE BuiltinMemSet (location: location_t; dest, bytevalue, nbytes: tree) : tree ; |
| 102 |
|
| 103 |
|
| 104 |
(* |
| 105 |
BuiltInAlloca - given an expression, n, allocate, n, bytes on the stack for the life |
| 106 |
of the current function. |
| 107 |
*) |
| 108 |
|
| 109 |
PROCEDURE BuiltInAlloca (location: location_t; n: tree) : tree ; |
| 110 |
|
| 111 |
|
| 112 |
(* |
| 113 |
BuiltInIsfinite - given an expression, e, return an integer tree of 1 if the |
| 114 |
value is finite. Return an integer tree 0 if the value is |
| 115 |
not finite. |
| 116 |
*) |
| 117 |
|
| 118 |
PROCEDURE BuiltInIsfinite (location: location_t; e: tree) : tree ; |
| 119 |
|
| 120 |
|
| 121 |
(* |
| 122 |
BuiltinStrNCopy - copy at most n characters from src to dest. |
| 123 |
*) |
| 124 |
|
| 125 |
PROCEDURE BuiltinStrNCopy (location: location_t; dest, src, n: tree) : tree ; |
| 126 |
|
| 127 |
|
| 128 |
END m2builtins. |