Skip to content

Commit f0dbcfe

Browse files
authored
[RemoveDIs] Update DIBuilder C API with DbgRecord functions [1/2] (#84915)
Follow on from #84739, which updates the DIBuilder class. All the functions that have been added are temporary and will be deprecated in the future. The intention is that they'll help downstream projects adapt during the transition period. ``` New functions (all to be deprecated) ------------------------------------ LLVMIsNewDbgInfoFormat # Returns true if the module is in the new non-instruction mode. LLVMSetIsNewDbgInfoFormat # Convert to the requested debug info format. LLVMDIBuilderInsertDeclareIntrinsicBefore # Insert a debug intrinsic (old debug info format). LLVMDIBuilderInsertDeclareIntrinsicAtEnd # Same as above. LLVMDIBuilderInsertDbgValueIntrinsicBefore # Same as above. LLVMDIBuilderInsertDbgValueIntrinsicAtEnd # Same as above. LLVMDIBuilderInsertDeclareRecordBefore # Insert a debug record (new debug info format). LLVMDIBuilderInsertDeclareRecordAtEnd # Same as above. LLVMDIBuilderInsertDbgValueRecordBefore # Same as above. LLVMDIBuilderInsertDbgValueRecordAtEnd # Same as above. ``` The existing `LLVMDIBuilderInsert...` functions call through to the intrinsic versions (old debug info format) currently. In the next patch, I'll swap them to call the debug records versions (new debug info format). Downstream users of this API can query and change the current format using the first two functions above, or can instead opt to temporarily use intrinsics or records explicitly.
1 parent a60deaa commit f0dbcfe

File tree

10 files changed

+301
-30
lines changed

10 files changed

+301
-30
lines changed

llvm/docs/RemoveDIsDebugInfo.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ There are two significant changes to be aware of. Firstly, we're adding a single
3030

3131
The second matter is that if you transfer sequences of instructions from one place to another manually, i.e. repeatedly using `moveBefore` where you might have used `splice`, then you should instead use the method `moveBeforePreserving`. `moveBeforePreserving` will transfer debug info records with the instruction they're attached to. This is something that happens automatically today -- if you use `moveBefore` on every element of an instruction sequence, then debug intrinsics will be moved in the normal course of your code, but we lose this behaviour with non-instruction debug info.
3232

33+
# C-API changes
34+
35+
All the functions that have been added are temporary and will be deprecated in the future. The intention is that they'll help downstream projects adapt during the transition period.
36+
37+
```
38+
New functions (all to be deprecated)
39+
------------------------------------
40+
LLVMIsNewDbgInfoFormat # Returns true if the module is in the new non-instruction mode.
41+
LLVMSetIsNewDbgInfoFormat # Convert to the requested debug info format.
42+
43+
LLVMDIBuilderInsertDeclareIntrinsicBefore # Insert a debug intrinsic (old debug info format).
44+
LLVMDIBuilderInsertDeclareIntrinsicAtEnd # Same as above.
45+
LLVMDIBuilderInsertDbgValueIntrinsicBefore # Same as above.
46+
LLVMDIBuilderInsertDbgValueIntrinsicAtEnd # Same as above.
47+
48+
LLVMDIBuilderInsertDeclareRecordBefore # Insert a debug record (new debug info format).
49+
LLVMDIBuilderInsertDeclareRecordAtEnd # Same as above.
50+
LLVMDIBuilderInsertDbgValueRecordBefore # Same as above.
51+
LLVMDIBuilderInsertDbgValueRecordAtEnd # Same as above.
52+
```
53+
3354
# Anything else?
3455

3556
Not really, but here's an "old vs new" comparison of how to do certain things and quickstart for how this "new" debug info is structured.

llvm/include/llvm-c/Core.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,24 @@ LLVMModuleRef LLVMCloneModule(LLVMModuleRef M);
744744
*/
745745
void LLVMDisposeModule(LLVMModuleRef M);
746746

747+
/**
748+
* Soon to be deprecated.
749+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
750+
*
751+
* Returns true if the module is in the new debug info mode which uses
752+
* non-instruction debug records instead of debug intrinsics for variable
753+
* location tracking.
754+
*/
755+
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M);
756+
757+
/**
758+
* Soon to be deprecated.
759+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
760+
*
761+
* Convert module into desired debug info format.
762+
*/
763+
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat);
764+
747765
/**
748766
* Obtain the identifier of a module.
749767
*

llvm/include/llvm-c/DebugInfo.h

Lines changed: 147 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,24 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
12481248
unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
12491249
LLVMMetadataRef Decl, uint32_t AlignInBits);
12501250

1251+
/*
1252+
* Insert a new llvm.dbg.declare intrinsic call before the given instruction.
1253+
* \param Builder The DIBuilder.
1254+
* \param Storage The storage of the variable to declare.
1255+
* \param VarInfo The variable's debug info descriptor.
1256+
* \param Expr A complex location expression for the variable.
1257+
* \param DebugLoc Debug info location.
1258+
* \param Instr Instruction acting as a location for the new intrinsic.
1259+
*/
1260+
LLVMValueRef
1261+
LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
1262+
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
1263+
LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12511264
/**
1265+
* Soon to be deprecated.
1266+
* Only use in "old debug mode" (LLVMIsNewDbgFormat() is false).
1267+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1268+
*
12521269
* Insert a new llvm.dbg.declare intrinsic call before the given instruction.
12531270
* \param Builder The DIBuilder.
12541271
* \param Storage The storage of the variable to declare.
@@ -1257,9 +1274,25 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
12571274
* \param DebugLoc Debug info location.
12581275
* \param Instr Instruction acting as a location for the new intrinsic.
12591276
*/
1260-
LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
1261-
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1262-
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1277+
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
1278+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1279+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1280+
/**
1281+
* Soon to be deprecated.
1282+
* Only use in "new debug mode" (LLVMIsNewDbgFormat() is true).
1283+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1284+
*
1285+
* Insert a Declare DbgRecord before the given instruction.
1286+
* \param Builder The DIBuilder.
1287+
* \param Storage The storage of the variable to declare.
1288+
* \param VarInfo The variable's debug info descriptor.
1289+
* \param Expr A complex location expression for the variable.
1290+
* \param DebugLoc Debug info location.
1291+
* \param Instr Instruction acting as a location for the new record.
1292+
*/
1293+
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
1294+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1295+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12631296

