Displaying 1 result from an estimated 1 matches for "structmodulepass".
2016 Mar 28
2
llvm extract struct elements and struct size in C++
...de <llvm/IR/Instructions.h>
#include <llvm/IR/IntrinsicInst.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
#include <iostream>
#include <map>
#include <vector>
using namespace llvm;
namespace {
class StructModulePass: public ModulePass {
public:
static char ID;
StructModulePass() : ModulePass(ID) {}
virtual bool runOnModule(Module &M1) override {
// iterate over global structures
M = &M1;
int i;
for(auto G = M->global_begin(); G!= M->global_end() ; G++, i++){
er...