mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-25 03:30:37 +00:00
Rename variables in gc_relocate related functions to follow LLVM's naming conventions.
Summary: This patch is to rename some variables to CamelCase in gc_relocate related functions. There is no functionality change. Patch by Chen Li! Reviewers: reames, AndyAyers, sanjoy Reviewed By: sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9681 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
66c6a4c240
commit
aa1c57e324
@ -3309,17 +3309,17 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
|||||||
"gc relocate on unwind path incorrectly linked to the statepoint",
|
"gc relocate on unwind path incorrectly linked to the statepoint",
|
||||||
&CI);
|
&CI);
|
||||||
|
|
||||||
const BasicBlock *invokeBB =
|
const BasicBlock *InvokeBB =
|
||||||
ExtractValue->getParent()->getUniquePredecessor();
|
ExtractValue->getParent()->getUniquePredecessor();
|
||||||
|
|
||||||
// Landingpad relocates should have only one predecessor with invoke
|
// Landingpad relocates should have only one predecessor with invoke
|
||||||
// statepoint terminator
|
// statepoint terminator
|
||||||
Assert(invokeBB, "safepoints should have unique landingpads",
|
Assert(InvokeBB, "safepoints should have unique landingpads",
|
||||||
ExtractValue->getParent());
|
ExtractValue->getParent());
|
||||||
Assert(invokeBB->getTerminator(), "safepoint block should be well formed",
|
Assert(InvokeBB->getTerminator(), "safepoint block should be well formed",
|
||||||
invokeBB);
|
InvokeBB);
|
||||||
Assert(isStatepoint(invokeBB->getTerminator()),
|
Assert(isStatepoint(InvokeBB->getTerminator()),
|
||||||
"gc relocate should be linked to a statepoint", invokeBB);
|
"gc relocate should be linked to a statepoint", InvokeBB);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// In all other cases relocate should be tied to the statepoint directly.
|
// In all other cases relocate should be tied to the statepoint directly.
|
||||||
@ -3332,8 +3332,8 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
|||||||
|
|
||||||
// Verify rest of the relocate arguments
|
// Verify rest of the relocate arguments
|
||||||
|
|
||||||
GCRelocateOperands ops(&CI);
|
GCRelocateOperands Ops(&CI);
|
||||||
ImmutableCallSite StatepointCS(ops.getStatepoint());
|
ImmutableCallSite StatepointCS(Ops.getStatepoint());
|
||||||
|
|
||||||
// Both the base and derived must be piped through the safepoint
|
// Both the base and derived must be piped through the safepoint
|
||||||
Value* Base = CI.getArgOperand(1);
|
Value* Base = CI.getArgOperand(1);
|
||||||
|
@ -1059,49 +1059,49 @@ static AttributeSet legalizeCallAttributes(AttributeSet AS) {
|
|||||||
/// statepointToken - statepoint instruction to which relocates should be
|
/// statepointToken - statepoint instruction to which relocates should be
|
||||||
/// bound.
|
/// bound.
|
||||||
/// Builder - Llvm IR builder to be used to construct new calls.
|
/// Builder - Llvm IR builder to be used to construct new calls.
|
||||||
static void CreateGCRelocates(ArrayRef<llvm::Value *> liveVariables,
|
static void CreateGCRelocates(ArrayRef<llvm::Value *> LiveVariables,
|
||||||
const int liveStart,
|
const int LiveStart,
|
||||||
ArrayRef<llvm::Value *> basePtrs,
|
ArrayRef<llvm::Value *> BasePtrs,
|
||||||
Instruction *statepointToken,
|
Instruction *StatepointToken,
|
||||||
IRBuilder<> Builder) {
|
IRBuilder<> Builder) {
|
||||||
SmallVector<Instruction *, 64> NewDefs;
|
SmallVector<Instruction *, 64> NewDefs;
|
||||||
NewDefs.reserve(liveVariables.size());
|
NewDefs.reserve(LiveVariables.size());
|
||||||
|
|
||||||
Module *M = statepointToken->getParent()->getParent()->getParent();
|
Module *M = StatepointToken->getParent()->getParent()->getParent();
|
||||||
|
|
||||||
for (unsigned i = 0; i < liveVariables.size(); i++) {
|
for (unsigned i = 0; i < LiveVariables.size(); i++) {
|
||||||
// We generate a (potentially) unique declaration for every pointer type
|
// We generate a (potentially) unique declaration for every pointer type
|
||||||
// combination. This results is some blow up the function declarations in
|
// combination. This results is some blow up the function declarations in
|
||||||
// the IR, but removes the need for argument bitcasts which shrinks the IR
|
// the IR, but removes the need for argument bitcasts which shrinks the IR
|
||||||
// greatly and makes it much more readable.
|
// greatly and makes it much more readable.
|
||||||
SmallVector<Type *, 1> types; // one per 'any' type
|
SmallVector<Type *, 1> Types; // one per 'any' type
|
||||||
// All gc_relocate are set to i8 addrspace(1)* type. This could help avoid
|
// All gc_relocate are set to i8 addrspace(1)* type. This could help avoid
|
||||||
// cases where the actual value's type mangling is not supported by llvm. A
|
// cases where the actual value's type mangling is not supported by llvm. A
|
||||||
// bitcast is added later to convert gc_relocate to the actual value's type.
|
// bitcast is added later to convert gc_relocate to the actual value's type.
|
||||||
types.push_back(Type::getInt8PtrTy(M->getContext(), 1));
|
Types.push_back(Type::getInt8PtrTy(M->getContext(), 1));
|
||||||
Value *gc_relocate_decl = Intrinsic::getDeclaration(
|
Value *GCRelocateDecl = Intrinsic::getDeclaration(
|
||||||
M, Intrinsic::experimental_gc_relocate, types);
|
M, Intrinsic::experimental_gc_relocate, Types);
|
||||||
|
|
||||||
// Generate the gc.relocate call and save the result
|
// Generate the gc.relocate call and save the result
|
||||||
Value *baseIdx =
|
Value *BaseIdx =
|
||||||
ConstantInt::get(Type::getInt32Ty(M->getContext()),
|
ConstantInt::get(Type::getInt32Ty(M->getContext()),
|
||||||
liveStart + find_index(liveVariables, basePtrs[i]));
|
LiveStart + find_index(LiveVariables, BasePtrs[i]));
|
||||||
Value *liveIdx = ConstantInt::get(
|
Value *LiveIdx = ConstantInt::get(
|
||||||
Type::getInt32Ty(M->getContext()),
|
Type::getInt32Ty(M->getContext()),
|
||||||
liveStart + find_index(liveVariables, liveVariables[i]));
|
LiveStart + find_index(LiveVariables, LiveVariables[i]));
|
||||||
|
|
||||||
// only specify a debug name if we can give a useful one
|
// only specify a debug name if we can give a useful one
|
||||||
Value *reloc = Builder.CreateCall3(
|
Value *Reloc = Builder.CreateCall3(
|
||||||
gc_relocate_decl, statepointToken, baseIdx, liveIdx,
|
GCRelocateDecl, StatepointToken, BaseIdx, LiveIdx,
|
||||||
liveVariables[i]->hasName() ? liveVariables[i]->getName() + ".relocated"
|
LiveVariables[i]->hasName() ? LiveVariables[i]->getName() + ".relocated"
|
||||||
: "");
|
: "");
|
||||||
// Trick CodeGen into thinking there are lots of free registers at this
|
// Trick CodeGen into thinking there are lots of free registers at this
|
||||||
// fake call.
|
// fake call.
|
||||||
cast<CallInst>(reloc)->setCallingConv(CallingConv::Cold);
|
cast<CallInst>(Reloc)->setCallingConv(CallingConv::Cold);
|
||||||
|
|
||||||
NewDefs.push_back(cast<Instruction>(reloc));
|
NewDefs.push_back(cast<Instruction>(Reloc));
|
||||||
}
|
}
|
||||||
assert(NewDefs.size() == liveVariables.size() &&
|
assert(NewDefs.size() == LiveVariables.size() &&
|
||||||
"missing or extra redefinition at safepoint");
|
"missing or extra redefinition at safepoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,42 +1322,42 @@ makeStatepointExplicit(DominatorTree &DT, const CallSite &CS, Pass *P,
|
|||||||
// Add visited values into the visitedLiveValues set we will later use them
|
// Add visited values into the visitedLiveValues set we will later use them
|
||||||
// for sanity check.
|
// for sanity check.
|
||||||
static void
|
static void
|
||||||
insertRelocationStores(iterator_range<Value::user_iterator> gcRelocs,
|
insertRelocationStores(iterator_range<Value::user_iterator> GCRelocs,
|
||||||
DenseMap<Value *, Value *> &allocaMap,
|
DenseMap<Value *, Value *> &AllocaMap,
|
||||||
DenseSet<Value *> &visitedLiveValues) {
|
DenseSet<Value *> &VisitedLiveValues) {
|
||||||
|
|
||||||
for (User *U : gcRelocs) {
|
for (User *U : GCRelocs) {
|
||||||
if (!isa<IntrinsicInst>(U))
|
if (!isa<IntrinsicInst>(U))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IntrinsicInst *relocatedValue = cast<IntrinsicInst>(U);
|
IntrinsicInst *RelocatedValue = cast<IntrinsicInst>(U);
|
||||||
|
|
||||||
// We only care about relocates
|
// We only care about relocates
|
||||||
if (relocatedValue->getIntrinsicID() !=
|
if (RelocatedValue->getIntrinsicID() !=
|
||||||
Intrinsic::experimental_gc_relocate) {
|
Intrinsic::experimental_gc_relocate) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCRelocateOperands relocateOperands(relocatedValue);
|
GCRelocateOperands RelocateOperands(RelocatedValue);
|
||||||
Value *originalValue =
|
Value *OriginalValue =
|
||||||
const_cast<Value *>(relocateOperands.getDerivedPtr());
|
const_cast<Value *>(RelocateOperands.getDerivedPtr());
|
||||||
assert(allocaMap.count(originalValue));
|
assert(AllocaMap.count(OriginalValue));
|
||||||
Value *alloca = allocaMap[originalValue];
|
Value *Alloca = AllocaMap[OriginalValue];
|
||||||
|
|
||||||
// Emit store into the related alloca
|
// Emit store into the related alloca
|
||||||
// All gc_relocate are i8 addrspace(1)* typed, and it must be bitcasted to
|
// All gc_relocate are i8 addrspace(1)* typed, and it must be bitcasted to
|
||||||
// the correct type according to alloca.
|
// the correct type according to alloca.
|
||||||
assert(relocatedValue->getNextNode() && "Should always have one since it's not a terminator");
|
assert(RelocatedValue->getNextNode() && "Should always have one since it's not a terminator");
|
||||||
IRBuilder<> Builder(relocatedValue->getNextNode());
|
IRBuilder<> Builder(RelocatedValue->getNextNode());
|
||||||
Value *CastedRelocatedValue =
|
Value *CastedRelocatedValue =
|
||||||
Builder.CreateBitCast(relocatedValue, cast<AllocaInst>(alloca)->getAllocatedType(),
|
Builder.CreateBitCast(RelocatedValue, cast<AllocaInst>(Alloca)->getAllocatedType(),
|
||||||
relocatedValue->hasName() ? relocatedValue->getName() + ".casted" : "");
|
RelocatedValue->hasName() ? RelocatedValue->getName() + ".casted" : "");
|
||||||
|
|
||||||
StoreInst *store = new StoreInst(CastedRelocatedValue, alloca);
|
StoreInst *Store = new StoreInst(CastedRelocatedValue, Alloca);
|
||||||
store->insertAfter(cast<Instruction>(CastedRelocatedValue));
|
Store->insertAfter(cast<Instruction>(CastedRelocatedValue));
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
visitedLiveValues.insert(originalValue);
|
VisitedLiveValues.insert(OriginalValue);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user