Module.hのメモ
Moduleとは?
- LLVM Moduleに関する情報をすべて持つ、IRのトップレベルコンテナ
- 以下のリストを持つ
- globals variables
- functions,
- moduleが依存するlibraryや他のモジュール
- シンボルテーブルを持つ
- その他もろもろを持つ
- endianessとか、size of a pointerとか
- GlobalValRefMapをメンテする(今は意味がよくわからない)。
- privateだから直接見れないが、主に以下のようなメンバ。
GlobalListType GlobalList; ///< The Global Variables in the module FunctionListType FunctionList; ///< The Functions in the module AliasListType AliasList; ///< The Aliases in the module LibraryListType LibraryList; ///< The Libraries needed by the module ValueSymbolTable *ValSymTab; ///< Symbol table for values TypeSymbolTable *TypeSymTab; ///< Symbol table for types std::string ModuleID; ///< Human readable identifier for the module std::string TargetTriple; ///< Platform target triple Module compiled on std::string DataLayout; ///< Target data description std::string GlobalScopeAsm; ///< Inline Asm at global scope.
- 'GlobalListType'とかは、同クラス内でtypedefされている。
- アクセスは、getter,setterだったり、'getOrInsert....'だったりいろいろ。
- GlobalList, FunctionList, AliasList, LibraryListあたりはiteratorもあり。
- テキスト化するメソッドもいろいろあるようだ。
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const; void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; void dump() const;
- コンストラクタはモジュール名を与えないとだめ。
explicit Module(const std::string &ModuleID);
- 次は以下にもぐって読んでみる(Aliasが気になるけど何かわからないから後回し)。
- GlobalAlias
- GlobalVariable
- Function