@@ -299,21 +299,11 @@ void CompileUnit::addSInt(IGC::DIEBlock* Die, Optional<dwarf::Form> Form, int64_
299
299
// / table.
300
300
void CompileUnit::addString (DIE* Die, dwarf::Attribute Attribute, StringRef String)
301
301
{
302
- if (DD->IsDirectElfInput ())
303
- {
304
- // Emit string inlined
305
- auto Str = new (DIEValueAllocator) DIEInlinedString (String);
306
- // Collect all inlined string DIEs to later call dtor
307
- DIEInlinedStrings.push_back (Str);
308
- Die->addValue (Attribute, dwarf::DW_FORM_string, Str);
309
- }
310
- else
311
- {
312
- MCSymbol* Symb = DD->getStringPoolEntry (String);
313
- DIEValue* Value = new (DIEValueAllocator)DIELabel (Symb);
314
- DIEValue* Str = new (DIEValueAllocator)DIEString (Value, String);
315
- Die->addValue (Attribute, dwarf::DW_FORM_strp, Str);
316
- }
302
+ // Emit string inlined
303
+ auto Str = new (DIEValueAllocator) DIEInlinedString (String);
304
+ // Collect all inlined string DIEs to later call dtor
305
+ DIEInlinedStrings.push_back (Str);
306
+ Die->addValue (Attribute, dwarf::DW_FORM_string, Str);
317
307
}
318
308
319
309
// / addExpr - Add a Dwarf expression attribute data and value.
@@ -2356,32 +2346,23 @@ IGC::DIE* CompileUnit::constructVariableDIE(DbgVariable& DV, bool isScopeAbstrac
2356
2346
unsigned Offset = DV.getDotDebugLocOffset ();
2357
2347
if (Offset != ~0U )
2358
2348
{
2359
- if (DD->IsDirectElfInput ())
2349
+ // Copy over references ranges to DotLocDebugEntries
2350
+ if (EmitSettings.EnableRelocation )
2360
2351
{
2361
- // Copy over references ranges to DotLocDebugEntries
2362
- if (EmitSettings.EnableRelocation )
2363
- {
2364
- // Retrieve correct location value based on Offset.
2365
- // Then attach label corresponding to this offset
2366
- // to DW_AT_location attribute.
2367
- auto LocLabel = DD->CopyDebugLoc (Offset);
2368
- addLabelLoc (VariableDie, dwarf::DW_AT_location, LocLabel);
2369
- }
2370
- else
2371
- {
2372
- Offset = DD->CopyDebugLocNoReloc (Offset);
2373
- addUInt (VariableDie, dwarf::DW_AT_location, dwarf::DW_FORM_sec_offset, Offset);
2374
- }
2375
- if (DV.getDecorations ().size () > 0 )
2376
- {
2377
- addString (VariableDie, dwarf::DW_AT_description, DV.getDecorations ());
2378
- }
2352
+ // Retrieve correct location value based on Offset.
2353
+ // Then attach label corresponding to this offset
2354
+ // to DW_AT_location attribute.
2355
+ auto LocLabel = DD->CopyDebugLoc (Offset);
2356
+ addLabelLoc (VariableDie, dwarf::DW_AT_location, LocLabel);
2379
2357
}
2380
2358
else
2381
2359
{
2382
- addLabel (VariableDie, dwarf::DW_AT_location,
2383
- DD->getDwarfVersion () >= 4 ? dwarf::DW_FORM_sec_offset : dwarf::DW_FORM_data4,
2384
- Asm->GetTempSymbol (" debug_loc" , Offset));
2360
+ Offset = DD->CopyDebugLocNoReloc (Offset);
2361
+ addUInt (VariableDie, dwarf::DW_AT_location, dwarf::DW_FORM_sec_offset, Offset);
2362
+ }
2363
+ if (DV.getDecorations ().size () > 0 )
2364
+ {
2365
+ addString (VariableDie, dwarf::DW_AT_description, DV.getDecorations ());
2385
2366
}
2386
2367
DV.setDIE (VariableDie);
2387
2368
return VariableDie;
@@ -2429,94 +2410,27 @@ void CompileUnit::buildLocation(const llvm::Instruction* pDbgInst, DbgVariable&
2429
2410
return ;
2430
2411
}
2431
2412
2432
- bool addDecoration = false ;
2433
- if (VISAModule->isDirectElfInput )
2413
+ if (FirstLoc.HasSurface ())
2434
2414
{
2435
- if (FirstLoc.HasSurface ())
2436
- {
2437
- IGC::DIEBlock* Block = new (DIEValueAllocator)IGC::DIEBlock ();
2438
- addRegisterOp (Block, FirstLoc.GetSurface ());
2439
- // Now attach the surface information to the DIE.
2440
- addBlock (VariableDie, dwarf::DW_AT_segment, Block);
2441
- }
2442
-
2443
- IGC::DIEBlock* locationAT = nullptr ;
2444
- if (FirstLoc.IsSLM ())
2445
- locationAT = buildSLM (DV, &FirstLoc);
2446
- else if (FirstLoc.IsSampler ())
2447
- locationAT = buildSampler (DV, &FirstLoc);
2448
- else if (FirstLoc.HasSurface () &&
2449
- (DV.getType () && DV.getType ()->getTag () == dwarf::DW_TAG_pointer_type))
2450
- locationAT = buildPointer (DV, &FirstLoc);
2451
- else
2452
- locationAT = buildGeneral (DV, &Locs, nullptr );
2453
-
2454
- if (locationAT)
2455
- addBlock (VariableDie, dwarf::DW_AT_location, locationAT);
2456
- addDecoration = true ;
2415
+ IGC::DIEBlock* Block = new (DIEValueAllocator)IGC::DIEBlock ();
2416
+ addRegisterOp (Block, FirstLoc.GetSurface ());
2417
+ // Now attach the surface information to the DIE.
2418
+ addBlock (VariableDie, dwarf::DW_AT_segment, Block);
2457
2419
}
2458
- else
2459
- {
2460
- // Variable which is not immediate can have surface, location or both.
2461
- if (FirstLoc.HasSurface ())
2462
- {
2463
- IGC::DIEBlock* Block = new (DIEValueAllocator)IGC::DIEBlock ();
2464
- addRegisterOp (Block, FirstLoc.GetSurface ());
2465
- // Now attach the surface information to the DIE.
2466
- addBlock (VariableDie, dwarf::DW_AT_segment, Block);
2467
- if (!FirstLoc.HasLocation ())
2468
- {
2469
- // Make sure there is always a location attribute when there is a surface attribute.
2470
- // In this case, attach an zero address opcode location information to the DIE.
2471
- IGC::DIEBlock* nBlock = new (DIEValueAllocator)IGC::DIEBlock ();
2472
- addUInt (nBlock, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
2473
- dwarf::Form form = (Asm->GetPointerSize () == 8 ) ? dwarf::DW_FORM_data8 : dwarf::DW_FORM_data4;
2474
- addUInt (nBlock, form, 0 );
2475
-
2476
- addBlock (VariableDie, dwarf::DW_AT_location, nBlock);
2477
- }
2478
- }
2479
-
2480
- if (FirstLoc.HasLocation ())
2481
- {
2482
- #if 0
2483
- /* This has been disabled because of following kind of metadata node generated:
2484
- !98 = metadata !{i32 786688, metadata !11, metadata !"adder", metadata !6, i32 4, metadata !14, i32 0, metadata !56, i64
2485
- 2, i64 1, i64 32}
2486
-
2487
- numOperands here indicates complex addressing is used. But for complex addressing,
2488
- 9th operand should be a metadata node whereas here integer nodes are added.
2489
- */
2490
- IGC_ASSERT_MESSAGE(!(DV.variableHasComplexAddress() || DV.isBlockByrefVariable()), "Should handle complex address");
2491
- #endif
2492
- IGC::DIEBlock* Block = new (DIEValueAllocator)IGC::DIEBlock ();
2493
2420
2494
- if (!FirstLoc.IsInMemory ())
2495
- {
2496
- IGC_ASSERT_MESSAGE (FirstLoc.IsRegister (), " Direct location must be register" );
2497
- addRegisterOp (Block, FirstLoc.GetRegister ());
2498
- }
2499
- else
2500
- {
2501
- if (FirstLoc.IsRegister ())
2502
- {
2503
- addRegisterOffset (Block, FirstLoc.GetRegister (), FirstLoc.GetOffset ());
2504
- }
2505
- else
2506
- {
2507
- addUInt (Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
2508
- addSInt (Block, dwarf::DW_FORM_udata, FirstLoc.GetOffset ());
2509
- }
2510
- }
2511
-
2512
- // Now attach the location information to the DIE.
2513
- addBlock (VariableDie, dwarf::DW_AT_location, Block);
2514
-
2515
- addDecoration = true ;
2516
- }
2421
+ IGC::DIEBlock* locationAT = nullptr ;
2422
+ if (FirstLoc.IsSLM ())
2423
+ locationAT = buildSLM (DV, &FirstLoc);
2424
+ else if (FirstLoc.IsSampler ())
2425
+ locationAT = buildSampler (DV, &FirstLoc);
2426
+ else if (FirstLoc.HasSurface () &&
2427
+ (DV.getType () && DV.getType ()->getTag () == dwarf::DW_TAG_pointer_type))
2428
+ locationAT = buildPointer (DV, &FirstLoc);
2429
+ else
2430
+ locationAT = buildGeneral (DV, &Locs, nullptr );
2517
2431
2518
- DV. setDIE (VariableDie);
2519
- }
2432
+ if (locationAT)
2433
+ addBlock (VariableDie, dwarf::DW_AT_location, locationAT);
2520
2434
}
2521
2435
2522
2436
IGC::DIEBlock* CompileUnit::buildPointer (DbgVariable& var, const VISAVariableLocation* loc)
0 commit comments