Skip to content

Commit 4c4b7de

Browse files
committed
Rename getRawPointer/getRawPointerFromAddress to emitRawPointer/emitRawPointerFromAddress
1 parent 4f24a1b commit 4c4b7de

40 files changed

+413
-408
lines changed

clang/lib/CodeGen/ABIInfoImpl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ CodeGen::emitVoidPtrDirectVAArg(CodeGenFunction &CGF, Address VAListAddr,
187187
CharUnits FullDirectSize = DirectSize.alignTo(SlotSize);
188188
Address NextPtr =
189189
CGF.Builder.CreateConstInBoundsByteGEP(Addr, FullDirectSize, "argp.next");
190-
CGF.Builder.CreateStore(NextPtr.getRawPointer(CGF), VAListAddr);
190+
CGF.Builder.CreateStore(NextPtr.emitRawPointer(CGF), VAListAddr);
191191

192192
// If the argument is smaller than a slot, and this is a big-endian
193193
// target, the argument will be right-adjusted in its slot.
@@ -239,8 +239,8 @@ Address CodeGen::emitMergePHI(CodeGenFunction &CGF, Address Addr1,
239239
const llvm::Twine &Name) {
240240
assert(Addr1.getType() == Addr2.getType());
241241
llvm::PHINode *PHI = CGF.Builder.CreatePHI(Addr1.getType(), 2, Name);
242-
PHI->addIncoming(Addr1.getRawPointer(CGF), Block1);
243-
PHI->addIncoming(Addr2.getRawPointer(CGF), Block2);
242+
PHI->addIncoming(Addr1.emitRawPointer(CGF), Block1);
243+
PHI->addIncoming(Addr2.emitRawPointer(CGF), Block2);
244244
CharUnits Align = std::min(Addr1.getAlignment(), Addr2.getAlignment());
245245
return Address(PHI, Addr1.getElementType(), Align);
246246
}
@@ -400,7 +400,7 @@ Address CodeGen::EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr,
400400
llvm::Type *ElementTy = CGF.ConvertTypeForMem(Ty);
401401
llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
402402
llvm::Value *Addr =
403-
CGF.Builder.CreateVAArg(VAListAddr.getRawPointer(CGF), BaseTy);
403+
CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF), BaseTy);
404404
return Address(Addr, ElementTy, TyAlignForABI);
405405
} else {
406406
assert((AI.isDirect() || AI.isExtend()) &&
@@ -416,7 +416,7 @@ Address CodeGen::EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr,
416416
"Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
417417

418418
Address Temp = CGF.CreateMemTemp(Ty, "varet");
419-
Val = CGF.Builder.CreateVAArg(VAListAddr.getRawPointer(CGF),
419+
Val = CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF),
420420
CGF.ConvertTypeForMem(Ty));
421421
CGF.Builder.CreateStore(Val, Temp);
422422
return Temp;

clang/lib/CodeGen/Address.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Address {
124124
/// Offset from the base pointer.
125125
llvm::Value *Offset = nullptr;
126126

127-
llvm::Value *getRawPointerSlow(CodeGenFunction &CGF) const;
127+
llvm::Value *emitRawPointerSlow(CodeGenFunction &CGF) const;
128128

129129
protected:
130130
Address(std::nullptr_t) : ElementType(nullptr) {}
@@ -217,7 +217,7 @@ class Address {
217217

218218
/// Return the pointer contained in this class after authenticating it and
219219
/// adding offset to it if necessary.
220-
llvm::Value *getRawPointer(CodeGenFunction &CGF) const {
220+
llvm::Value *emitRawPointer(CodeGenFunction &CGF) const {
221221
return getBasePointer();
222222
}
223223

clang/lib/CodeGen/CGAtomic.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ namespace {
139139
const LValue &getAtomicLValue() const { return LVal; }
140140
llvm::Value *getAtomicPointer() const {
141141
if (LVal.isSimple())
142-
return LVal.getRawPointer(CGF);
142+
return LVal.emitRawPointer(CGF);
143143
else if (LVal.isBitField())
144144
return LVal.getRawBitFieldPointer(CGF);
145145
else if (LVal.isVectorElt())
@@ -368,7 +368,7 @@ bool AtomicInfo::emitMemSetZeroIfNecessary() const {
368368
return false;
369369

370370
CGF.Builder.CreateMemSet(
371-
addr.getRawPointer(CGF), llvm::ConstantInt::get(CGF.Int8Ty, 0),
371+
addr.emitRawPointer(CGF), llvm::ConstantInt::get(CGF.Int8Ty, 0),
372372
CGF.getContext().toCharUnitsFromBits(AtomicSizeInBits).getQuantity(),
373373
LVal.getAlignment().getAsAlign());
374374
return true;
@@ -1056,7 +1056,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
10561056
*this, V, AS, LangAS::opencl_generic, DestType, false);
10571057
};
10581058

1059-
Args.add(RValue::get(CastToGenericAddrSpace(Ptr.getRawPointer(*this),
1059+
Args.add(RValue::get(CastToGenericAddrSpace(Ptr.emitRawPointer(*this),
10601060
E->getPtr()->getType())),
10611061
getContext().VoidPtrTy);
10621062

@@ -1087,10 +1087,10 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
10871087
LibCallName = "__atomic_compare_exchange";
10881088
RetTy = getContext().BoolTy;
10891089
HaveRetTy = true;
1090-
Args.add(RValue::get(CastToGenericAddrSpace(Val1.getRawPointer(*this),
1090+
Args.add(RValue::get(CastToGenericAddrSpace(Val1.emitRawPointer(*this),
10911091
E->getVal1()->getType())),
10921092
getContext().VoidPtrTy);
1093-
Args.add(RValue::get(CastToGenericAddrSpace(Val2.getRawPointer(*this),
1093+
Args.add(RValue::get(CastToGenericAddrSpace(Val2.emitRawPointer(*this),
10941094
E->getVal2()->getType())),
10951095
getContext().VoidPtrTy);
10961096
Args.add(RValue::get(Order), getContext().IntTy);
@@ -1106,7 +1106,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11061106
case AtomicExpr::AO__scoped_atomic_exchange:
11071107
case AtomicExpr::AO__scoped_atomic_exchange_n:
11081108
LibCallName = "__atomic_exchange";
1109-
Args.add(RValue::get(CastToGenericAddrSpace(Val1.getRawPointer(*this),
1109+
Args.add(RValue::get(CastToGenericAddrSpace(Val1.emitRawPointer(*this),
11101110
E->getVal1()->getType())),
11111111
getContext().VoidPtrTy);
11121112
break;
@@ -1121,7 +1121,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11211121
LibCallName = "__atomic_store";
11221122
RetTy = getContext().VoidTy;
11231123
HaveRetTy = true;
1124-
Args.add(RValue::get(CastToGenericAddrSpace(Val1.getRawPointer(*this),
1124+
Args.add(RValue::get(CastToGenericAddrSpace(Val1.emitRawPointer(*this),
11251125
E->getVal1()->getType())),
11261126
getContext().VoidPtrTy);
11271127
break;
@@ -1200,9 +1200,9 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12001200
if (!HaveRetTy) {
12011201
// Value is returned through parameter before the order.
12021202
RetTy = getContext().VoidTy;
1203-
Args.add(
1204-
RValue::get(CastToGenericAddrSpace(Dest.getRawPointer(*this), RetTy)),
1205-
getContext().VoidPtrTy);
1203+
Args.add(RValue::get(
1204+
CastToGenericAddrSpace(Dest.emitRawPointer(*this), RetTy)),
1205+
getContext().VoidPtrTy);
12061206
}
12071207
// Order is always the last parameter.
12081208
Args.add(RValue::get(Order),
@@ -1515,7 +1515,7 @@ RValue AtomicInfo::EmitAtomicLoad(AggValueSlot ResultSlot, SourceLocation Loc,
15151515
} else
15161516
TempAddr = CreateTempAlloca();
15171517

1518-
EmitAtomicLoadLibcall(TempAddr.getRawPointer(CGF), AO, IsVolatile);
1518+
EmitAtomicLoadLibcall(TempAddr.emitRawPointer(CGF), AO, IsVolatile);
15191519

15201520
// Okay, turn that back into the original value or whole atomic (for
15211521
// non-simple lvalues) type.
@@ -1675,8 +1675,8 @@ std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchange(
16751675
if (shouldUseLibcall()) {
16761676
// Produce a source address.
16771677
Address ExpectedAddr = materializeRValue(Expected);
1678-
llvm::Value *ExpectedPtr = ExpectedAddr.getRawPointer(CGF);
1679-
llvm::Value *DesiredPtr = materializeRValue(Desired).getRawPointer(CGF);
1678+
llvm::Value *ExpectedPtr = ExpectedAddr.emitRawPointer(CGF);
1679+
llvm::Value *DesiredPtr = materializeRValue(Desired).emitRawPointer(CGF);
16801680
auto *Res = EmitAtomicCompareExchangeLibcall(ExpectedPtr, DesiredPtr,
16811681
Success, Failure);
16821682
return std::make_pair(
@@ -1759,7 +1759,7 @@ void AtomicInfo::EmitAtomicUpdateLibcall(
17591759

17601760
Address ExpectedAddr = CreateTempAlloca();
17611761

1762-
EmitAtomicLoadLibcall(ExpectedAddr.getRawPointer(CGF), AO, IsVolatile);
1762+
EmitAtomicLoadLibcall(ExpectedAddr.emitRawPointer(CGF), AO, IsVolatile);
17631763
auto *ContBB = CGF.createBasicBlock("atomic_cont");
17641764
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
17651765
CGF.EmitBlock(ContBB);
@@ -1773,8 +1773,8 @@ void AtomicInfo::EmitAtomicUpdateLibcall(
17731773
AggValueSlot::ignored(),
17741774
SourceLocation(), /*AsValue=*/false);
17751775
EmitAtomicUpdateValue(CGF, *this, OldRVal, UpdateOp, DesiredAddr);
1776-
llvm::Value *ExpectedPtr = ExpectedAddr.getRawPointer(CGF);
1777-
llvm::Value *DesiredPtr = DesiredAddr.getRawPointer(CGF);
1776+
llvm::Value *ExpectedPtr = ExpectedAddr.emitRawPointer(CGF);
1777+
llvm::Value *DesiredPtr = DesiredAddr.emitRawPointer(CGF);
17781778
auto *Res =
17791779
EmitAtomicCompareExchangeLibcall(ExpectedPtr, DesiredPtr, AO, Failure);
17801780
CGF.Builder.CreateCondBr(Res, ExitBB, ContBB);
@@ -1845,7 +1845,7 @@ void AtomicInfo::EmitAtomicUpdateLibcall(llvm::AtomicOrdering AO,
18451845

18461846
Address ExpectedAddr = CreateTempAlloca();
18471847

1848-
EmitAtomicLoadLibcall(ExpectedAddr.getRawPointer(CGF), AO, IsVolatile);
1848+
EmitAtomicLoadLibcall(ExpectedAddr.emitRawPointer(CGF), AO, IsVolatile);
18491849
auto *ContBB = CGF.createBasicBlock("atomic_cont");
18501850
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
18511851
CGF.EmitBlock(ContBB);
@@ -1856,8 +1856,8 @@ void AtomicInfo::EmitAtomicUpdateLibcall(llvm::AtomicOrdering AO,
18561856
CGF.Builder.CreateStore(OldVal, DesiredAddr);
18571857
}
18581858
EmitAtomicUpdateValue(CGF, *this, UpdateRVal, DesiredAddr);
1859-
llvm::Value *ExpectedPtr = ExpectedAddr.getRawPointer(CGF);
1860-
llvm::Value *DesiredPtr = DesiredAddr.getRawPointer(CGF);
1859+
llvm::Value *ExpectedPtr = ExpectedAddr.emitRawPointer(CGF);
1860+
llvm::Value *DesiredPtr = DesiredAddr.emitRawPointer(CGF);
18611861
auto *Res =
18621862
EmitAtomicCompareExchangeLibcall(ExpectedPtr, DesiredPtr, AO, Failure);
18631863
CGF.Builder.CreateCondBr(Res, ExitBB, ContBB);
@@ -1959,7 +1959,7 @@ void CodeGenFunction::EmitAtomicStore(RValue rvalue, LValue dest,
19591959
args.add(RValue::get(atomics.getAtomicSizeValue()),
19601960
getContext().getSizeType());
19611961
args.add(RValue::get(atomics.getAtomicPointer()), getContext().VoidPtrTy);
1962-
args.add(RValue::get(srcAddr.getRawPointer(*this)),
1962+
args.add(RValue::get(srcAddr.emitRawPointer(*this)),
19631963
getContext().VoidPtrTy);
19641964
args.add(
19651965
RValue::get(llvm::ConstantInt::get(IntTy, (int)llvm::toCABI(AO))),

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
940940
if (CI.isNested())
941941
byrefPointer = Builder.CreateLoad(src, "byref.capture");
942942
else
943-
byrefPointer = src.getRawPointer(*this);
943+
byrefPointer = src.emitRawPointer(*this);
944944

945945
// Write that void* into the capture field.
946946
Builder.CreateStore(byrefPointer, blockField);
@@ -963,7 +963,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
963963

964964
// If it's a reference variable, copy the reference into the block field.
965965
} else if (auto refType = type->getAs<ReferenceType>()) {
966-
Builder.CreateStore(src.getRawPointer(*this), blockField);
966+
Builder.CreateStore(src.emitRawPointer(*this), blockField);
967967

968968
// If type is const-qualified, copy the value into the block field.
969969
} else if (type.isConstQualified() &&
@@ -1498,7 +1498,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
14981498
// frame setup instruction by llvm::DwarfDebug::beginFunction().
14991499
auto NL = ApplyDebugLocation::CreateEmpty(*this);
15001500
Builder.CreateStore(BlockPointer, Alloca);
1501-
BlockPointerDbgLoc = Alloca.getRawPointer(*this);
1501+
BlockPointerDbgLoc = Alloca.emitRawPointer(*this);
15021502
}
15031503

15041504
// If we have a C++ 'this' reference, go ahead and force it into
@@ -1556,7 +1556,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
15561556
if (capture.isConstant()) {
15571557
auto addr = LocalDeclMap.find(variable)->second;
15581558
(void)DI->EmitDeclareOfAutoVariable(
1559-
variable, addr.getRawPointer(*this), Builder);
1559+
variable, addr.emitRawPointer(*this), Builder);
15601560
continue;
15611561
}
15621562

@@ -1660,7 +1660,7 @@ struct CallBlockRelease final : EHScopeStack::Cleanup {
16601660
if (LoadBlockVarAddr) {
16611661
BlockVarAddr = CGF.Builder.CreateLoad(Addr);
16621662
} else {
1663-
BlockVarAddr = Addr.getRawPointer(CGF);
1663+
BlockVarAddr = Addr.emitRawPointer(CGF);
16641664
}
16651665

16661666
CGF.BuildBlockRelease(BlockVarAddr, FieldFlags, CanThrow);
@@ -1968,7 +1968,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
19681968
}
19691969
case BlockCaptureEntityKind::BlockObject: {
19701970
llvm::Value *srcValue = Builder.CreateLoad(srcField, "blockcopy.src");
1971-
llvm::Value *dstAddr = dstField.getRawPointer(*this);
1971+
llvm::Value *dstAddr = dstField.emitRawPointer(*this);
19721972
llvm::Value *args[] = {
19731973
dstAddr, srcValue, llvm::ConstantInt::get(Int32Ty, flags.getBitMask())
19741974
};
@@ -2139,7 +2139,7 @@ class ObjectByrefHelpers final : public BlockByrefHelpers {
21392139
llvm::Value *flagsVal = llvm::ConstantInt::get(CGF.Int32Ty, flags);
21402140
llvm::FunctionCallee fn = CGF.CGM.getBlockObjectAssign();
21412141

2142-
llvm::Value *args[] = {destField.getRawPointer(CGF), srcValue, flagsVal};
2142+
llvm::Value *args[] = {destField.emitRawPointer(CGF), srcValue, flagsVal};
21432143
CGF.EmitNounwindRuntimeCall(fn, args);
21442144
}
21452145

@@ -2696,7 +2696,7 @@ void CodeGenFunction::emitByrefStructureInit(const AutoVarEmission &emission) {
26962696
storeHeaderField(V, getPointerSize(), "byref.isa");
26972697

26982698
// Store the address of the variable into its own forwarding pointer.
2699-
storeHeaderField(addr.getRawPointer(*this), getPointerSize(),
2699+
storeHeaderField(addr.emitRawPointer(*this), getPointerSize(),
27002700
"byref.forwarding");
27012701

27022702
// Blocks ABI:

0 commit comments

Comments
 (0)