Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 //===-- ExceptionInfoWriter.h - Generate C++ exception info------*- C++ -*-===// | |
| 2 // | |
| 3 // The LLVM Compiler Infrastructure | |
| 4 // | |
| 5 // This file is distributed under the University of Illinois Open Source | |
| 6 // License. See LICENSE.TXT for details. | |
| 7 // | |
| 8 //===----------------------------------------------------------------------===// | |
| 9 | |
| 10 #ifndef TRANSFORMS_NACL_EXCEPTIONINFOWRITER_H | |
| 11 #define TRANSFORMS_NACL_EXCEPTIONINFOWRITER_H | |
| 12 | |
| 13 #include "llvm/ADT/DenseMap.h" | |
| 14 #include "llvm/IR/Instructions.h" | |
| 15 #include "llvm/IR/Module.h" | |
| 16 | |
| 17 namespace llvm { | |
| 18 | |
| 19 class ExceptionInfoWriter { | |
| 20 LLVMContext *Context; | |
| 21 StructType *ActionTableEntryTy; | |
| 22 | |
| 23 // Data for populating __pnacl_eh_type_table[], which is an array of | |
| 24 // std::type_info* pointers. Each of these pointers represents a | |
| 25 // C++ exception type. | |
| 26 SmallVector<Constant *, 10> TypeTableData; | |
| 27 // Mapping from std::type_info* pointer to type ID (index in | |
| 28 // TypeTableData). | |
| 29 typedef DenseMap<Constant *, unsigned> TypeTableIDMapType; | |
| 30 TypeTableIDMapType TypeTableIDMap; | |
| 31 | |
| 32 // Data for populating __pnacl_eh_action_table[], which is an array | |
| 33 // of pairs. | |
| 34 SmallVector<Constant *, 10> ActionTableData; | |
| 35 // Pair of (clause_id, clause_list_id). | |
| 36 typedef std::pair<unsigned, unsigned> ActionTableEntry; | |
| 37 // Mapping from (clause_id, clause_list_id) to clause_id (index in | |
| 38 // ActionTableData). | |
| 39 typedef DenseMap<ActionTableEntry, unsigned> ActionTableIDMapType; | |
| 40 ActionTableIDMapType ActionTableIDMap; | |
| 41 | |
| 42 // Data for populating __pnacl_eh_filter_table[], which is an array | |
| 43 // of integers. | |
| 44 SmallVector<Constant *, 10> FilterTableData; | |
| 45 | |
| 46 // Get the interned ID for an action. | |
| 47 unsigned getIDForClauseListNode(unsigned ClauseID, unsigned NextClauseListID); | |
| 48 | |
| 49 // Get the clause ID for a "filter" clause. | |
| 50 unsigned getIDForFilterClause(Value *Filter); | |
| 51 | |
| 52 public: | |
| 53 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.
| |
| 54 | |
| 55 // Get the interned type ID (a small integer) for a C++ exception type. | |
| 56 unsigned getIDForExceptionType(Value *Ty); | |
| 57 | |
| 58 // Get the clause list ID for a landingpad's clause list. | |
| 59 unsigned getIDForLandingPadClauseList(LandingPadInst *LP); | |
| 60 | |
| 61 // Add the exception info tables to the module. | |
| 62 void defineGlobalVariables(Module *M); | |
| 63 }; | |
| 64 | |
| 65 } | |
| 66 | |
| 67 #endif | |
| OLD | NEW |