00001 /* 00002 Copyright (c) 2009, National Institute of Advanced Industrial Science 00003 and Technology. All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 00009 * Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 * Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in 00014 the documentation and/or other materials provided with the 00015 distribution. 00016 00017 * Neither the name of Fixstars Corporation nor the names of its 00018 contributors may be used to endorse or promote products derived 00019 from this software without specific prior written permission. 00020 00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef CFRONT_TARGET_INFO_HPP 00035 #define CFRONT_TARGET_INFO_HPP 00036 00037 namespace cfront { 00038 00042 class TargetInfo { 00043 public: 00044 00048 enum Type { 00049 POINTER, 00050 BOOL, 00051 CHAR, 00052 SHORT, 00053 INT, 00054 LONG, 00055 LLONG, 00056 FLOAT, 00057 DOUBLE, 00058 LDOUBLE, 00059 ENUM, 00060 VECTOR, 00061 LASTTYPE, 00062 }; 00063 00064 TargetInfo() 00065 { 00066 } 00067 00071 size_t getSize(Type t) const 00072 { 00073 return sizes_[t]; 00074 } 00075 00079 size_t getBitSize(Type t) const 00080 { 00081 /* FIXME */ 00082 return sizes_[t] * 8; 00083 } 00084 00088 size_t getAlign(Type t) const 00089 { 00090 return aligns_[t]; 00091 } 00092 00096 void setSize(Type t, size_t s) 00097 { 00098 sizes_[t] = s; 00099 } 00100 00104 void setAlign(Type t, size_t align) 00105 { 00106 aligns_[t] = align; 00107 } 00108 00109 00110 private: 00111 size_t sizes_[LASTTYPE]; 00112 //size_t bitSizes_[LASTTYPE]; 00113 size_t aligns_[LASTTYPE]; 00114 }; 00115 00116 00117 } // namespace cfront 00118 00119 00120 #endif 00121 00122 /* 00123 * Local Variables: 00124 * mode: C++ 00125 * c-basic-offset: 4 00126 * indent-tabs-mode: nil 00127 * End: 00128 */ 00129