Skip to content

Commit ec501f1

Browse files
author
Shao-Ce SUN
committed
[clang][CodeGen] Remove the signed version of createExpression
Fix a TODO. Remove the callers of this signed version and delete. Reviewed By: CodaFi Differential Revision: https://reviews.llvm.org/D116014
1 parent 5d47e7d commit ec501f1

File tree

7 files changed

+14
-21
lines changed

7 files changed

+14
-21
lines changed

Diff for: clang/lib/CodeGen/CGDebugInfo.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
722722
auto *LowerBound =
723723
llvm::ConstantAsMetadata::get(llvm::ConstantInt::getSigned(
724724
llvm::Type::getInt64Ty(CGM.getLLVMContext()), 0));
725-
SmallVector<int64_t, 9> Expr(
725+
SmallVector<uint64_t, 9> Expr(
726726
{llvm::dwarf::DW_OP_constu, NumElemsPerVG, llvm::dwarf::DW_OP_bregx,
727727
/* AArch64::VG */ 46, 0, llvm::dwarf::DW_OP_mul,
728728
llvm::dwarf::DW_OP_constu, 1, llvm::dwarf::DW_OP_minus});
@@ -768,7 +768,7 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
768768
}
769769

770770
// Element count = (VLENB / SEW) x LMUL
771-
SmallVector<int64_t, 12> Expr(
771+
SmallVector<uint64_t, 12> Expr(
772772
// The DW_OP_bregx operation has two operands: a register which is
773773
// specified by an unsigned LEB128 number, followed by a signed LEB128
774774
// offset.
@@ -4325,7 +4325,7 @@ void CGDebugInfo::CreateLexicalBlock(SourceLocation Loc) {
43254325
}
43264326

43274327
void CGDebugInfo::AppendAddressSpaceXDeref(
4328-
unsigned AddressSpace, SmallVectorImpl<int64_t> &Expr) const {
4328+
unsigned AddressSpace, SmallVectorImpl<uint64_t> &Expr) const {
43294329
Optional<unsigned> DWARFAddressSpace =
43304330
CGM.getTarget().getDWARFAddressSpace(AddressSpace);
43314331
if (!DWARFAddressSpace)
@@ -4494,7 +4494,7 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD,
44944494
Line = getLineNumber(VD->getLocation());
44954495
Column = getColumnNumber(VD->getLocation());
44964496
}
4497-
SmallVector<int64_t, 13> Expr;
4497+
SmallVector<uint64_t, 13> Expr;
44984498
llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
44994499
if (VD->isImplicit())
45004500
Flags |= llvm::DINode::FlagArtificial;
@@ -4720,7 +4720,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
47204720
target.getStructLayout(blockInfo.StructureType)
47214721
->getElementOffset(blockInfo.getCapture(VD).getIndex()));
47224722

4723-
SmallVector<int64_t, 9> addr;
4723+
SmallVector<uint64_t, 9> addr;
47244724
addr.push_back(llvm::dwarf::DW_OP_deref);
47254725
addr.push_back(llvm::dwarf::DW_OP_plus_uconst);
47264726
addr.push_back(offset.getQuantity());
@@ -5191,7 +5191,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
51915191
} else {
51925192
auto Align = getDeclAlignIfRequired(D, CGM.getContext());
51935193

5194-
SmallVector<int64_t, 4> Expr;
5194+
SmallVector<uint64_t, 4> Expr;
51955195
unsigned AddressSpace =
51965196
CGM.getContext().getTargetAddressSpace(D->getType());
51975197
if (CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) {

Diff for: clang/lib/CodeGen/CGDebugInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class CGDebugInfo {
363363
/// Extended dereferencing mechanism is has the following format:
364364
/// DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
365365
void AppendAddressSpaceXDeref(unsigned AddressSpace,
366-
SmallVectorImpl<int64_t> &Expr) const;
366+
SmallVectorImpl<uint64_t> &Expr) const;
367367

368368
/// A helper function to collect debug info for the default elements of a
369369
/// block.

Diff for: llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ value llvm_instr_set_debug_loc(LLVMValueRef Inst, LLVMMetadataRef Loc) {
865865
LLVMMetadataRef llvm_dibuild_create_constant_value_expression(value Builder,
866866
value Value) {
867867
return LLVMDIBuilderCreateConstantValueExpression(DIBuilder_val(Builder),
868-
(int64_t)Int_val(Value));
868+
(uint64_t)Int_val(Value));
869869
}
870870

871871
LLVMMetadataRef llvm_dibuild_create_global_variable_expression_native(

Diff for: llvm/include/llvm-c/DebugInfo.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
11021102
* \param Length Length of the address operation array.
11031103
*/
11041104
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
1105-
int64_t *Addr, size_t Length);
1105+
uint64_t *Addr, size_t Length);
11061106

11071107
/**
11081108
* Create a new descriptor for the specified variable that does not have an
@@ -1112,7 +1112,7 @@ LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
11121112
*/
11131113
LLVMMetadataRef
11141114
LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
1115-
int64_t Value);
1115+
uint64_t Value);
11161116

11171117
/**
11181118
* Create a new descriptor for the specified variable.

Diff for: llvm/include/llvm/IR/DIBuilder.h

-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,6 @@ namespace llvm {
698698
/// variable which has a complex address expression for its address.
699699
/// \param Addr An array of complex address operations.
700700
DIExpression *createExpression(ArrayRef<uint64_t> Addr = None);
701-
DIExpression *createExpression(ArrayRef<int64_t> Addr);
702701

703702
/// Create an expression for a variable that does not have an address, but
704703
/// does have a constant value.

Diff for: llvm/lib/IR/DIBuilder.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -821,12 +821,6 @@ DIExpression *DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
821821
return DIExpression::get(VMContext, Addr);
822822
}
823823

824-
DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
825-
// TODO: Remove the callers of this signed version and delete.
826-
SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end());
827-
return createExpression(Addr);
828-
}
829-
830824
template <class... Ts>
831825
static DISubprogram *getSubprogram(bool IsDistinct, Ts &&...Args) {
832826
if (IsDistinct)

Diff for: llvm/lib/IR/DebugInfo.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1436,14 +1436,14 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
14361436
}
14371437

14381438
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
1439-
int64_t *Addr, size_t Length) {
1440-
return wrap(unwrap(Builder)->createExpression(ArrayRef<int64_t>(Addr,
1441-
Length)));
1439+
uint64_t *Addr, size_t Length) {
1440+
return wrap(
1441+
unwrap(Builder)->createExpression(ArrayRef<uint64_t>(Addr, Length)));
14421442
}
14431443

14441444
LLVMMetadataRef
14451445
LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
1446-
int64_t Value) {
1446+
uint64_t Value) {
14471447
return wrap(unwrap(Builder)->createConstantValueExpression(Value));
14481448
}
14491449

0 commit comments

Comments
 (0)