forked from OSchip/llvm-project
[NFC] Format CGBuilder.h
This commit is contained in:
parent
a459d1eb2c
commit
c698189696
|
@ -32,6 +32,7 @@ public:
|
|||
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
|
||||
llvm::BasicBlock *BB,
|
||||
llvm::BasicBlock::iterator InsertPt) const override;
|
||||
|
||||
private:
|
||||
CodeGenFunction *CGF = nullptr;
|
||||
};
|
||||
|
@ -45,17 +46,18 @@ class CGBuilderTy : public CGBuilderBaseTy {
|
|||
/// Storing a reference to the type cache here makes it a lot easier
|
||||
/// to build natural-feeling, target-specific IR.
|
||||
const CodeGenTypeCache &TypeCache;
|
||||
|
||||
public:
|
||||
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
|
||||
: CGBuilderBaseTy(C), TypeCache(TypeCache) {}
|
||||
CGBuilderTy(const CodeGenTypeCache &TypeCache,
|
||||
llvm::LLVMContext &C, const llvm::ConstantFolder &F,
|
||||
: CGBuilderBaseTy(C), TypeCache(TypeCache) {}
|
||||
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C,
|
||||
const llvm::ConstantFolder &F,
|
||||
const CGBuilderInserterTy &Inserter)
|
||||
: CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
|
||||
: CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
|
||||
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
|
||||
: CGBuilderBaseTy(I), TypeCache(TypeCache) {}
|
||||
: CGBuilderBaseTy(I), TypeCache(TypeCache) {}
|
||||
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
|
||||
: CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
|
||||
: CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
|
||||
|
||||
llvm::ConstantInt *getSize(CharUnits N) {
|
||||
return llvm::ConstantInt::get(TypeCache.SizeTy, N.getQuantity());
|
||||
|
@ -102,7 +104,8 @@ public:
|
|||
|
||||
using CGBuilderBaseTy::CreateAlignedStore;
|
||||
llvm::StoreInst *CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr,
|
||||
CharUnits Align, bool IsVolatile = false) {
|
||||
CharUnits Align,
|
||||
bool IsVolatile = false) {
|
||||
return CreateAlignedStore(Val, Addr, Align.getAsAlign(), IsVolatile);
|
||||
}
|
||||
|
||||
|
@ -165,8 +168,8 @@ public:
|
|||
Address CreateElementBitCast(Address Addr, llvm::Type *Ty,
|
||||
const llvm::Twine &Name = "") {
|
||||
auto *PtrTy = Ty->getPointerTo(Addr.getAddressSpace());
|
||||
return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name),
|
||||
Ty, Addr.getAlignment());
|
||||
return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name), Ty,
|
||||
Addr.getAlignment());
|
||||
}
|
||||
|
||||
using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
|
||||
|
@ -193,10 +196,10 @@ public:
|
|||
const llvm::StructLayout *Layout = DL.getStructLayout(ElTy);
|
||||
auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
|
||||
|
||||
return Address(CreateStructGEP(Addr.getElementType(),
|
||||
Addr.getPointer(), Index, Name),
|
||||
ElTy->getElementType(Index),
|
||||
Addr.getAlignment().alignmentAtOffset(Offset));
|
||||
return Address(
|
||||
CreateStructGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
|
||||
ElTy->getElementType(Index),
|
||||
Addr.getAlignment().alignmentAtOffset(Offset));
|
||||
}
|
||||
|
||||
/// Given
|
||||
|
@ -264,10 +267,10 @@ public:
|
|||
CharUnits EltSize =
|
||||
CharUnits::fromQuantity(DL.getTypeAllocSize(Addr.getElementType()));
|
||||
|
||||
return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(), Index,
|
||||
Name),
|
||||
Addr.getElementType(),
|
||||
Addr.getAlignment().alignmentOfArrayElement(EltSize));
|
||||
return Address(
|
||||
CreateGEP(Addr.getElementType(), Addr.getPointer(), Index, Name),
|
||||
Addr.getElementType(),
|
||||
Addr.getAlignment().alignmentOfArrayElement(EltSize));
|
||||
}
|
||||
|
||||
/// Given a pointer to i8, adjust it by a given constant offset.
|
||||
|
@ -342,8 +345,7 @@ public:
|
|||
}
|
||||
|
||||
using CGBuilderBaseTy::CreatePreserveStructAccessIndex;
|
||||
Address CreatePreserveStructAccessIndex(Address Addr,
|
||||
unsigned Index,
|
||||
Address CreatePreserveStructAccessIndex(Address Addr, unsigned Index,
|
||||
unsigned FieldIndex,
|
||||
llvm::MDNode *DbgInfo) {
|
||||
llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType());
|
||||
|
@ -363,7 +365,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
} // end namespace CodeGen
|
||||
} // end namespace clang
|
||||
} // end namespace CodeGen
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue