Assorted cleanup:
- Have CGM precompute a number of commonly-used types
- Have CGF copy that during initialization instead of recomputing them
- Use TBAA info when initializing a parameter variable
- Refactor the scalar ++/-- code
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125562 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index 5d2e581..b6bd37c 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -94,10 +94,39 @@
return priority == RHS.priority && lex_order < RHS.lex_order;
}
};
+
+ struct CodeGenTypeCache {
+ /// i8, i32, and i64
+ const llvm::IntegerType *Int8Ty, *Int32Ty, *Int64Ty;
+
+ /// int
+ const llvm::IntegerType *IntTy;
+
+ /// intptr_t and size_t, which we assume are the same
+ union {
+ const llvm::IntegerType *IntPtrTy;
+ const llvm::IntegerType *SizeTy;
+ };
+
+ /// void* in address space 0
+ union {
+ const llvm::PointerType *VoidPtrTy;
+ const llvm::PointerType *Int8PtrTy;
+ };
+
+ /// void** in address space 0
+ union {
+ const llvm::PointerType *VoidPtrPtrTy;
+ const llvm::PointerType *Int8PtrPtrTy;
+ };
+
+ /// The width of an address-zero pointer.
+ unsigned char PointerWidthInBits;
+ };
/// CodeGenModule - This class organizes the cross-function state that is used
/// while generating LLVM code.
-class CodeGenModule {
+class CodeGenModule : public CodeGenTypeCache {
CodeGenModule(const CodeGenModule&); // DO NOT IMPLEMENT
void operator=(const CodeGenModule&); // DO NOT IMPLEMENT
@@ -227,8 +256,6 @@
/// Release - Finalize LLVM code generation.
void Release();
- const llvm::PointerType *Int8PtrTy;
-
/// getObjCRuntime() - Return a reference to the configured
/// Objective-C runtime.
CGObjCRuntime &getObjCRuntime() {