mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
land David Blaikie's patch to de-constify Type, with a few tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -222,7 +222,7 @@ bool AddressingModeMatcher::MatchOperationAddr(User *AddrInst, unsigned Opcode,
|
||||
const TargetData *TD = TLI.getTargetData();
|
||||
gep_type_iterator GTI = gep_type_begin(AddrInst);
|
||||
for (unsigned i = 1, e = AddrInst->getNumOperands(); i != e; ++i, ++GTI) {
|
||||
if (const StructType *STy = dyn_cast<StructType>(*GTI)) {
|
||||
if (StructType *STy = dyn_cast<StructType>(*GTI)) {
|
||||
const StructLayout *SL = TD->getStructLayout(STy);
|
||||
unsigned Idx =
|
||||
cast<ConstantInt>(AddrInst->getOperand(i))->getZExtValue();
|
||||
@@ -557,7 +557,7 @@ IsProfitableToFoldIntoAddressingMode(Instruction *I, ExtAddrMode &AMBefore,
|
||||
Value *Address = User->getOperand(OpNo);
|
||||
if (!Address->getType()->isPointerTy())
|
||||
return false;
|
||||
const Type *AddressAccessTy =
|
||||
Type *AddressAccessTy =
|
||||
cast<PointerType>(Address->getType())->getElementType();
|
||||
|
||||
// Do a match against the root of this address, ignoring profitability. This
|
||||
|
@@ -58,8 +58,8 @@ Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
|
||||
AttributeWithIndex AWI =
|
||||
AttributeWithIndex::get(~0u, Attribute::ReadOnly | Attribute::NoUnwind);
|
||||
|
||||
const Type *I8Ptr = B.getInt8PtrTy();
|
||||
const Type *I32Ty = B.getInt32Ty();
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Type *I32Ty = B.getInt32Ty();
|
||||
Constant *StrChr = M->getOrInsertFunction("strchr", AttrListPtr::get(&AWI, 1),
|
||||
I8Ptr, I8Ptr, I32Ty, NULL);
|
||||
CallInst *CI = B.CreateCall2(StrChr, CastToCStr(Ptr, B),
|
||||
@@ -102,7 +102,7 @@ Value *llvm::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
|
||||
const Type *I8Ptr = B.getInt8PtrTy();
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Value *StrCpy = M->getOrInsertFunction(Name, AttrListPtr::get(AWI, 2),
|
||||
I8Ptr, I8Ptr, I8Ptr, NULL);
|
||||
CallInst *CI = B.CreateCall2(StrCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
|
||||
@@ -120,7 +120,7 @@ Value *llvm::EmitStrNCpy(Value *Dst, Value *Src, Value *Len,
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
|
||||
const Type *I8Ptr = B.getInt8PtrTy();
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Value *StrNCpy = M->getOrInsertFunction(Name, AttrListPtr::get(AWI, 2),
|
||||
I8Ptr, I8Ptr, I8Ptr,
|
||||
Len->getType(), NULL);
|
||||
@@ -361,7 +361,7 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
|
||||
this->CI = CI;
|
||||
Function *Callee = CI->getCalledFunction();
|
||||
StringRef Name = Callee->getName();
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
FunctionType *FT = Callee->getFunctionType();
|
||||
LLVMContext &Context = CI->getParent()->getContext();
|
||||
IRBuilder<> B(CI);
|
||||
|
||||
|
@@ -50,7 +50,7 @@ namespace {
|
||||
DominatorTree* DT;
|
||||
bool AggregateArgs;
|
||||
unsigned NumExitBlocks;
|
||||
const Type *RetTy;
|
||||
Type *RetTy;
|
||||
public:
|
||||
CodeExtractor(DominatorTree* dt = 0, bool AggArgs = false)
|
||||
: DT(dt), AggregateArgs(AggArgs||AggregateArgsOpt), NumExitBlocks(~0U) {}
|
||||
@@ -290,7 +290,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
|
||||
paramTy.clear();
|
||||
paramTy.push_back(StructPtr);
|
||||
}
|
||||
const FunctionType *funcType =
|
||||
FunctionType *funcType =
|
||||
FunctionType::get(RetTy, paramTy, false);
|
||||
|
||||
// Create the new function
|
||||
@@ -580,7 +580,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
|
||||
}
|
||||
|
||||
// Now that we've done the deed, simplify the switch instruction.
|
||||
const Type *OldFnRetTy = TheSwitch->getParent()->getParent()->getReturnType();
|
||||
Type *OldFnRetTy = TheSwitch->getParent()->getParent()->getReturnType();
|
||||
switch (NumExitBlocks) {
|
||||
case 0:
|
||||
// There are no successors (the block containing the switch itself), which
|
||||
|
@@ -636,7 +636,7 @@ static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
|
||||
const Function *CalledFunc,
|
||||
InlineFunctionInfo &IFI,
|
||||
unsigned ByValAlignment) {
|
||||
const Type *AggTy = cast<PointerType>(Arg->getType())->getElementType();
|
||||
Type *AggTy = cast<PointerType>(Arg->getType())->getElementType();
|
||||
|
||||
// If the called function is readonly, then it could not mutate the caller's
|
||||
// copy of the byval'd memory. In this case, it is safe to elide the copy and
|
||||
@@ -726,7 +726,7 @@ static bool isUsedByLifetimeMarker(Value *V) {
|
||||
// hasLifetimeMarkers - Check whether the given alloca already has
|
||||
// lifetime.start or lifetime.end intrinsics.
|
||||
static bool hasLifetimeMarkers(AllocaInst *AI) {
|
||||
const Type *Int8PtrTy = Type::getInt8PtrTy(AI->getType()->getContext());
|
||||
Type *Int8PtrTy = Type::getInt8PtrTy(AI->getType()->getContext());
|
||||
if (AI->getType() == Int8PtrTy)
|
||||
return isUsedByLifetimeMarker(AI);
|
||||
|
||||
@@ -1090,7 +1090,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
|
||||
|
||||
// Handle all of the return instructions that we just cloned in, and eliminate
|
||||
// any users of the original call/invoke instruction.
|
||||
const Type *RTy = CalledFunc->getReturnType();
|
||||
Type *RTy = CalledFunc->getReturnType();
|
||||
|
||||
PHINode *PHI = 0;
|
||||
if (Returns.size() > 1) {
|
||||
|
@@ -58,7 +58,7 @@ bool LowerExpectIntrinsic::HandleSwitchExpect(SwitchInst *SI) {
|
||||
return false;
|
||||
|
||||
LLVMContext &Context = CI->getContext();
|
||||
const Type *Int32Ty = Type::getInt32Ty(Context);
|
||||
Type *Int32Ty = Type::getInt32Ty(Context);
|
||||
|
||||
unsigned caseNo = SI->findCaseValue(ExpectedValue);
|
||||
std::vector<Value *> Vec;
|
||||
@@ -105,7 +105,7 @@ bool LowerExpectIntrinsic::HandleIfExpect(BranchInst *BI) {
|
||||
return false;
|
||||
|
||||
LLVMContext &Context = CI->getContext();
|
||||
const Type *Int32Ty = Type::getInt32Ty(Context);
|
||||
Type *Int32Ty = Type::getInt32Ty(Context);
|
||||
bool Likely = ExpectedValue->isOne();
|
||||
|
||||
// If expect value is equal to 1 it means that we are more likely to take
|
||||
|
@@ -120,7 +120,7 @@ FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI,
|
||||
// doInitialization - Make sure that there is a prototype for abort in the
|
||||
// current module.
|
||||
bool LowerInvoke::doInitialization(Module &M) {
|
||||
const Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
|
||||
Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
|
||||
if (useExpensiveEHSupport) {
|
||||
// Insert a type for the linked list of jump buffers.
|
||||
unsigned JBSize = TLI ? TLI->getJumpBufSize() : 0;
|
||||
@@ -131,7 +131,7 @@ bool LowerInvoke::doInitialization(Module &M) {
|
||||
Type *Elts[] = { JmpBufTy, PointerType::getUnqual(JBLinkTy) };
|
||||
JBLinkTy->setBody(Elts);
|
||||
|
||||
const Type *PtrJBList = PointerType::getUnqual(JBLinkTy);
|
||||
Type *PtrJBList = PointerType::getUnqual(JBLinkTy);
|
||||
|
||||
// Now that we've done that, insert the jmpbuf list head global, unless it
|
||||
// already exists.
|
||||
@@ -305,7 +305,7 @@ splitLiveRangesLiveAcrossInvokes(SmallVectorImpl<InvokeInst*> &Invokes) {
|
||||
++AfterAllocaInsertPt;
|
||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
||||
AI != E; ++AI) {
|
||||
const Type *Ty = AI->getType();
|
||||
Type *Ty = AI->getType();
|
||||
// Aggregate types can't be cast, but are legal argument types, so we have
|
||||
// to handle them differently. We use an extract/insert pair as a
|
||||
// lightweight method to achieve the same goal.
|
||||
|
@@ -44,7 +44,7 @@ SSAUpdater::~SSAUpdater() {
|
||||
|
||||
/// Initialize - Reset this object to get ready for a new set of SSA
|
||||
/// updates with type 'Ty'. PHI nodes get a name based on 'Name'.
|
||||
void SSAUpdater::Initialize(const Type *Ty, StringRef Name) {
|
||||
void SSAUpdater::Initialize(Type *Ty, StringRef Name) {
|
||||
if (AV == 0)
|
||||
AV = new AvailableValsTy();
|
||||
else
|
||||
|
@@ -322,7 +322,7 @@ static ConstantInt *GetConstantInt(Value *V, const TargetData *TD) {
|
||||
|
||||
// This is some kind of pointer constant. Turn it into a pointer-sized
|
||||
// ConstantInt if possible.
|
||||
const IntegerType *PtrTy = TD->getIntPtrType(V->getContext());
|
||||
IntegerType *PtrTy = TD->getIntPtrType(V->getContext());
|
||||
|
||||
// Null pointer means 0, see SelectionDAGBuilder::getValue(const Value*).
|
||||
if (isa<ConstantPointerNull>(V))
|
||||
|
Reference in New Issue
Block a user