Fixed initialization of option tables
[libfirm] / ir / tv / tv.c
index 68999b8..d00a05c 100644 (file)
@@ -1,31 +1,40 @@
 /*
- * Project:     libFIRM
- * File name:   ir/tv/tv.c
- * Purpose:     Representation of and static computations on target machine
- *              values.
- * Author:      Mathias Heil
- * Modified by:
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 2003-2007 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
  */
 
-/*
- *    Values are stored in a format depending upon chosen arithmetic
- *    module. Default uses strcalc and fltcalc.
+/**
+ * @file
+ * @brief    Representation of and static computations on target machine
+ *           values.
+ * @date     2003
+ * @author   Mathias Heil
+ * @version  $Id$
+ * @summary
  *
+ * Values are stored in a format depending upon chosen arithmetic
+ * module. Default uses strcalc and fltcalc.
+ * This implementation assumes:
+ *  - target has IEEE-754 floating-point arithmetic.
  */
-
-/* This implementation assumes:
- *  - target has IEEE-754 floating-point arithmetic.  */
-
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
-
 #include <assert.h>         /* assertions */
 #include <stdlib.h>         /* atoi() */
 #ifdef HAVE_STRING_H
@@ -828,14 +837,15 @@ tarval *tarval_convert_to(tarval *src, ir_mode *m) {
                }
                break;
 
-       /* cast int to something */
+       /* cast int/characters to something */
        case irms_int_number:
+       case irms_character:
                switch (get_mode_sort(m)) {
                case irms_int_number:
                case irms_character:
                        buffer = alloca(sc_get_buffer_length());
                        memcpy(buffer, src->value, sc_get_buffer_length());
-                       sign_extend(buffer, src->mode);
+                       sign_extend(buffer, m);
                        return get_tarval_overflow(buffer, src->length, m);
 
                case irms_internal_boolean:
@@ -888,9 +898,17 @@ tarval *tarval_convert_to(tarval *src, ir_mode *m) {
                }
                break;
 
-       case irms_character:
-               break;
        case irms_reference:
+               switch(get_mode_sort(m)) {
+               case irms_int_number:
+                       buffer = alloca(sc_get_buffer_length());
+                       memcpy(buffer, src->value, sc_get_buffer_length());
+                       sign_extend(buffer, src->mode);
+                       return get_tarval_overflow(buffer, src->length, m);
+               default:
+                       break;
+               }
+
                break;
        }