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
This commit is contained in:
Reid Spencer
2006-12-31 05:48:39 +00:00
parent 05e52a1b35
commit c5b206b6be
32 changed files with 400 additions and 521 deletions

View File

@ -193,7 +193,7 @@ bool LowerSetJmp::runOnModule(Module& M) {
// This function is always successful, unless it isn't.
bool LowerSetJmp::doInitialization(Module& M)
{
const Type *SBPTy = PointerType::get(Type::SByteTy);
const Type *SBPTy = PointerType::get(Type::Int8Ty);
const Type *SBPPTy = PointerType::get(SBPTy);
// N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for
@ -209,17 +209,17 @@ bool LowerSetJmp::doInitialization(Module& M)
// void __llvm_sjljeh_add_setjmp_to_map(void**, void*, unsigned)
AddSJToMap = M.getOrInsertFunction("__llvm_sjljeh_add_setjmp_to_map",
Type::VoidTy, SBPPTy, SBPTy,
Type::UIntTy, (Type *)0);
Type::Int32Ty, (Type *)0);
// void __llvm_sjljeh_throw_longjmp(int*, int)
ThrowLongJmp = M.getOrInsertFunction("__llvm_sjljeh_throw_longjmp",
Type::VoidTy, SBPTy, Type::IntTy,
Type::VoidTy, SBPTy, Type::Int32Ty,
(Type *)0);
// unsigned __llvm_sjljeh_try_catching_longjmp_exception(void **)
TryCatchLJ =
M.getOrInsertFunction("__llvm_sjljeh_try_catching_longjmp_exception",
Type::UIntTy, SBPPTy, (Type *)0);
Type::Int32Ty, SBPPTy, (Type *)0);
// bool __llvm_sjljeh_is_longjmp_exception()
IsLJException = M.getOrInsertFunction("__llvm_sjljeh_is_longjmp_exception",
@ -227,7 +227,7 @@ bool LowerSetJmp::doInitialization(Module& M)
// int __llvm_sjljeh_get_longjmp_value()
GetLJValue = M.getOrInsertFunction("__llvm_sjljeh_get_longjmp_value",
Type::IntTy, (Type *)0);
Type::Int32Ty, (Type *)0);
return true;
}
@ -250,7 +250,7 @@ bool LowerSetJmp::IsTransformableFunction(const std::string& Name) {
// throwing the exception for us.
void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
{
const Type* SBPTy = PointerType::get(Type::SByteTy);
const Type* SBPTy = PointerType::get(Type::Int8Ty);
// Create the call to "__llvm_sjljeh_throw_longjmp". This takes the
// same parameters as "longjmp", except that the buffer is cast to a
@ -300,7 +300,7 @@ AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func)
assert(Inst && "Couldn't find even ONE instruction in entry block!");
// Fill in the alloca and call to initialize the SJ map.
const Type *SBPTy = PointerType::get(Type::SByteTy);
const Type *SBPTy = PointerType::get(Type::Int8Ty);
AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst);
new CallInst(InitSJMap, make_vector<Value*>(Map, 0), "", Inst);
return SJMap[Func] = Map;
@ -372,12 +372,12 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
Function* Func = ABlock->getParent();
// Add this setjmp to the setjmp map.
const Type* SBPTy = PointerType::get(Type::SByteTy);
const Type* SBPTy = PointerType::get(Type::Int8Ty);
CastInst* BufPtr =
new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst);
new CallInst(AddSJToMap,
make_vector<Value*>(GetSetJmpMap(Func), BufPtr,
ConstantInt::get(Type::UIntTy,
ConstantInt::get(Type::Int32Ty,
SetJmpIDMap[Func]++), 0),
"", Inst);
@ -421,14 +421,14 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
// This PHI node will be in the new block created from the
// splitBasicBlock call.
PHINode* PHI = new PHINode(Type::IntTy, "SetJmpReturn", Inst);
PHINode* PHI = new PHINode(Type::Int32Ty, "SetJmpReturn", Inst);
// Coming from a call to setjmp, the return is 0.
PHI->addIncoming(ConstantInt::getNullValue(Type::IntTy), ABlock);
PHI->addIncoming(ConstantInt::getNullValue(Type::Int32Ty), ABlock);
// Add the case for this setjmp's number...
SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func));
SVP.first->addCase(ConstantInt::get(Type::UIntTy, SetJmpIDMap[Func] - 1),
SVP.first->addCase(ConstantInt::get(Type::Int32Ty, SetJmpIDMap[Func] - 1),
SetJmpContBlock);
// Value coming from the handling of the exception.