Cleanup whitespace.

llvm-svn: 155328
This commit is contained in:
Bill Wendling 2012-04-23 00:23:33 +00:00
parent 3d0ec2bedb
commit e32c23a5e0
1 changed files with 32 additions and 32 deletions

View File

@ -65,20 +65,20 @@ Module::~Module() {
Module::Endianness Module::getEndianness() const { Module::Endianness Module::getEndianness() const {
StringRef temp = DataLayout; StringRef temp = DataLayout;
Module::Endianness ret = AnyEndianness; Module::Endianness ret = AnyEndianness;
while (!temp.empty()) { while (!temp.empty()) {
std::pair<StringRef, StringRef> P = getToken(temp, "-"); std::pair<StringRef, StringRef> P = getToken(temp, "-");
StringRef token = P.first; StringRef token = P.first;
temp = P.second; temp = P.second;
if (token[0] == 'e') { if (token[0] == 'e') {
ret = LittleEndian; ret = LittleEndian;
} else if (token[0] == 'E') { } else if (token[0] == 'E') {
ret = BigEndian; ret = BigEndian;
} }
} }
return ret; return ret;
} }
@ -86,13 +86,13 @@ Module::Endianness Module::getEndianness() const {
Module::PointerSize Module::getPointerSize() const { Module::PointerSize Module::getPointerSize() const {
StringRef temp = DataLayout; StringRef temp = DataLayout;
Module::PointerSize ret = AnyPointerSize; Module::PointerSize ret = AnyPointerSize;
while (!temp.empty()) { while (!temp.empty()) {
std::pair<StringRef, StringRef> TmpP = getToken(temp, "-"); std::pair<StringRef, StringRef> TmpP = getToken(temp, "-");
temp = TmpP.second; temp = TmpP.second;
TmpP = getToken(TmpP.first, ":"); TmpP = getToken(TmpP.first, ":");
StringRef token = TmpP.second, signalToken = TmpP.first; StringRef token = TmpP.second, signalToken = TmpP.first;
if (signalToken[0] == 'p') { if (signalToken[0] == 'p') {
int size = 0; int size = 0;
getToken(token, ":").first.getAsInteger(10, size); getToken(token, ":").first.getAsInteger(10, size);
@ -102,7 +102,7 @@ Module::PointerSize Module::getPointerSize() const {
ret = Pointer64; ret = Pointer64;
} }
} }
return ret; return ret;
} }
@ -164,9 +164,9 @@ Constant *Module::getOrInsertFunction(StringRef Name,
// right type. // right type.
if (F->getType() != PointerType::getUnqual(Ty)) if (F->getType() != PointerType::getUnqual(Ty))
return ConstantExpr::getBitCast(F, PointerType::getUnqual(Ty)); return ConstantExpr::getBitCast(F, PointerType::getUnqual(Ty));
// Otherwise, we just found the existing function or a prototype. // Otherwise, we just found the existing function or a prototype.
return F; return F;
} }
Constant *Module::getOrInsertTargetIntrinsic(StringRef Name, Constant *Module::getOrInsertTargetIntrinsic(StringRef Name,
@ -183,7 +183,7 @@ Constant *Module::getOrInsertTargetIntrinsic(StringRef Name,
} }
// Otherwise, we just found the existing function or a prototype. // Otherwise, we just found the existing function or a prototype.
return F; return F;
} }
Constant *Module::getOrInsertFunction(StringRef Name, Constant *Module::getOrInsertFunction(StringRef Name,
@ -229,7 +229,7 @@ Constant *Module::getOrInsertFunction(StringRef Name,
va_end(Args); va_end(Args);
// Build the function type and chain to the other getOrInsertFunction... // Build the function type and chain to the other getOrInsertFunction...
return getOrInsertFunction(Name, return getOrInsertFunction(Name,
FunctionType::get(RetTy, ArgTys, false), FunctionType::get(RetTy, ArgTys, false),
AttrListPtr::get((AttributeWithIndex *)0, 0)); AttrListPtr::get((AttributeWithIndex *)0, 0));
} }
@ -254,7 +254,7 @@ Function *Module::getFunction(StringRef Name) const {
/// ///
GlobalVariable *Module::getGlobalVariable(StringRef Name, GlobalVariable *Module::getGlobalVariable(StringRef Name,
bool AllowLocal) const { bool AllowLocal) const {
if (GlobalVariable *Result = if (GlobalVariable *Result =
dyn_cast_or_null<GlobalVariable>(getNamedValue(Name))) dyn_cast_or_null<GlobalVariable>(getNamedValue(Name)))
if (AllowLocal || !Result->hasLocalLinkage()) if (AllowLocal || !Result->hasLocalLinkage())
return Result; return Result;
@ -282,7 +282,7 @@ Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
// right type. // right type.
if (GV->getType() != PointerType::getUnqual(Ty)) if (GV->getType() != PointerType::getUnqual(Ty))
return ConstantExpr::getBitCast(GV, PointerType::getUnqual(Ty)); return ConstantExpr::getBitCast(GV, PointerType::getUnqual(Ty));
// Otherwise, we just found the existing function or a prototype. // Otherwise, we just found the existing function or a prototype.
return GV; return GV;
} }
@ -299,7 +299,7 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const {
} }
/// getNamedMetadata - Return the first NamedMDNode in the module with the /// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the /// specified name. This method returns null if a NamedMDNode with the
/// specified name is not found. /// specified name is not found.
NamedMDNode *Module::getNamedMetadata(const Twine &Name) const { NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
SmallString<256> NameData; SmallString<256> NameData;
@ -307,8 +307,8 @@ NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
return static_cast<StringMap<NamedMDNode*> *>(NamedMDSymTab)->lookup(NameRef); return static_cast<StringMap<NamedMDNode*> *>(NamedMDSymTab)->lookup(NameRef);
} }
/// getOrInsertNamedMetadata - Return the first named MDNode in the module /// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a /// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found. /// NamedMDNode with the specified name is not found.
NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) { NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) {
NamedMDNode *&NMD = NamedMDNode *&NMD =
@ -481,13 +481,13 @@ namespace {
// objects, we keep several helper maps. // objects, we keep several helper maps.
DenseSet<const Value*> VisitedConstants; DenseSet<const Value*> VisitedConstants;
DenseSet<Type*> VisitedTypes; DenseSet<Type*> VisitedTypes;
std::vector<StructType*> &StructTypes; std::vector<StructType*> &StructTypes;
bool OnlyNamed; bool OnlyNamed;
public: public:
TypeFinder(std::vector<StructType*> &structTypes, bool onlyNamed) TypeFinder(std::vector<StructType*> &structTypes, bool onlyNamed)
: StructTypes(structTypes), OnlyNamed(onlyNamed) {} : StructTypes(structTypes), OnlyNamed(onlyNamed) {}
void run(const Module &M) { void run(const Module &M) {
// Get types from global variables. // Get types from global variables.
for (Module::const_global_iterator I = M.global_begin(), for (Module::const_global_iterator I = M.global_begin(),
@ -496,7 +496,7 @@ namespace {
if (I->hasInitializer()) if (I->hasInitializer())
incorporateValue(I->getInitializer()); incorporateValue(I->getInitializer());
} }
// Get types from aliases. // Get types from aliases.
for (Module::const_alias_iterator I = M.alias_begin(), for (Module::const_alias_iterator I = M.alias_begin(),
E = M.alias_end(); I != E; ++I) { E = M.alias_end(); I != E; ++I) {
@ -504,12 +504,12 @@ namespace {
if (const Value *Aliasee = I->getAliasee()) if (const Value *Aliasee = I->getAliasee())
incorporateValue(Aliasee); incorporateValue(Aliasee);
} }
// Get types from functions. // Get types from functions.
SmallVector<std::pair<unsigned, MDNode*>, 4> MDForInst; SmallVector<std::pair<unsigned, MDNode*>, 4> MDForInst;
for (Module::const_iterator FI = M.begin(), E = M.end(); FI != E; ++FI) { for (Module::const_iterator FI = M.begin(), E = M.end(); FI != E; ++FI) {
incorporateType(FI->getType()); incorporateType(FI->getType());
// First incorporate the arguments. // First incorporate the arguments.
for (Function::const_arg_iterator AI = FI->arg_begin(), for (Function::const_arg_iterator AI = FI->arg_begin(),
AE = FI->arg_end(); AI != AE; ++AI) AE = FI->arg_end(); AI != AE; ++AI)
@ -529,7 +529,7 @@ namespace {
OI != OE; ++OI) OI != OE; ++OI)
if (!isa<Instruction>(OI)) if (!isa<Instruction>(OI))
incorporateValue(*OI); incorporateValue(*OI);
// Incorporate types hiding in metadata. // Incorporate types hiding in metadata.
I.getAllMetadataOtherThanDebugLoc(MDForInst); I.getAllMetadataOtherThanDebugLoc(MDForInst);
for (unsigned i = 0, e = MDForInst.size(); i != e; ++i) for (unsigned i = 0, e = MDForInst.size(); i != e; ++i)
@ -537,7 +537,7 @@ namespace {
MDForInst.clear(); MDForInst.clear();
} }
} }
for (Module::const_named_metadata_iterator I = M.named_metadata_begin(), for (Module::const_named_metadata_iterator I = M.named_metadata_begin(),
E = M.named_metadata_end(); I != E; ++I) { E = M.named_metadata_end(); I != E; ++I) {
const NamedMDNode *NMD = I; const NamedMDNode *NMD = I;
@ -545,24 +545,24 @@ namespace {
incorporateMDNode(NMD->getOperand(i)); incorporateMDNode(NMD->getOperand(i));
} }
} }
private: private:
void incorporateType(Type *Ty) { void incorporateType(Type *Ty) {
// Check to see if we're already visited this type. // Check to see if we're already visited this type.
if (!VisitedTypes.insert(Ty).second) if (!VisitedTypes.insert(Ty).second)
return; return;
// If this is a structure or opaque type, add a name for the type. // If this is a structure or opaque type, add a name for the type.
if (StructType *STy = dyn_cast<StructType>(Ty)) if (StructType *STy = dyn_cast<StructType>(Ty))
if (!OnlyNamed || STy->hasName()) if (!OnlyNamed || STy->hasName())
StructTypes.push_back(STy); StructTypes.push_back(STy);
// Recursively walk all contained types. // Recursively walk all contained types.
for (Type::subtype_iterator I = Ty->subtype_begin(), for (Type::subtype_iterator I = Ty->subtype_begin(),
E = Ty->subtype_end(); I != E; ++I) E = Ty->subtype_end(); I != E; ++I)
incorporateType(*I); incorporateType(*I);
} }
/// incorporateValue - This method is used to walk operand lists finding /// incorporateValue - This method is used to walk operand lists finding
/// types hiding in constant expressions and other operands that won't be /// types hiding in constant expressions and other operands that won't be
/// walked in other ways. GlobalValues, basic blocks, instructions, and /// walked in other ways. GlobalValues, basic blocks, instructions, and
@ -571,11 +571,11 @@ namespace {
if (const MDNode *M = dyn_cast<MDNode>(V)) if (const MDNode *M = dyn_cast<MDNode>(V))
return incorporateMDNode(M); return incorporateMDNode(M);
if (!isa<Constant>(V) || isa<GlobalValue>(V)) return; if (!isa<Constant>(V) || isa<GlobalValue>(V)) return;
// Already visited? // Already visited?
if (!VisitedConstants.insert(V).second) if (!VisitedConstants.insert(V).second)
return; return;
// Check this type. // Check this type.
incorporateType(V->getType()); incorporateType(V->getType());
@ -589,13 +589,13 @@ namespace {
E = U->op_end(); I != E;++I) E = U->op_end(); I != E;++I)
incorporateValue(*I); incorporateValue(*I);
} }
void incorporateMDNode(const MDNode *V) { void incorporateMDNode(const MDNode *V) {
// Already visited? // Already visited?
if (!VisitedConstants.insert(V).second) if (!VisitedConstants.insert(V).second)
return; return;
// Look in operands for types. // Look in operands for types.
for (unsigned i = 0, e = V->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = V->getNumOperands(); i != e; ++i)
if (Value *Op = V->getOperand(i)) if (Value *Op = V->getOperand(i))