From 1afcace3a3a138b1b18e5c6270caa8dae2261ae2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 9 Jul 2011 17:41:24 +0000 Subject: Land the long talked about "type system rewrite" patch. This patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/ExtractFunction.cpp | 2 -- tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 45 +++++++++++++++++-------------- tools/llvm-extract/llvm-extract.cpp | 1 - 3 files changed, 25 insertions(+), 23 deletions(-) (limited to 'tools') diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index e22841aca48..7ed15245c19 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -116,8 +116,6 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { else CleanupPasses.push_back("deadargelim"); - CleanupPasses.push_back("deadtypeelim"); - Module *New = runPassesOn(M, CleanupPasses); if (New == 0) { errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n"; diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 6310d8be51b..4ada64a5285 100644 --- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -102,10 +102,11 @@ static const char *GetBlockName(unsigned BlockID, default: return 0; case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK"; case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK"; - case bitc::TYPE_BLOCK_ID: return "TYPE_BLOCK"; + case bitc::TYPE_BLOCK_ID_OLD: return "TYPE_BLOCK_ID_OLD"; + case bitc::TYPE_BLOCK_ID_NEW: return "TYPE_BLOCK_ID"; case bitc::CONSTANTS_BLOCK_ID: return "CONSTANTS_BLOCK"; case bitc::FUNCTION_BLOCK_ID: return "FUNCTION_BLOCK"; - case bitc::TYPE_SYMTAB_BLOCK_ID: return "TYPE_SYMTAB"; + case bitc::TYPE_SYMTAB_BLOCK_ID_OLD: return "TYPE_SYMTAB_OLD"; case bitc::VALUE_SYMTAB_BLOCK_ID: return "VALUE_SYMTAB"; case bitc::METADATA_BLOCK_ID: return "METADATA_BLOCK"; case bitc::METADATA_ATTACHMENT_ID: return "METADATA_ATTACHMENT_BLOCK"; @@ -162,25 +163,29 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, default: return 0; case bitc::PARAMATTR_CODE_ENTRY: return "ENTRY"; } - case bitc::TYPE_BLOCK_ID: + case bitc::TYPE_BLOCK_ID_OLD: + case bitc::TYPE_BLOCK_ID_NEW: switch (CodeID) { default: return 0; - case bitc::TYPE_CODE_NUMENTRY: return "NUMENTRY"; - case bitc::TYPE_CODE_VOID: return "VOID"; - case bitc::TYPE_CODE_FLOAT: return "FLOAT"; - case bitc::TYPE_CODE_DOUBLE: return "DOUBLE"; - case bitc::TYPE_CODE_LABEL: return "LABEL"; - case bitc::TYPE_CODE_OPAQUE: return "OPAQUE"; - case bitc::TYPE_CODE_INTEGER: return "INTEGER"; - case bitc::TYPE_CODE_POINTER: return "POINTER"; - case bitc::TYPE_CODE_FUNCTION: return "FUNCTION"; - case bitc::TYPE_CODE_STRUCT: return "STRUCT"; - case bitc::TYPE_CODE_ARRAY: return "ARRAY"; - case bitc::TYPE_CODE_VECTOR: return "VECTOR"; - case bitc::TYPE_CODE_X86_FP80: return "X86_FP80"; - case bitc::TYPE_CODE_FP128: return "FP128"; - case bitc::TYPE_CODE_PPC_FP128: return "PPC_FP128"; - case bitc::TYPE_CODE_METADATA: return "METADATA"; + case bitc::TYPE_CODE_NUMENTRY: return "NUMENTRY"; + case bitc::TYPE_CODE_VOID: return "VOID"; + case bitc::TYPE_CODE_FLOAT: return "FLOAT"; + case bitc::TYPE_CODE_DOUBLE: return "DOUBLE"; + case bitc::TYPE_CODE_LABEL: return "LABEL"; + case bitc::TYPE_CODE_OPAQUE: return "OPAQUE"; + case bitc::TYPE_CODE_INTEGER: return "INTEGER"; + case bitc::TYPE_CODE_POINTER: return "POINTER"; + case bitc::TYPE_CODE_FUNCTION: return "FUNCTION"; + case bitc::TYPE_CODE_STRUCT_OLD: return "STRUCT_OLD"; + case bitc::TYPE_CODE_ARRAY: return "ARRAY"; + case bitc::TYPE_CODE_VECTOR: return "VECTOR"; + case bitc::TYPE_CODE_X86_FP80: return "X86_FP80"; + case bitc::TYPE_CODE_FP128: return "FP128"; + case bitc::TYPE_CODE_PPC_FP128: return "PPC_FP128"; + case bitc::TYPE_CODE_METADATA: return "METADATA"; + case bitc::TYPE_CODE_STRUCT_ANON: return "STRUCT_ANON"; + case bitc::TYPE_CODE_STRUCT_NAME: return "STRUCT_NAME"; + case bitc::TYPE_CODE_STRUCT_NAMED: return "STRUCT_NAMED"; } case bitc::CONSTANTS_BLOCK_ID: @@ -242,7 +247,7 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, case bitc::FUNC_CODE_INST_CALL: return "INST_CALL"; case bitc::FUNC_CODE_DEBUG_LOC: return "DEBUG_LOC"; } - case bitc::TYPE_SYMTAB_BLOCK_ID: + case bitc::TYPE_SYMTAB_BLOCK_ID_OLD: switch (CodeID) { default: return 0; case bitc::TST_CODE_ENTRY: return "ENTRY"; diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 8c2f43a4f7d..a6c229fc979 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -149,7 +149,6 @@ int main(int argc, char **argv) { if (!DeleteFn) Passes.add(createGlobalDCEPass()); // Delete unreachable globals Passes.add(createStripDeadDebugInfoPass()); // Remove dead debug info - Passes.add(createDeadTypeEliminationPass()); // Remove dead types... Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls std::string ErrorInfo; -- cgit v1.2.3