Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
abi_properties.cxx
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 //  
00037 //  Generate ABI information
00039 
00040 
00041 
00042 #include <stddef.h>
00043 #include "abi_properties_gen.h"
00044 #include "targ_isa_registers.h"
00045 
00046 static ABI_PROPERTY
00047         allocatable,
00048         callee,
00049         caller,
00050         func_arg,
00051         func_val,
00052         frame_ptr,
00053         global_ptr,
00054         stack_ptr,
00055         entry_ptr,
00056         static_link,
00057         zero,
00058         ret_addr,
00059         prev_funcstate,
00060         loop_count,
00061         epilog_count,
00062         true_predicate,
00063         stacked,
00064         fzero,
00065         fone;
00066 
00067 static void ia64_abi(void)
00068 {
00069   static const char *integer_names[128] = {
00070     NULL,   "gp",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
00071     NULL,   NULL,   NULL,   NULL,   "sp",   NULL,   NULL,   NULL,
00072   };
00073 
00074   static const char *branch_names[8] = {
00075     "rp",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
00076   };
00077 
00078   Reg_Names(ISA_REGISTER_CLASS_integer, 0, 127, integer_names);
00079 
00080   Reg_Property(allocatable, ISA_REGISTER_CLASS_integer,
00081                            2,   3,   4,   5,   6,   7,  
00082                  8,   9,  10,  11,            14,  15,
00083                 16,  17,  18,  19,  20,  21,  22,  23, 
00084                 24,  25,  26,  27,  28,  29,  30,  31,
00085                 32,  33,  34,  35,  36,  37,  38,  39,
00086                 40,  41,  42,  43,  44,  45,  46,  47,
00087                 48,  49,  50,  51,  52,  53,  54,  55,
00088                 56,  57,  58,  59,  60,  61,  62,  63,
00089                 64,  65,  66,  67,  68,  69,  70,  71,
00090                 72,  73,  74,  75,  76,  77,  78,  79,
00091                 80,  81,  82,  83,  84,  85,  86,  87,
00092                 88,  89,  90,  91,  92,  93,  94,  95,
00093                 96,  97,  98,  99, 100, 101, 102, 103,
00094                104, 105, 106, 107, 108, 109, 110, 111, 
00095                112, 113, 114, 115, 116, 117, 118, 119,
00096                120, 121, 122, 123, 124, 125, 126, 127,
00097                -1);
00098   Reg_Property(callee, ISA_REGISTER_CLASS_integer,
00099                                      4,   5,   6,   7,
00100                -1);
00101   Reg_Property(caller, ISA_REGISTER_CLASS_integer,
00102                  2,   3,   8,   9,  10,  11,  14,  15, 
00103                 16,  17,  18,  19,  20,  21,  22,  23,
00104                 24,  25,  26,  27,  28,  29,  30,  31,
00105                -1);
00106   Reg_Property(stacked, ISA_REGISTER_CLASS_integer,
00107                 32,  33,  34,  35,  36,  37,  38,  39,
00108                 40,  41,  42,  43,  44,  45,  46,  47,
00109                 48,  49,  50,  51,  52,  53,  54,  55,
00110                 56,  57,  58,  59,  60,  61,  62,  63,
00111                 64,  65,  66,  67,  68,  69,  70,  71,
00112                 72,  73,  74,  75,  76,  77,  78,  79,
00113                 80,  81,  82,  83,  84,  85,  86,  87,
00114                 88,  89,  90,  91,  92,  93,  94,  95,
00115                 96,  97,  98,  99, 100, 101, 102, 103,
00116                104, 105, 106, 107, 108, 109, 110, 111, 
00117                112, 113, 114, 115, 116, 117, 118, 119,
00118                120, 121, 122, 123, 124, 125, 126, 127,
00119                -1);
00120   Reg_Property(func_arg, ISA_REGISTER_CLASS_integer,
00121                 32,  33,  34,  35,  36,  37,  38,  39,
00122                -1);
00123   Reg_Property(func_val, ISA_REGISTER_CLASS_integer,
00124                  8,   9,  10,  11,
00125                -1);
00126   Reg_Property(static_link, ISA_REGISTER_CLASS_integer, 
00127                 14,
00128                -1);
00129   Reg_Property(global_ptr, ISA_REGISTER_CLASS_integer, 
00130                 1,
00131                -1);
00132   Reg_Property(frame_ptr, ISA_REGISTER_CLASS_integer, 
00133                 7,
00134                -1);
00135   Reg_Property(stack_ptr, ISA_REGISTER_CLASS_integer, 
00136                 12,
00137                -1);
00138   Reg_Property(zero, ISA_REGISTER_CLASS_integer, 
00139                 0,
00140                -1);
00141 
00142   // float register class:
00143 
00144   Reg_Property(allocatable, ISA_REGISTER_CLASS_float,
00145                            2,   3,   4,   5,   6,   7,
00146                  8,   9,  10,  11,  12,  13,  14,  15,
00147                 16,  17,  18,  19,  20,  21,  22,  23,
00148                 24,  25,  26,  27,  28,  29,  30,  31,
00149                 32,  33,  34,  35,  36,  37,  38,  39,
00150                 40,  41,  42,  43,  44,  45,  46,  47,
00151                 48,  49,  50,  51,  52,  53,  54,  55,
00152                 56,  57,  58,  59,  60,  61,  62,  63,
00153                 64,  65,  66,  67,  68,  69,  70,  71,
00154                 72,  73,  74,  75,  76,  77,  78,  79,
00155                 80,  81,  82,  83,  84,  85,  86,  87,
00156                 88,  89,  90,  91,  92,  93,  94,  95,
00157                 96,  97,  98,  99, 100, 101, 102, 103,
00158                104, 105, 106, 107, 108, 109, 110, 111,
00159                112, 113, 114, 115, 116, 117, 118, 119, 
00160                120, 121, 122, 123, 124, 125, 126, 127,
00161                -1);
00162   Reg_Property(callee, ISA_REGISTER_CLASS_float,
00163                  2,   3,   4,   5,  16,  17,  18,  19,
00164                 20,  21,  22,  23,  24,  25,  26,  27,
00165                 28,  29,  30,  31,
00166                -1);
00167   Reg_Property(caller, ISA_REGISTER_CLASS_float,
00168                  6,   7,
00169                  8,   9,  10,  11,  12,  13,  14,  15,
00170                 32,  33,  34,  35,  36,  37,  38,  39,
00171                 40,  41,  42,  43,  44,  45,  46,  47,
00172                 48,  49,  50,  51,  52,  53,  54,  55,
00173                 56,  57,  58,  59,  60,  61,  62,  63,
00174                 64,  65,  66,  67,  68,  69,  70,  71,
00175                 72,  73,  74,  75,  76,  77,  78,  79,
00176                 80,  81,  82,  83,  84,  85,  86,  87,
00177                 88,  89,  90,  91,  92,  93,  94,  95,
00178                 96,  97,  98,  99, 100, 101, 102, 103,
00179                104, 105, 106, 107, 108, 109, 110, 111,
00180                112, 113, 114, 115, 116, 117, 118, 119, 
00181                120, 121, 122, 123, 124, 125, 126, 127,
00182                -1);
00183   Reg_Property(func_arg, ISA_REGISTER_CLASS_float,
00184                  8,   9,  10,  11,  12,  13,  14,  15,
00185                -1);
00186   Reg_Property(func_val, ISA_REGISTER_CLASS_float,
00187                  8,   9,  10,  11,  12,  13,  14,  15,
00188                -1);
00189   Reg_Property(fzero, ISA_REGISTER_CLASS_float, 
00190                  0,
00191                -1);
00192   Reg_Property(fone, ISA_REGISTER_CLASS_float, 
00193                  1,
00194                -1);
00195 
00196   // predicate register class:
00197 
00198   Reg_Property(allocatable, ISA_REGISTER_CLASS_predicate,
00199                       1,   2,   3,   4,   5,   6,   7,
00200                  8,   9,  10,  11,  12,  13,  14,  15,
00201                 16,  17,  18,  19,  20,  21,  22,  23,
00202                 24,  25,  26,  27,  28,  29,  30,  31,
00203                 32,  33,  34,  35,  36,  37,  38,  39,
00204                 40,  41,  42,  43,  44,  45,  46,  47,
00205                 48,  49,  50,  51,  52,  53,  54,  55,
00206                 56,  57,  58,  59,  60,  61,  62,  63,
00207                -1);
00208   Reg_Property(callee, ISA_REGISTER_CLASS_predicate,
00209                  1,   2,   3,   4,   5,
00210                 16,  17,  18,  19,  20,  21,  22,  23,
00211                 24,  25,  26,  27,  28,  29,  30,  31,
00212                 32,  33,  34,  35,  36,  37,  38,  39,
00213                 40,  41,  42,  43,  44,  45,  46,  47,
00214                 48,  49,  50,  51,  52,  53,  54,  55,
00215                 56,  57,  58,  59,  60,  61,  62,  63,
00216                -1);
00217   Reg_Property(caller, ISA_REGISTER_CLASS_predicate,
00218                                               6,   7,
00219                  8,   9,  10,  11,  12,  13,  14,  15,
00220                -1);
00221   Reg_Property(true_predicate, ISA_REGISTER_CLASS_predicate, 
00222                0,
00223                -1);
00224 
00225   // branch register class:
00226 
00227   Reg_Names(ISA_REGISTER_CLASS_branch, 0, 7, branch_names);
00228 
00229   Reg_Property(allocatable, ISA_REGISTER_CLASS_branch,
00230                  0,   1,   2,   3,   4,   5,   6,   7,
00231                -1);
00232   Reg_Property(callee, ISA_REGISTER_CLASS_branch,
00233                       1,   2,   3,   4,   5,
00234                -1);
00235   Reg_Property(caller, ISA_REGISTER_CLASS_branch,
00236                  0,                            6,   7,
00237                -1);
00238   Reg_Property(ret_addr, ISA_REGISTER_CLASS_branch, 
00239                0,
00240                -1);
00241 
00242   // application register class:
00243 
00244   Reg_Property(prev_funcstate, ISA_REGISTER_CLASS_application, 
00245                 64,
00246                -1);
00247   Reg_Property(caller, ISA_REGISTER_CLASS_application, 
00248                 32,  64,
00249                -1);
00250   Reg_Property(callee, ISA_REGISTER_CLASS_application, 
00251                 36,  65,  66,
00252                -1);
00253   Reg_Property(loop_count, ISA_REGISTER_CLASS_application, 
00254                 65,
00255                -1);
00256   Reg_Property(epilog_count, ISA_REGISTER_CLASS_application, 
00257                 66,
00258                -1);
00259 
00260   // control register class:
00261 
00262   /* nothing! */
00263 }
00264 
00265 main()
00266 {
00267   ABI_Properties_Begin("ia64");
00268 
00269   allocatable = Create_Reg_Property("allocatable");
00270   callee = Create_Reg_Property("callee");
00271   caller = Create_Reg_Property("caller");
00272   stacked = Create_Reg_Property("stacked");
00273   func_arg = Create_Reg_Property("func_arg");
00274   func_val = Create_Reg_Property("func_val");
00275   frame_ptr = Create_Reg_Property("frame_ptr");
00276   global_ptr = Create_Reg_Property("global_ptr");
00277   stack_ptr = Create_Reg_Property("stack_ptr");
00278   entry_ptr = Create_Reg_Property("entry_ptr");
00279   static_link = Create_Reg_Property("static_link");
00280   zero = Create_Reg_Property("zero");
00281   ret_addr = Create_Reg_Property("ret_addr");
00282   prev_funcstate = Create_Reg_Property("prev_funcstate");
00283   loop_count = Create_Reg_Property("loop_count");
00284   epilog_count = Create_Reg_Property("epilog_count");
00285   true_predicate = Create_Reg_Property("true_predicate");
00286   fzero = Create_Reg_Property("fzero");
00287   fone = Create_Reg_Property("fone");
00288 
00290   Begin_ABI("i32");
00291   ia64_abi();
00292 
00294   Begin_ABI("i64");
00295   ia64_abi();
00296 
00297   ABI_Properties_End();
00298 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines