From c5b206b6be61d0d933b98b6af5e22f42edd48ad1 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 31 Dec 2006 05:48:39 +0000 Subject: For PR950: This patch replaces signed integer types with signless ones: 1. [US]Byte -> Int8 2. [U]Short -> Int16 3. [U]Int -> Int32 4. [U]Long -> Int64. 5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion and other methods related to signedness. In a few places this warranted identifying the signedness information from other sources. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/BlockProfiling.cpp | 4 ++-- lib/Transforms/Instrumentation/EdgeProfiling.cpp | 2 +- lib/Transforms/Instrumentation/EmitFunctions.cpp | 8 +++---- lib/Transforms/Instrumentation/ProfilingUtils.cpp | 26 +++++++++++----------- lib/Transforms/Instrumentation/RSProfiling.cpp | 16 ++++++------- .../Instrumentation/TraceBasicBlocks.cpp | 4 ++-- lib/Transforms/Instrumentation/TraceValues.cpp | 14 ++++++------ 7 files changed, 37 insertions(+), 37 deletions(-) (limited to 'lib/Transforms/Instrumentation') diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index af438f9655..e7b86777cf 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -57,7 +57,7 @@ bool FunctionProfiler::runOnModule(Module &M) { if (!I->isExternal()) ++NumFunctions; - const Type *ATy = ArrayType::get(Type::UIntTy, NumFunctions); + const Type *ATy = ArrayType::get(Type::Int32Ty, NumFunctions); GlobalVariable *Counters = new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "FuncProfCounters", &M); @@ -99,7 +99,7 @@ bool BlockProfiler::runOnModule(Module &M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) NumBlocks += I->size(); - const Type *ATy = ArrayType::get(Type::UIntTy, NumBlocks); + const Type *ATy = ArrayType::get(Type::Int32Ty, NumBlocks); GlobalVariable *Counters = new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "BlockProfCounters", &M); diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index 36cf3e9430..97b5d5ca42 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -58,7 +58,7 @@ bool EdgeProfiler::runOnModule(Module &M) { NumEdges += BB->getTerminator()->getNumSuccessors(); } - const Type *ATy = ArrayType::get(Type::UIntTy, NumEdges); + const Type *ATy = ArrayType::get(Type::Int32Ty, NumEdges); GlobalVariable *Counters = new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "EdgeProfCounters", &M); diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index b4523257af..23fa4faaad 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -87,7 +87,7 @@ bool EmitFunctionTable::runOnModule(Module &M){ //std::cerr<getParent(); - Function *InitFn = M.getOrInsertFunction(FnName, Type::IntTy, Type::IntTy, - ArgVTy, UIntPtr, Type::UIntTy, + Function *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, Type::Int32Ty, + ArgVTy, UIntPtr, Type::Int32Ty, (Type *)0); // This could force argc and argv into programs that wouldn't otherwise have // them, but instead we just pass null values in. std::vector Args(4); - Args[0] = Constant::getNullValue(Type::IntTy); + Args[0] = Constant::getNullValue(Type::Int32Ty); Args[1] = Constant::getNullValue(ArgVTy); // Skip over any allocas in the entry block. @@ -40,7 +40,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, BasicBlock::iterator InsertPos = Entry->begin(); while (isa(InsertPos)) ++InsertPos; - std::vector GEPIndices(2, Constant::getNullValue(Type::IntTy)); + std::vector GEPIndices(2, Constant::getNullValue(Type::Int32Ty)); unsigned NumElements = 0; if (Array) { Args[2] = ConstantExpr::getGetElementPtr(Array, GEPIndices); @@ -51,7 +51,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, // pass null. Args[2] = ConstantPointerNull::get(UIntPtr); } - Args[3] = ConstantInt::get(Type::UIntTy, NumElements); + Args[3] = ConstantInt::get(Type::Int32Ty, NumElements); Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos); @@ -75,16 +75,16 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, AI = MainFn->arg_begin(); // If the program looked at argc, have it look at the return value of the // init call instead. - if (AI->getType() != Type::IntTy) { + if (AI->getType() != Type::Int32Ty) { Instruction::CastOps opcode; if (!AI->use_empty()) { opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true); AI->replaceAllUsesWith( CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos)); } - opcode = CastInst::getCastOpcode(AI, true, Type::IntTy, true); + opcode = CastInst::getCastOpcode(AI, true, Type::Int32Ty, true); InitCall->setOperand(1, - CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall)); + CastInst::create(opcode, AI, Type::Int32Ty, "argc.cast", InitCall)); } else { AI->replaceAllUsesWith(InitCall); InitCall->setOperand(1, AI); @@ -103,14 +103,14 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, // Create the getelementptr constant expression std::vector Indices(2); - Indices[0] = Constant::getNullValue(Type::IntTy); - Indices[1] = ConstantInt::get(Type::IntTy, CounterNum); + Indices[0] = Constant::getNullValue(Type::Int32Ty); + Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum); Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices); // Load, increment and store the value back. Value *OldVal = new LoadInst(ElementPtr, "OldFuncCounter", InsertPos); Value *NewVal = BinaryOperator::create(Instruction::Add, OldVal, - ConstantInt::get(Type::UIntTy, 1), + ConstantInt::get(Type::Int32Ty, 1), "NewFuncCounter", InsertPos); new StoreInst(NewVal, ElementPtr, InsertPos); } diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp index b18d66befb..1553141cec 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.cpp +++ b/lib/Transforms/Instrumentation/RSProfiling.cpp @@ -290,7 +290,7 @@ void GlobalRandomCounterOpt::ProcessChoicePoint(BasicBlock* bb) { CycleCounter::CycleCounter(Module& m, uint64_t resetmask) : rm(resetmask) { - F = m.getOrInsertFunction("llvm.readcyclecounter", Type::ULongTy, NULL); + F = m.getOrInsertFunction("llvm.readcyclecounter", Type::Int64Ty, NULL); } CycleCounter::~CycleCounter() {} @@ -302,11 +302,11 @@ void CycleCounter::ProcessChoicePoint(BasicBlock* bb) { CallInst* c = new CallInst(F, "rdcc", t); BinaryOperator* b = - BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm), + BinaryOperator::createAnd(c, ConstantInt::get(Type::Int64Ty, rm), "mrdcc", t); ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b, - ConstantInt::get(Type::ULongTy, 0), + ConstantInt::get(Type::Int64Ty, 0), "mrdccc", t); t->setCondition(s); @@ -332,15 +332,15 @@ void RSProfilers_std::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNu // Create the getelementptr constant expression std::vector Indices(2); - Indices[0] = Constant::getNullValue(Type::IntTy); - Indices[1] = ConstantInt::get(Type::IntTy, CounterNum); + Indices[0] = Constant::getNullValue(Type::Int32Ty); + Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum); Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices); // Load, increment and store the value back. Value *OldVal = new LoadInst(ElementPtr, "OldCounter", InsertPos); profcode.insert(OldVal); Value *NewVal = BinaryOperator::createAdd(OldVal, - ConstantInt::get(Type::UIntTy, 1), + ConstantInt::get(Type::Int32Ty, 1), "NewCounter", InsertPos); profcode.insert(NewVal); profcode.insert(new StoreInst(NewVal, ElementPtr, InsertPos)); @@ -539,10 +539,10 @@ bool ProfilerRS::runOnFunction(Function& F) { bool ProfilerRS::doInitialization(Module &M) { switch (RandomMethod) { case GBV: - c = new GlobalRandomCounter(M, Type::UIntTy, (1 << 14) - 1); + c = new GlobalRandomCounter(M, Type::Int32Ty, (1 << 14) - 1); break; case GBVO: - c = new GlobalRandomCounterOpt(M, Type::UIntTy, (1 << 14) - 1); + c = new GlobalRandomCounterOpt(M, Type::Int32Ty, (1 << 14) - 1); break; case HOSTCC: c = new CycleCounter(M, (1 << 14) - 1); diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp index 10b3641978..379005359d 100644 --- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp +++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp @@ -46,9 +46,9 @@ static void InsertInstrumentationCall (BasicBlock *BB, << "\", \"" << FnName << "\", " << BBNumber << ")\n"; Module &M = *BB->getParent ()->getParent (); Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy, - Type::UIntTy, (Type *)0); + Type::Int32Ty, (Type *)0); std::vector Args (1); - Args[0] = ConstantInt::get (Type::UIntTy, BBNumber); + Args[0] = ConstantInt::get (Type::Int32Ty, BBNumber); // Insert the call after any alloca or PHI instructions... BasicBlock::iterator InsertPos = BB->begin(); diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index f6048f140d..9fbec118c2 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -123,13 +123,13 @@ FunctionPass *llvm::createTraceValuesPassForBasicBlocks() { // void ExternalFuncs::doInitialization(Module &M) { M.addLibrary("trace"); - const Type *SBP = PointerType::get(Type::SByteTy); + const Type *SBP = PointerType::get(Type::Int8Ty); const FunctionType *MTy = - FunctionType::get(Type::IntTy, std::vector(1, SBP), true); + FunctionType::get(Type::Int32Ty, std::vector(1, SBP), true); PrintfFunc = M.getOrInsertFunction("printf", MTy); // uint (sbyte*) - HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::UIntTy, SBP, + HashPtrFunc = M.getOrInsertFunction("HashPointerToSeqNum", Type::Int32Ty, SBP, (Type *)0); // void (sbyte*) @@ -244,11 +244,11 @@ static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore, // Turn the format string into an sbyte * Constant *GEP=ConstantExpr::getGetElementPtr(fmtVal, - std::vector(2,Constant::getNullValue(Type::LongTy))); + std::vector(2,Constant::getNullValue(Type::Int64Ty))); // Insert a call to the hash function if this is a pointer value if (V && isa(V->getType()) && !DisablePtrHashing) { - const Type *SBP = PointerType::get(Type::SByteTy); + const Type *SBP = PointerType::get(Type::Int8Ty); if (V->getType() != SBP) // Cast pointer to be sbyte* V = new BitCastInst(V, SBP, "Hash_cast", InsertBefore); @@ -279,7 +279,7 @@ InsertReleaseInst(Value *V, BasicBlock *BB, Instruction *InsertBefore, Function* ReleasePtrFunc) { - const Type *SBP = PointerType::get(Type::SByteTy); + const Type *SBP = PointerType::get(Type::Int8Ty); if (V->getType() != SBP) // Cast pointer to be sbyte* V = new BitCastInst(V, SBP, "RPSN_cast", InsertBefore); @@ -291,7 +291,7 @@ static void InsertRecordInst(Value *V, BasicBlock *BB, Instruction *InsertBefore, Function* RecordPtrFunc) { - const Type *SBP = PointerType::get(Type::SByteTy); + const Type *SBP = PointerType::get(Type::Int8Ty); if (V->getType() != SBP) // Cast pointer to be sbyte* V = new BitCastInst(V, SBP, "RP_cast", InsertBefore); -- cgit v1.2.3