12641297
/**
12651298
* Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
@@ -1275,6 +1308,42 @@ LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
12751308
LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
12761309
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
12771310
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1311+
/**
1312+
* Soon to be deprecated.
1313+
* Only use in "old debug mode" (LLVMIsNewDbgFormat() is false).
1314+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1315+
*
1316+
* Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
1317+
* block. If the basic block has a terminator instruction, the intrinsic is
1318+
* inserted before that terminator instruction.
1319+
* \param Builder The DIBuilder.
1320+
* \param Storage The storage of the variable to declare.
1321+
* \param VarInfo The variable's debug info descriptor.
1322+
* \param Expr A complex location expression for the variable.
1323+
* \param DebugLoc Debug info location.
1324+
* \param Block Basic block acting as a location for the new intrinsic.
1325+
*/
1326+
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
1327+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1328+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1329+
/**
1330+
* Soon to be deprecated.
1331+
* Only use in "new debug mode" (LLVMIsNewDbgFormat() is true).
1332+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1333+
*
1334+
* Insert a Declare DbgRecord at the end of the given basic block. If the basic
1335+
* block has a terminator instruction, the record is inserted before that
1336+
* terminator instruction.
1337+
* \param Builder The DIBuilder.
1338+
* \param Storage The storage of the variable to declare.
1339+
* \param VarInfo The variable's debug info descriptor.
1340+
* \param Expr A complex location expression for the variable.
1341+
* \param DebugLoc Debug info location.
1342+
* \param Block Basic block acting as a location for the new record.
1343+
*/
1344+
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
1345+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1346+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
12781347

