From 5936e33bf74dd6bf126ceee0f6169a2593d03a69 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 15 Feb 2011 09:22:45 +0000 Subject: 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 --- lib/CodeGen/CodeGenModule.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 5d2e581ec3..b6bd37c1c0 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -94,10 +94,39 @@ namespace CodeGen { 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 @@ public: /// Release - Finalize LLVM code generation. void Release(); - const llvm::PointerType *Int8PtrTy; - /// getObjCRuntime() - Return a reference to the configured /// Objective-C runtime. CGObjCRuntime &getObjCRuntime() { -- cgit v1.2.3