mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-07 11:59:09 +00:00
Remove trailing whitespace, fix file path in comment
llvm-svn: 186766
This commit is contained in:
parent
78617fc38a
commit
3232505141
@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// These functions are implemented by lib/VMCore/AutoUpgrade.cpp.
|
||||
// These functions are implemented by lib/IR/AutoUpgrade.cpp.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -20,19 +20,19 @@ namespace llvm {
|
||||
class Function;
|
||||
class CallInst;
|
||||
|
||||
/// This is a more granular function that simply checks an intrinsic function
|
||||
/// This is a more granular function that simply checks an intrinsic function
|
||||
/// for upgrading, and returns true if it requires upgrading. It may return
|
||||
/// null in NewFn if the all calls to the original intrinsic function
|
||||
/// should be transformed to non-function-call instructions.
|
||||
bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn);
|
||||
|
||||
/// This is the complement to the above, replacing a specific call to an
|
||||
/// This is the complement to the above, replacing a specific call to an
|
||||
/// intrinsic function with a call to the specified new function.
|
||||
void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn);
|
||||
|
||||
/// This is an auto-upgrade hook for any old intrinsic function syntaxes
|
||||
/// which need to have both the function updated as well as all calls updated
|
||||
/// to the new function. This should only be run in a post-processing fashion
|
||||
|
||||
/// This is an auto-upgrade hook for any old intrinsic function syntaxes
|
||||
/// which need to have both the function updated as well as all calls updated
|
||||
/// to the new function. This should only be run in a post-processing fashion
|
||||
/// so that it can update all calls to the old function.
|
||||
void UpgradeCallsToIntrinsic(Function* F);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the auto-upgrade helper functions
|
||||
// This file implements the auto-upgrade helper functions
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -55,14 +55,14 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
|
||||
case 'a': {
|
||||
if (Name.startswith("arm.neon.vclz")) {
|
||||
Type* args[2] = {
|
||||
F->arg_begin()->getType(),
|
||||
F->arg_begin()->getType(),
|
||||
Type::getInt1Ty(F->getContext())
|
||||
};
|
||||
// Can't use Intrinsic::getDeclaration here as it adds a ".i1" to
|
||||
// the end of the name. Change name from llvm.arm.neon.vclz.* to
|
||||
// llvm.ctlz.*
|
||||
FunctionType* fType = FunctionType::get(F->getReturnType(), args, false);
|
||||
NewFn = Function::Create(fType, F->getLinkage(),
|
||||
NewFn = Function::Create(fType, F->getLinkage(),
|
||||
"llvm.ctlz." + Name.substr(14), F->getParent());
|
||||
return true;
|
||||
}
|
||||
@ -369,8 +369,8 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
}
|
||||
}
|
||||
|
||||
// This tests each Function to determine if it needs upgrading. When we find
|
||||
// one we are interested in, we then upgrade all calls to reflect the new
|
||||
// This tests each Function to determine if it needs upgrading. When we find
|
||||
// one we are interested in, we then upgrade all calls to reflect the new
|
||||
// function.
|
||||
void llvm::UpgradeCallsToIntrinsic(Function* F) {
|
||||
assert(F && "Illegal attempt to upgrade a non-existent intrinsic.");
|
||||
|
@ -98,7 +98,7 @@ namespace { // Anonymous namespace for class
|
||||
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||
if (I->empty() || !I->back().isTerminator()) {
|
||||
dbgs() << "Basic Block in function '" << F.getName()
|
||||
dbgs() << "Basic Block in function '" << F.getName()
|
||||
<< "' does not have terminator!\n";
|
||||
WriteAsOperand(dbgs(), I, true);
|
||||
dbgs() << "\n";
|
||||
@ -115,7 +115,7 @@ namespace { // Anonymous namespace for class
|
||||
}
|
||||
|
||||
char PreVerifier::ID = 0;
|
||||
INITIALIZE_PASS(PreVerifier, "preverify", "Preliminary module verification",
|
||||
INITIALIZE_PASS(PreVerifier, "preverify", "Preliminary module verification",
|
||||
false, false)
|
||||
static char &PreVerifyID = PreVerifier::ID;
|
||||
|
||||
@ -193,11 +193,11 @@ namespace {
|
||||
if (I->isDeclaration()) visitFunction(*I);
|
||||
}
|
||||
|
||||
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||
I != E; ++I)
|
||||
visitGlobalVariable(*I);
|
||||
|
||||
for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end();
|
||||
for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end();
|
||||
I != E; ++I)
|
||||
visitGlobalAlias(*I);
|
||||
|
||||
@ -500,7 +500,7 @@ void Verifier::visitGlobalAlias(GlobalAlias &GA) {
|
||||
|
||||
if (!isa<GlobalValue>(GA.getAliasee())) {
|
||||
const ConstantExpr *CE = dyn_cast<ConstantExpr>(GA.getAliasee());
|
||||
Assert1(CE &&
|
||||
Assert1(CE &&
|
||||
(CE->getOpcode() == Instruction::BitCast ||
|
||||
CE->getOpcode() == Instruction::GetElementPtr) &&
|
||||
isa<GlobalValue>(CE->getOperand(0)),
|
||||
@ -860,7 +860,7 @@ bool Verifier::VerifyAttributeCount(AttributeSet Attrs, unsigned Params) {
|
||||
|| (LastIndex == AttributeSet::FunctionIndex
|
||||
&& (LastSlot == 0 || Attrs.getSlotIndex(LastSlot - 1) <= Params)))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -879,7 +879,7 @@ void Verifier::visitFunction(Function &F) {
|
||||
"# formal arguments must match # of arguments for function type!",
|
||||
&F, FT);
|
||||
Assert1(F.getReturnType()->isFirstClassType() ||
|
||||
F.getReturnType()->isVoidTy() ||
|
||||
F.getReturnType()->isVoidTy() ||
|
||||
F.getReturnType()->isStructTy(),
|
||||
"Functions cannot return aggregate values!", &F);
|
||||
|
||||
@ -946,25 +946,25 @@ void Verifier::visitFunction(Function &F) {
|
||||
// Verify that this function (which has a body) is not named "llvm.*". It
|
||||
// is not legal to define intrinsics.
|
||||
Assert1(!isLLVMdotName, "llvm intrinsics cannot be defined!", &F);
|
||||
|
||||
|
||||
// Check the entry node
|
||||
BasicBlock *Entry = &F.getEntryBlock();
|
||||
Assert1(pred_begin(Entry) == pred_end(Entry),
|
||||
"Entry block to function must not have predecessors!", Entry);
|
||||
|
||||
|
||||
// The address of the entry block cannot be taken, unless it is dead.
|
||||
if (Entry->hasAddressTaken()) {
|
||||
Assert1(!BlockAddress::get(Entry)->isConstantUsed(),
|
||||
"blockaddress may not be used with the entry block!", Entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If this function is actually an intrinsic, verify that it is only used in
|
||||
// direct call/invokes, never having its "address taken".
|
||||
if (F.getIntrinsicID()) {
|
||||
const User *U;
|
||||
if (F.hasAddressTaken(&U))
|
||||
Assert1(0, "Invalid user of intrinsic instruction!", U);
|
||||
Assert1(0, "Invalid user of intrinsic instruction!", U);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1039,7 +1039,7 @@ void Verifier::visitBranchInst(BranchInst &BI) {
|
||||
void Verifier::visitReturnInst(ReturnInst &RI) {
|
||||
Function *F = RI.getParent()->getParent();
|
||||
unsigned N = RI.getNumOperands();
|
||||
if (F->getReturnType()->isVoidTy())
|
||||
if (F->getReturnType()->isVoidTy())
|
||||
Assert2(N == 0,
|
||||
"Found return instr that returns non-void in Function of void "
|
||||
"return type!", &RI, F->getReturnType());
|
||||
@ -1072,14 +1072,14 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
|
||||
RangeSetMap[r] = i.getCaseIndex();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IntegersSubsetToBB::RangeIterator errItem;
|
||||
if (!Mapping.verify(errItem)) {
|
||||
unsigned CaseIndex = RangeSetMap[errItem->first];
|
||||
SwitchInst::CaseIt i(&SI, CaseIndex);
|
||||
Assert2(false, "Duplicate integer as switch case", &SI, i.getCaseValueEx());
|
||||
}
|
||||
|
||||
|
||||
visitTerminatorInst(SI);
|
||||
}
|
||||
|
||||
@ -1364,7 +1364,7 @@ void Verifier::visitPHINode(PHINode &PN) {
|
||||
// This can be tested by checking whether the instruction before this is
|
||||
// either nonexistent (because this is begin()) or is a PHI node. If not,
|
||||
// then there is some other instruction before a PHI.
|
||||
Assert2(&PN == &PN.getParent()->front() ||
|
||||
Assert2(&PN == &PN.getParent()->front() ||
|
||||
isa<PHINode>(--BasicBlock::iterator(&PN)),
|
||||
"PHI nodes not grouped at top of basic block!",
|
||||
&PN, PN.getParent());
|
||||
@ -1428,9 +1428,9 @@ void Verifier::VerifyCallSite(CallSite CS) {
|
||||
|
||||
// Check attributes on the varargs part.
|
||||
for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) {
|
||||
Type *Ty = CS.getArgument(Idx-1)->getType();
|
||||
Type *Ty = CS.getArgument(Idx-1)->getType();
|
||||
VerifyParameterAttrs(Attrs, Idx, Ty, false, I);
|
||||
|
||||
|
||||
if (Attrs.hasAttribute(Idx, Attribute::Nest)) {
|
||||
Assert1(!SawNest, "More than one parameter has attribute nest!", I);
|
||||
SawNest = true;
|
||||
@ -1751,7 +1751,7 @@ void Verifier::visitStoreInst(StoreInst &SI) {
|
||||
|
||||
void Verifier::visitAllocaInst(AllocaInst &AI) {
|
||||
PointerType *PTy = AI.getType();
|
||||
Assert1(PTy->getAddressSpace() == 0,
|
||||
Assert1(PTy->getAddressSpace() == 0,
|
||||
"Allocation instruction pointer not in the generic address space!",
|
||||
&AI);
|
||||
Assert1(PTy->getElementType()->isSized(), "Cannot allocate unsized type",
|
||||
@ -1823,7 +1823,7 @@ void Verifier::visitExtractValueInst(ExtractValueInst &EVI) {
|
||||
EVI.getIndices()) ==
|
||||
EVI.getType(),
|
||||
"Invalid ExtractValueInst operands!", &EVI);
|
||||
|
||||
|
||||
visitInstruction(EVI);
|
||||
}
|
||||
|
||||
@ -1832,7 +1832,7 @@ void Verifier::visitInsertValueInst(InsertValueInst &IVI) {
|
||||
IVI.getIndices()) ==
|
||||
IVI.getOperand(1)->getType(),
|
||||
"Invalid InsertValueInst operands!", &IVI);
|
||||
|
||||
|
||||
visitInstruction(IVI);
|
||||
}
|
||||
|
||||
@ -1919,7 +1919,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
|
||||
// Check that the return value of the instruction is either void or a legal
|
||||
// value type.
|
||||
Assert1(I.getType()->isVoidTy() ||
|
||||
Assert1(I.getType()->isVoidTy() ||
|
||||
I.getType()->isFirstClassType(),
|
||||
"Instruction returns a non-scalar type!", &I);
|
||||
|
||||
@ -2011,10 +2011,10 @@ bool Verifier::VerifyIntrinsicType(Type *Ty,
|
||||
using namespace Intrinsic;
|
||||
|
||||
// If we ran out of descriptors, there are too many arguments.
|
||||
if (Infos.empty()) return true;
|
||||
if (Infos.empty()) return true;
|
||||
IITDescriptor D = Infos.front();
|
||||
Infos = Infos.slice(1);
|
||||
|
||||
|
||||
switch (D.Kind) {
|
||||
case IITDescriptor::Void: return !Ty->isVoidTy();
|
||||
case IITDescriptor::MMX: return !Ty->isX86_MMXTy();
|
||||
@ -2033,29 +2033,29 @@ bool Verifier::VerifyIntrinsicType(Type *Ty,
|
||||
return PT == 0 || PT->getAddressSpace() != D.Pointer_AddressSpace ||
|
||||
VerifyIntrinsicType(PT->getElementType(), Infos, ArgTys);
|
||||
}
|
||||
|
||||
|
||||
case IITDescriptor::Struct: {
|
||||
StructType *ST = dyn_cast<StructType>(Ty);
|
||||
if (ST == 0 || ST->getNumElements() != D.Struct_NumElements)
|
||||
return true;
|
||||
|
||||
|
||||
for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
|
||||
if (VerifyIntrinsicType(ST->getElementType(i), Infos, ArgTys))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
case IITDescriptor::Argument:
|
||||
// Two cases here - If this is the second occurrence of an argument, verify
|
||||
// that the later instance matches the previous instance.
|
||||
// that the later instance matches the previous instance.
|
||||
if (D.getArgumentNumber() < ArgTys.size())
|
||||
return Ty != ArgTys[D.getArgumentNumber()];
|
||||
|
||||
return Ty != ArgTys[D.getArgumentNumber()];
|
||||
|
||||
// Otherwise, if this is the first instance of an argument, record it and
|
||||
// verify the "Any" kind.
|
||||
assert(D.getArgumentNumber() == ArgTys.size() && "Table consistency error");
|
||||
ArgTys.push_back(Ty);
|
||||
|
||||
|
||||
switch (D.getArgumentKind()) {
|
||||
case IITDescriptor::AK_AnyInteger: return !Ty->isIntOrIntVectorTy();
|
||||
case IITDescriptor::AK_AnyFloat: return !Ty->isFPOrFPVectorTy();
|
||||
@ -2063,7 +2063,7 @@ bool Verifier::VerifyIntrinsicType(Type *Ty,
|
||||
case IITDescriptor::AK_AnyPointer: return !isa<PointerType>(Ty);
|
||||
}
|
||||
llvm_unreachable("all argument kinds not covered");
|
||||
|
||||
|
||||
case IITDescriptor::ExtendVecArgument:
|
||||
// This may only be used when referring to a previous vector argument.
|
||||
return D.getArgumentNumber() >= ArgTys.size() ||
|
||||
@ -2092,7 +2092,7 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
// describe.
|
||||
FunctionType *IFTy = IF->getFunctionType();
|
||||
Assert1(!IFTy->isVarArg(), "Intrinsic prototypes are not varargs", IF);
|
||||
|
||||
|
||||
SmallVector<Intrinsic::IITDescriptor, 8> Table;
|
||||
getIntrinsicInfoTableEntries(ID, Table);
|
||||
ArrayRef<Intrinsic::IITDescriptor> TableRef = Table;
|
||||
@ -2111,7 +2111,7 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
// the name.
|
||||
Assert1(Intrinsic::getName(ID, ArgTys) == IF->getName(),
|
||||
"Intrinsic name not mangled correctly for type arguments!", IF);
|
||||
|
||||
|
||||
// If the intrinsic takes MDNode arguments, verify that they are either global
|
||||
// or are local to *this* function.
|
||||
for (unsigned i = 0, e = CI.getNumArgOperands(); i != e; ++i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user