12791348
/**
12801349
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
@@ -1285,12 +1354,42 @@ LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
12851354
* \param DebugLoc Debug info location.
12861355
* \param Instr Instruction acting as a location for the new intrinsic.
12871356
*/
1288-
LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder,
1289-
LLVMValueRef Val,
1290-
LLVMMetadataRef VarInfo,
1291-
LLVMMetadataRef Expr,
1292-
LLVMMetadataRef DebugLoc,
1293-
LLVMValueRef Instr);
1357+
LLVMValueRef
1358+
LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder, LLVMValueRef Val,
1359+
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
1360+
LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1361+
/**
1362+
* Soon to be deprecated.
1363+
* Only use in "old debug mode" (Module::IsNewDbgInfoFormat is false).
1364+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1365+
*
1366+
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
1367+
* \param Builder The DIBuilder.
1368+
* \param Val The value of the variable.
1369+
* \param VarInfo The variable's debug info descriptor.
1370+
* \param Expr A complex location expression for the variable.
1371+
* \param DebugLoc Debug info location.
1372+
* \param Instr Instruction acting as a location for the new intrinsic.
1373+
*/
1374+
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
1375+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1376+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1377+
/**
1378+
* Soon to be deprecated.
1379+
* Only use in "new debug mode" (Module::IsNewDbgInfoFormat is true).
1380+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1381+
*
1382+
* Insert a new llvm.dbg.value intrinsic call before the given instruction.
1383+
* \param Builder The DIBuilder.
1384+
* \param Val The value of the variable.
1385+
* \param VarInfo The variable's debug info descriptor.
1386+
* \param Expr A complex location expression for the variable.
1387+
* \param DebugLoc Debug info location.
1388+
* \param Instr Instruction acting as a location for the new intrinsic.
1389+
*/
1390+
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
1391+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1392+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
12941393

12951394
/**
12961395
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic
@@ -1303,12 +1402,45 @@ LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder,
13031402
* \param DebugLoc Debug info location.
13041403
* \param Block Basic block acting as a location for the new intrinsic.
13051404
*/
1306-
LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder,
1307-
LLVMValueRef Val,
1308-
LLVMMetadataRef VarInfo,
1309-
LLVMMetadataRef Expr,
1310-
LLVMMetadataRef DebugLoc,
1311-
LLVMBasicBlockRef Block);
1405+
LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(
1406+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1407+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1408+
/**
1409+
* Soon to be deprecated.
1410+
* Only use in "old debug mode" (Module::IsNewDbgInfoFormat is false).
1411+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1412+
*
1413+
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1414+
* block. If the basic block has a terminator instruction, the intrinsic is
1415+
* inserted before that terminator instruction.
1416+
* \param Builder The DIBuilder.
1417+
* \param Val The value of the variable.
1418+
* \param VarInfo The variable's debug info descriptor.
1419+
* \param Expr A complex location expression for the variable.
1420+
* \param DebugLoc Debug info location.
1421+
* \param Block Basic block acting as a location for the new intrinsic.
1422+
*/
1423+
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
1424+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1425+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1426+
/**
1427+
* Soon to be deprecated.
1428+
* Only use in "new debug mode" (Module::IsNewDbgInfoFormat is true).
1429+
* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1430+
*
1431+
* Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1432+
* block. If the basic block has a terminator instruction, the intrinsic is
1433+
* inserted before that terminator instruction.
1434+
* \param Builder The DIBuilder.
1435+
* \param Val The value of the variable.
1436+
* \param VarInfo The variable's debug info descriptor.
1437+
* \param Expr A complex location expression for the variable.
1438+
* \param DebugLoc Debug info location.
1439+
* \param Block Basic block acting as a location for the new intrinsic.
1440+
*/
1441+
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(
1442+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1443+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
13121444

13131445
/**
13141446
* Create a new descriptor for a local auto variable.

llvm/include/llvm-c/Types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
169169
*/
170170
typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
171171

172+
/**
173+
* @see llvm::DbgRecord
174+
*/
175+
typedef struct LLVMOpaqueDbgRecord *LLVMDbgRecordRef;
176+
172177
/**
173178
* @}
174179
*/

llvm/include/llvm/IR/DebugProgramInstruction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ getDbgRecordRange(DPMarker *DbgMarker) {
645645
return DbgMarker->getDbgRecordRange();
646646
}
647647

648+
DEFINE_ISA_CONVERSION_FUNCTIONS(DbgRecord, LLVMDbgRecordRef);
649+
648650
} // namespace llvm
649651

650652
#endif // LLVM_IR_DEBUGPROGRAMINSTRUCTION_H

llvm/lib/IR/Core.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ void LLVMAddModuleFlag(LLVMModuleRef M, LLVMModuleFlagBehavior Behavior,
404404
{Key, KeyLen}, unwrap(Val));
405405
}
406406

407+
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M) {
408+
return unwrap(M)->IsNewDbgInfoFormat;
409+
}
410+
411+
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat) {
412+
unwrap(M)->setIsNewDbgInfoFormat(UseNewFormat);
413+
}
414+
407415
/*--.. Printing modules ....................................................--*/
408416

409417
void LLVMDumpModule(LLVMModuleRef M) {

llvm/lib/IR/DebugInfo.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,12 @@ LLVMValueRef
16631663
LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
16641664
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
16651665
LLVMMetadataRef DL, LLVMValueRef Instr) {
1666+
return LLVMDIBuilderInsertDeclareIntrinsicBefore(Builder, Storage, VarInfo,
1667+
Expr, DL, Instr);
1668+
}
1669+
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicBefore(
1670+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1671+
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
16661672
DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
16671673
unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
16681674
unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
@@ -1671,40 +1677,98 @@ LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
16711677
"Inserted a DbgRecord into function using old debug info mode");
16721678
return wrap(cast<Instruction *>(DbgInst));
16731679
}
1680+
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
1681+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1682+
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
1683+
return wrap(
1684+
unwrap(Builder)
1685+
->insertDeclare(unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
1686+
unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
1687+
unwrap<Instruction>(Instr))
1688+
.get<DbgRecord *>());
1689+
}
16741690

16751691
LLVMValueRef
16761692
LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
16771693
LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
16781694
LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
1695+
return LLVMDIBuilderInsertDeclareIntrinsicAtEnd(Builder, Storage, VarInfo,
1696+
Expr, DL, Block);
1697+
}
1698+
LLVMValueRef LLVMDIBuilderInsertDeclareIntrinsicAtEnd(
1699+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1700+
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
16791701
DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
16801702
unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
16811703
unwrap<DIExpression>(Expr), unwrap<DILocation>(DL), unwrap(Block));
16821704
assert(isa<Instruction *>(DbgInst) &&
16831705
"Inserted a DbgRecord into function using old debug info mode");
16841706
return wrap(cast<Instruction *>(DbgInst));
16851707
}
1708+
LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(
1709+
LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1710+
LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block) {
1711+
return wrap(unwrap(Builder)
1712+
->insertDeclare(unwrap(Storage),
1713+
unwrap<DILocalVariable>(VarInfo),
1714+
unwrap<DIExpression>(Expr),
1715+
unwrap<DILocation>(DL), unwrap(Block))
1716+
.get<DbgRecord *>());
1717+
}
16861718

16871719
LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(
16881720
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
16891721
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
1722+
return LLVMDIBuilderInsertDbgValueIntrinsicBefore(Builder, Val, VarInfo, Expr,
1723+
DebugLoc, Instr);
1724+
}
1725+
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
1726+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1727+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
16901728
DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
16911729
unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
16921730
unwrap<DILocation>(DebugLoc), unwrap<Instruction>(Instr));
16931731
assert(isa<Instruction *>(DbgInst) &&
16941732
"Inserted a DbgRecord into function using old debug info mode");
16951733
return wrap(cast<Instruction *>(DbgInst));
16961734
}
1735+
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(
1736+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1737+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr) {
1738+
return wrap(unwrap(Builder)
1739+
->insertDbgValueIntrinsic(
1740+
unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1741+
unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
1742+
unwrap<Instruction>(Instr))
1743+
.get<DbgRecord *>());
1744+
}
16971745

16981746
LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(
16991747
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
17001748
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
1749+
return LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(Builder, Val, VarInfo, Expr,
1750+
DebugLoc, Block);
1751+
}
1752+
LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicAtEnd(
1753+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1754+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
17011755
DbgInstPtr DbgInst = unwrap(Builder)->insertDbgValueIntrinsic(
17021756
unwrap(Val), unwrap<DILocalVariable>(VarInfo), unwrap<DIExpression>(Expr),
17031757
unwrap<DILocation>(DebugLoc), unwrap(Block));
17041758
assert(isa<Instruction *>(DbgInst) &&
17051759
"Inserted a DbgRecord into function using old debug info mode");
17061760
return wrap(cast<Instruction *>(DbgInst));
17071761
}
1762+
LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(
1763+
LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,
1764+
LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block) {
1765+
return wrap(unwrap(Builder)
1766+
->insertDbgValueIntrinsic(
1767+
unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1768+
unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
1769+
unwrap(Block))
1770+
.get<DbgRecord *>());
1771+
}
17081772

17091773
LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
17101774
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,

0 commit comments

Comments
 (0)