mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
[MDBuilder] Simplify code using initializer lists. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1fcfdffdc7
commit
987c37b777
@ -36,8 +36,7 @@ MDNode *MDBuilder::createFPMath(float Accuracy) {
|
||||
|
||||
MDNode *MDBuilder::createBranchWeights(uint32_t TrueWeight,
|
||||
uint32_t FalseWeight) {
|
||||
uint32_t Weights[] = {TrueWeight, FalseWeight};
|
||||
return createBranchWeights(Weights);
|
||||
return createBranchWeights({TrueWeight, FalseWeight});
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createBranchWeights(ArrayRef<uint32_t> Weights) {
|
||||
@ -58,13 +57,10 @@ MDNode *MDBuilder::createUnpredictable() {
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createFunctionEntryCount(uint64_t Count) {
|
||||
SmallVector<Metadata *, 2> Vals(2);
|
||||
Vals[0] = createString("function_entry_count");
|
||||
|
||||
Type *Int64Ty = Type::getInt64Ty(Context);
|
||||
Vals[1] = createConstant(ConstantInt::get(Int64Ty, Count));
|
||||
|
||||
return MDNode::get(Context, Vals);
|
||||
return MDNode::get(Context,
|
||||
{createString("function_entry_count"),
|
||||
createConstant(ConstantInt::get(Int64Ty, Count))});
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createRange(const APInt &Lo, const APInt &Hi) {
|
||||
@ -80,8 +76,7 @@ MDNode *MDBuilder::createRange(Constant *Lo, Constant *Hi) {
|
||||
return nullptr;
|
||||
|
||||
// Return the range [Lo, Hi).
|
||||
Metadata *Range[2] = {createConstant(Lo), createConstant(Hi)};
|
||||
return MDNode::get(Context, Range);
|
||||
return MDNode::get(Context, {createConstant(Lo), createConstant(Hi)});
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) {
|
||||
@ -116,12 +111,10 @@ MDNode *MDBuilder::createTBAANode(StringRef Name, MDNode *Parent,
|
||||
bool isConstant) {
|
||||
if (isConstant) {
|
||||
Constant *Flags = ConstantInt::get(Type::getInt64Ty(Context), 1);
|
||||
Metadata *Ops[3] = {createString(Name), Parent, createConstant(Flags)};
|
||||
return MDNode::get(Context, Ops);
|
||||
} else {
|
||||
Metadata *Ops[2] = {createString(Name), Parent};
|
||||
return MDNode::get(Context, Ops);
|
||||
return MDNode::get(Context,
|
||||
{createString(Name), Parent, createConstant(Flags)});
|
||||
}
|
||||
return MDNode::get(Context, {createString(Name), Parent});
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createAliasScopeDomain(StringRef Name) {
|
||||
@ -129,8 +122,7 @@ MDNode *MDBuilder::createAliasScopeDomain(StringRef Name) {
|
||||
}
|
||||
|
||||
MDNode *MDBuilder::createAliasScope(StringRef Name, MDNode *Domain) {
|
||||
Metadata *Ops[2] = {createString(Name), Domain};
|
||||
return MDNode::get(Context, Ops);
|
||||
return MDNode::get(Context, {createString(Name), Domain});
|
||||
}
|
||||
|
||||
/// \brief Return metadata for a tbaa.struct node with the given
|
||||
@ -165,23 +157,19 @@ MDNode *MDBuilder::createTBAAStructTypeNode(
|
||||
MDNode *MDBuilder::createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
|
||||
uint64_t Offset) {
|
||||
ConstantInt *Off = ConstantInt::get(Type::getInt64Ty(Context), Offset);
|
||||
Metadata *Ops[3] = {createString(Name), Parent, createConstant(Off)};
|
||||
return MDNode::get(Context, Ops);
|
||||
return MDNode::get(Context,
|
||||
{createString(Name), Parent, createConstant(Off)});
|
||||
}
|
||||
|
||||
/// \brief Return metadata for a TBAA tag node with the given
|
||||
/// base type, access type and offset relative to the base type.
|
||||
MDNode *MDBuilder::createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
|
||||
uint64_t Offset, bool IsConstant) {
|
||||
Type *Int64 = Type::getInt64Ty(Context);
|
||||
IntegerType *Int64 = Type::getInt64Ty(Context);
|
||||
ConstantInt *Off = ConstantInt::get(Int64, Offset);
|
||||
if (IsConstant) {
|
||||
Metadata *Ops[4] = {BaseType, AccessType,
|
||||
createConstant(ConstantInt::get(Int64, Offset)),
|
||||
createConstant(ConstantInt::get(Int64, 1))};
|
||||
return MDNode::get(Context, Ops);
|
||||
} else {
|
||||
Metadata *Ops[3] = {BaseType, AccessType,
|
||||
createConstant(ConstantInt::get(Int64, Offset))};
|
||||
return MDNode::get(Context, Ops);
|
||||
return MDNode::get(Context, {BaseType, AccessType, createConstant(Off),
|
||||
createConstant(ConstantInt::get(Int64, 1))});
|
||||
}
|
||||
return MDNode::get(Context, {BaseType, AccessType, createConstant(Off)});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user