Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: lib/Transforms/NaCl/ExceptionInfoWriter.h

Issue 24777002: Add PNaClSjLjEH pass to implement C++ exception handling using setjmp()+longjmp() (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Rename UnwindFrame -> ExceptionFrame for consistency Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/Transforms/NaCl/ExceptionInfoWriter.h
diff --git a/lib/Transforms/NaCl/ExceptionInfoWriter.h b/lib/Transforms/NaCl/ExceptionInfoWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0a6a2836696f1512bd05740ad8691def4b0cceb
--- /dev/null
+++ b/lib/Transforms/NaCl/ExceptionInfoWriter.h
@@ -0,0 +1,67 @@
+//===-- ExceptionInfoWriter.h - Generate C++ exception info------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TRANSFORMS_NACL_EXCEPTIONINFOWRITER_H
+#define TRANSFORMS_NACL_EXCEPTIONINFOWRITER_H
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Module.h"
+
+namespace llvm {
+
+class ExceptionInfoWriter {
+ LLVMContext *Context;
+ StructType *ActionTableEntryTy;
+
+ // Data for populating __pnacl_eh_type_table[], which is an array of
+ // std::type_info* pointers. Each of these pointers represents a
+ // C++ exception type.
+ SmallVector<Constant *, 10> TypeTableData;
+ // Mapping from std::type_info* pointer to type ID (index in
+ // TypeTableData).
+ typedef DenseMap<Constant *, unsigned> TypeTableIDMapType;
+ TypeTableIDMapType TypeTableIDMap;
+
+ // Data for populating __pnacl_eh_action_table[], which is an array
+ // of pairs.
+ SmallVector<Constant *, 10> ActionTableData;
+ // Pair of (clause_id, clause_list_id).
+ typedef std::pair<unsigned, unsigned> ActionTableEntry;
+ // Mapping from (clause_id, clause_list_id) to clause_id (index in
+ // ActionTableData).
+ typedef DenseMap<ActionTableEntry, unsigned> ActionTableIDMapType;
+ ActionTableIDMapType ActionTableIDMap;
+
+ // Data for populating __pnacl_eh_filter_table[], which is an array
+ // of integers.
+ SmallVector<Constant *, 10> FilterTableData;
+
+ // Get the interned ID for an action.
+ unsigned getIDForClauseListNode(unsigned ClauseID, unsigned NextClauseListID);
+
+ // Get the clause ID for a "filter" clause.
+ unsigned getIDForFilterClause(Value *Filter);
+
+public:
+ ExceptionInfoWriter(LLVMContext *Context);
Derek Schuff 2013/10/15 17:39:26 i think it's LLVM style to always use explicit for
Mark Seaborn 2013/10/15 21:41:18 Done. I always forget about this C++ gotcha.
+
+ // Get the interned type ID (a small integer) for a C++ exception type.
+ unsigned getIDForExceptionType(Value *Ty);
+
+ // Get the clause list ID for a landingpad's clause list.
+ unsigned getIDForLandingPadClauseList(LandingPadInst *LP);
+
+ // Add the exception info tables to the module.
+ void defineGlobalVariables(Module *M);
+};
+
+}
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698