OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [lambda-trans.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Lambda matrix transformations.
2
   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
3
   Contributed by Daniel Berlin <dberlin@dberlin.org>.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free
9
Software Foundation; either version 3, or (at your option) any later
10
version.
11
 
12
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
#include "config.h"
22
#include "system.h"
23
#include "coretypes.h"
24
#include "tm.h"
25
#include "ggc.h"
26
#include "tree.h"
27
#include "target.h"
28
#include "lambda.h"
29
 
30
/* Allocate a new transformation matrix.  */
31
 
32
lambda_trans_matrix
33
lambda_trans_matrix_new (int colsize, int rowsize)
34
{
35
  lambda_trans_matrix ret;
36
 
37
  ret = ggc_alloc (sizeof (*ret));
38
  LTM_MATRIX (ret) = lambda_matrix_new (rowsize, colsize);
39
  LTM_ROWSIZE (ret) = rowsize;
40
  LTM_COLSIZE (ret) = colsize;
41
  LTM_DENOMINATOR (ret) = 1;
42
  return ret;
43
}
44
 
45
/* Return true if MAT is an identity matrix.  */
46
 
47
bool
48
lambda_trans_matrix_id_p (lambda_trans_matrix mat)
49
{
50
  if (LTM_ROWSIZE (mat) != LTM_COLSIZE (mat))
51
    return false;
52
  return lambda_matrix_id_p (LTM_MATRIX (mat), LTM_ROWSIZE (mat));
53
}
54
 
55
 
56
/* Compute the inverse of the transformation matrix MAT.  */
57
 
58
lambda_trans_matrix
59
lambda_trans_matrix_inverse (lambda_trans_matrix mat)
60
{
61
  lambda_trans_matrix inverse;
62
  int determinant;
63
 
64
  inverse = lambda_trans_matrix_new (LTM_ROWSIZE (mat), LTM_COLSIZE (mat));
65
  determinant = lambda_matrix_inverse (LTM_MATRIX (mat), LTM_MATRIX (inverse),
66
                                       LTM_ROWSIZE (mat));
67
  LTM_DENOMINATOR (inverse) = determinant;
68
  return inverse;
69
}
70
 
71
 
72
/* Print out a transformation matrix.  */
73
 
74
void
75
print_lambda_trans_matrix (FILE *outfile, lambda_trans_matrix mat)
76
{
77
  print_lambda_matrix (outfile, LTM_MATRIX (mat), LTM_ROWSIZE (mat),
78
                       LTM_COLSIZE (mat));
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.