OLD | NEW |
1 //===- subzero/src/IceGlobalInits.cpp - Global declarations ---------------===// | 1 //===- subzero/src/IceGlobalInits.cpp - Global declarations ---------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// This file implements the notion of function declarations, global | 11 /// This file implements the notion of function declarations, global variable |
12 /// variable declarations, and the corresponding variable initializers | 12 /// declarations, and the corresponding variable initializers in Subzero. |
13 /// in Subzero. | |
14 /// | 13 /// |
15 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
16 | 15 |
17 #include "IceGlobalInits.h" | 16 #include "IceGlobalInits.h" |
18 | 17 |
19 #include "IceDefs.h" | 18 #include "IceDefs.h" |
20 #include "IceGlobalContext.h" | 19 #include "IceGlobalContext.h" |
21 #include "IceTypes.h" | 20 #include "IceTypes.h" |
22 #include "llvm/ADT/STLExtras.h" | 21 #include "llvm/ADT/STLExtras.h" |
23 #include "llvm/IR/Function.h" | 22 #include "llvm/IR/Function.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return; | 144 return; |
146 Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]"; | 145 Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]"; |
147 } | 146 } |
148 | 147 |
149 void VariableDeclaration::DataInitializer::dump(GlobalContext *, | 148 void VariableDeclaration::DataInitializer::dump(GlobalContext *, |
150 Ostream &Stream) const { | 149 Ostream &Stream) const { |
151 if (!Ice::BuildDefs::dump()) | 150 if (!Ice::BuildDefs::dump()) |
152 return; | 151 return; |
153 dumpType(Stream); | 152 dumpType(Stream); |
154 Stream << " c\""; | 153 Stream << " c\""; |
155 // Code taken from PrintEscapedString() in AsmWriter.cpp. Keep | 154 // Code taken from PrintEscapedString() in AsmWriter.cpp. Keep the strings in |
156 // the strings in the same format as the .ll file for practical | 155 // the same format as the .ll file for practical diffing. |
157 // diffing. | |
158 for (uint8_t C : Contents) { | 156 for (uint8_t C : Contents) { |
159 if (isprint(C) && C != '\\' && C != '"') | 157 if (isprint(C) && C != '\\' && C != '"') |
160 Stream << C; | 158 Stream << C; |
161 else | 159 else |
162 Stream << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F); | 160 Stream << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F); |
163 } | 161 } |
164 Stream << "\""; | 162 Stream << "\""; |
165 } | 163 } |
166 | 164 |
167 void VariableDeclaration::ZeroInitializer::dump(GlobalContext *, | 165 void VariableDeclaration::ZeroInitializer::dump(GlobalContext *, |
(...skipping 30 matching lines...) Expand all Loading... |
198 dumpType(Stream); | 196 dumpType(Stream); |
199 Stream << ")"; | 197 Stream << ")"; |
200 if (Offset != 0) { | 198 if (Offset != 0) { |
201 Stream << ", "; | 199 Stream << ", "; |
202 dumpType(Stream); | 200 dumpType(Stream); |
203 Stream << " " << Offset << ")"; | 201 Stream << " " << Offset << ")"; |
204 } | 202 } |
205 } | 203 } |
206 | 204 |
207 } // end of namespace Ice | 205 } // end of namespace Ice |
OLD | NEW |