OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
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 // This file implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
(...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4200 // .size NAME, SIZE | 4200 // .size NAME, SIZE |
4201 | 4201 |
4202 // zeroinitializer (constant): | 4202 // zeroinitializer (constant): |
4203 // (.section or .data as above) | 4203 // (.section or .data as above) |
4204 // .align ALIGN | 4204 // .align ALIGN |
4205 // .zero SIZE | 4205 // .zero SIZE |
4206 // .size NAME, SIZE | 4206 // .size NAME, SIZE |
4207 | 4207 |
4208 // zeroinitializer (non-constant): | 4208 // zeroinitializer (non-constant): |
4209 // (.section or .data as above) | 4209 // (.section or .data as above) |
| 4210 // .local NAME |
4210 // .comm NAME, SIZE, ALIGN | 4211 // .comm NAME, SIZE, ALIGN |
4211 // .local NAME | |
4212 | 4212 |
4213 IceString MangledName = Ctx->mangleName(Name); | 4213 IceString MangledName = Ctx->mangleName(Name); |
4214 // Start a new section. | 4214 // Start a new section. |
4215 if (IsConst) { | 4215 if (IsConst) { |
4216 Str << "\t.section\t.rodata,\"a\",@progbits\n"; | 4216 Str << "\t.section\t.rodata,\"a\",@progbits\n"; |
4217 } else { | 4217 } else { |
4218 Str << "\t.type\t" << MangledName << ",@object\n"; | 4218 Str << "\t.type\t" << MangledName << ",@object\n"; |
4219 Str << "\t.data\n"; | 4219 Str << "\t.data\n"; |
4220 } | 4220 } |
| 4221 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName |
| 4222 << "\n"; |
4221 if (IsZeroInitializer) { | 4223 if (IsZeroInitializer) { |
4222 if (IsConst) { | 4224 if (IsConst) { |
4223 Str << "\t.align\t" << Align << "\n"; | 4225 Str << "\t.align\t" << Align << "\n"; |
4224 Str << MangledName << ":\n"; | 4226 Str << MangledName << ":\n"; |
4225 Str << "\t.zero\t" << Size << "\n"; | 4227 Str << "\t.zero\t" << Size << "\n"; |
4226 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4228 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4227 } else { | 4229 } else { |
4228 // TODO(stichnot): Put the appropriate non-constant | 4230 // TODO(stichnot): Put the appropriate non-constant |
4229 // zeroinitializers in a .bss section to reduce object size. | 4231 // zeroinitializers in a .bss section to reduce object size. |
4230 Str << "\t.comm\t" << MangledName << ", " << Size << ", " << Align | 4232 Str << "\t.comm\t" << MangledName << ", " << Size << ", " << Align |
4231 << "\n"; | 4233 << "\n"; |
4232 } | 4234 } |
4233 } else { | 4235 } else { |
4234 Str << "\t.align\t" << Align << "\n"; | 4236 Str << "\t.align\t" << Align << "\n"; |
4235 Str << MangledName << ":\n"; | 4237 Str << MangledName << ":\n"; |
4236 for (SizeT i = 0; i < Size; ++i) { | 4238 for (SizeT i = 0; i < Size; ++i) { |
4237 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4239 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4238 } | 4240 } |
4239 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4241 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4240 } | 4242 } |
4241 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName | |
4242 << "\n"; | |
4243 } | 4243 } |
4244 | 4244 |
4245 } // end of namespace Ice | 4245 } // end of namespace Ice |
OLD | NEW |