Lines Matching refs:llvm

66 class RSGlobalInfoPass: public llvm::ModulePass {
74 static uint32_t getEncodedProperties(const llvm::GlobalVariable &GV) { in getEncodedProperties()
90 if (GV.getLinkage() == llvm::GlobalValue::InternalLinkage) { in getEncodedProperties()
105 void getAnalysisUsage(llvm::AnalysisUsage &AU) const override { in getAnalysisUsage()
110 bool runOnModule(llvm::Module &M) override { in runOnModule()
111 std::vector<llvm::Constant *> GVAddresses; in runOnModule()
112 std::vector<llvm::Constant *> GVNames; in runOnModule()
118 const llvm::DataLayout &DL = M.getDataLayout(); in runOnModule()
126 llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(M.getContext()); in runOnModule()
129 llvm::Type *Int32Ty = llvm::Type::getInt32Ty(M.getContext()); in runOnModule()
132 llvm::Type *SizeTy = llvm::Type::getIntNTy(M.getContext(), in runOnModule()
143 GVAddresses.push_back(llvm::ConstantExpr::getBitCast(&GV, VoidPtrTy)); in runOnModule()
164 llvm::Constant *C = in runOnModule()
165 llvm::ConstantDataArray::getString(M.getContext(), GVN); in runOnModule()
168 llvm::Value *V = M.getOrInsertGlobal(VarName.str(), C->getType()); in runOnModule()
169 llvm::GlobalVariable *VarAsStr = llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
172 VarAsStr->setLinkage(llvm::GlobalValue::PrivateLinkage); in runOnModule()
176 GVNames.push_back(llvm::ConstantExpr::getBitCast(VarAsStr, VoidPtrTy)); in runOnModule()
192 llvm::ArrayType *VoidPtrArrayTy = llvm::ArrayType::get(VoidPtrTy, in runOnModule()
195 llvm::ArrayType *SizeArrayTy = llvm::ArrayType::get(SizeTy, NumGlobals); in runOnModule()
198 llvm::ArrayType *Int32ArrayTy = llvm::ArrayType::get(Int32Ty, NumGlobals); in runOnModule()
201 llvm::Value *V = M.getOrInsertGlobal(kRsGlobalEntries, Int32Ty); in runOnModule()
202 llvm::GlobalVariable *GlobalEntries = in runOnModule()
203 llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
204 llvm::Constant *GlobalEntriesInit = in runOnModule()
205 llvm::ConstantInt::get(Int32Ty, NumGlobals); in runOnModule()
211 llvm::GlobalVariable *GlobalNames = in runOnModule()
212 llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
213 llvm::Constant *GlobalNamesInit = in runOnModule()
214 llvm::ConstantArray::get(VoidPtrArrayTy, GVNames); in runOnModule()
220 llvm::GlobalVariable *GlobalAddresses = in runOnModule()
221 llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
222 llvm::Constant *GlobalAddressesInit = in runOnModule()
223 llvm::ConstantArray::get(VoidPtrArrayTy, GVAddresses); in runOnModule()
230 llvm::GlobalVariable *GlobalSizes = in runOnModule()
231 llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
232 llvm::Constant *GlobalSizesInit; in runOnModule()
234 GlobalSizesInit = llvm::ConstantDataArray::get(M.getContext(), GVSizes32); in runOnModule()
236 GlobalSizesInit = llvm::ConstantDataArray::get(M.getContext(), GVSizes64); in runOnModule()
243 llvm::GlobalVariable *GlobalProperties = in runOnModule()
244 llvm::dyn_cast<llvm::GlobalVariable>(V); in runOnModule()
245 llvm::Constant *GlobalPropertiesInit = in runOnModule()
246 llvm::ConstantDataArray::get(M.getContext(), GVProperties); in runOnModule()
267 static llvm::RegisterPass<RSGlobalInfoPass> X("embed-rs-global-info",
272 llvm::ModulePass * createRSGlobalInfoPass(bool pSkipConstants) { in createRSGlobalInfoPass()