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 /// \file | 10 /// \file |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 void staticInit(::Ice::GlobalContext *Ctx) { | 36 void staticInit(::Ice::GlobalContext *Ctx) { |
37 ::Ice::X8632::TargetX8632::staticInit(Ctx); | 37 ::Ice::X8632::TargetX8632::staticInit(Ctx); |
38 if (Ctx->getFlags().getUseNonsfi()) { | 38 if (Ctx->getFlags().getUseNonsfi()) { |
39 // In nonsfi, we need to reference the _GLOBAL_OFFSET_TABLE_ for accessing | 39 // In nonsfi, we need to reference the _GLOBAL_OFFSET_TABLE_ for accessing |
40 // globals. The GOT is an external symbol (i.e., it is not defined in the | 40 // globals. The GOT is an external symbol (i.e., it is not defined in the |
41 // pexe) so we need to register it as such so that ELF emission won't barf | 41 // pexe) so we need to register it as such so that ELF emission won't barf |
42 // on an "unknown" symbol. The GOT is added to the External symbols list | 42 // on an "unknown" symbol. The GOT is added to the External symbols list |
43 // here because staticInit() is invoked in a single-thread context. | 43 // here because staticInit() is invoked in a single-thread context. |
44 Ctx->getConstantExternSym(::Ice::GlobalOffsetTable); | 44 Ctx->getConstantExternSym(Ctx->getGlobalString(::Ice::GlobalOffsetTable)); |
45 } | 45 } |
46 } | 46 } |
| 47 |
| 48 bool shouldBePooled(const class ::Ice::Constant *C) { |
| 49 return ::Ice::X8632::TargetX8632::shouldBePooled(C); |
| 50 } |
47 } // end of namespace X8632 | 51 } // end of namespace X8632 |
48 | 52 |
49 namespace Ice { | 53 namespace Ice { |
50 namespace X8632 { | 54 namespace X8632 { |
51 | 55 |
52 //------------------------------------------------------------------------------ | 56 //------------------------------------------------------------------------------ |
53 // ______ ______ ______ __ ______ ______ | 57 // ______ ______ ______ __ ______ ______ |
54 // /\__ _\ /\ == \ /\ __ \ /\ \ /\__ _\ /\ ___\ | 58 // /\__ _\ /\ == \ /\ __ \ /\ \ /\__ _\ /\ ___\ |
55 // \/_/\ \/ \ \ __< \ \ __ \ \ \ \ \/_/\ \/ \ \___ \ | 59 // \/_/\ \/ \ \ __< \ \ __ \ \ \ \ \/_/\ \/ \ \___ \ |
56 // \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_\ \ \_\ \/\_____\ | 60 // \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_\ \ \_\ \/\_____\ |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 BeforeAddReloc->setSubtract(true); | 249 BeforeAddReloc->setSubtract(true); |
246 auto *BeforeAdd = InstX86Label::create(Func, this); | 250 auto *BeforeAdd = InstX86Label::create(Func, this); |
247 BeforeAdd->setRelocOffset(BeforeAddReloc); | 251 BeforeAdd->setRelocOffset(BeforeAddReloc); |
248 | 252 |
249 auto *AfterAddReloc = RelocOffset::create(Ctx); | 253 auto *AfterAddReloc = RelocOffset::create(Ctx); |
250 auto *AfterAdd = InstX86Label::create(Func, this); | 254 auto *AfterAdd = InstX86Label::create(Func, this); |
251 AfterAdd->setRelocOffset(AfterAddReloc); | 255 AfterAdd->setRelocOffset(AfterAddReloc); |
252 | 256 |
253 const RelocOffsetT ImmSize = -typeWidthInBytes(IceType_i32); | 257 const RelocOffsetT ImmSize = -typeWidthInBytes(IceType_i32); |
254 | 258 |
255 auto *GotFromPc = llvm::cast<ConstantRelocatable>( | 259 auto *GotFromPc = |
256 Ctx->getConstantSym(ImmSize, {AfterAddReloc, BeforeAddReloc}, | 260 llvm::cast<ConstantRelocatable>(Ctx->getConstantSymWithEmitString( |
257 GlobalOffsetTable, GlobalOffsetTable)); | 261 ImmSize, {AfterAddReloc, BeforeAddReloc}, |
| 262 Ctx->getGlobalString(GlobalOffsetTable), GlobalOffsetTable)); |
258 | 263 |
259 // Insert a new version of InstX86GetIP. | 264 // Insert a new version of InstX86GetIP. |
260 Context.insert<Traits::Insts::GetIP>(CallDest); | 265 Context.insert<Traits::Insts::GetIP>(CallDest); |
261 | 266 |
262 Context.insert(BeforeAdd); | 267 Context.insert(BeforeAdd); |
263 _add(CallDest, GotFromPc); | 268 _add(CallDest, GotFromPc); |
264 Context.insert(AfterAdd); | 269 Context.insert(AfterAdd); |
265 | 270 |
266 // Spill the register to its home stack location if necessary. | 271 // Spill the register to its home stack location if necessary. |
267 if (Dest != CallDest) { | 272 if (Dest != CallDest) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ | 482 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ |
478 static_assert(_table1_##tag == _table2_##tag, \ | 483 static_assert(_table1_##tag == _table2_##tag, \ |
479 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 484 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
480 ICETYPE_TABLE | 485 ICETYPE_TABLE |
481 #undef X | 486 #undef X |
482 } // end of namespace dummy3 | 487 } // end of namespace dummy3 |
483 } // end of anonymous namespace | 488 } // end of anonymous namespace |
484 | 489 |
485 } // end of namespace X8632 | 490 } // end of namespace X8632 |
486 } // end of namespace Ice | 491 } // end of namespace Ice |
OLD | NEW |