Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by llvm2cpp - DO NOT MODIFY!
- #include <llvm/Pass.h>
- #include <llvm/PassManager.h>
- #include <llvm/ADT/SmallVector.h>
- #include <llvm/Analysis/Verifier.h>
- #include <llvm/Assembly/PrintModulePass.h>
- #include <llvm/IR/BasicBlock.h>
- #include <llvm/IR/CallingConv.h>
- #include <llvm/IR/Constants.h>
- #include <llvm/IR/DerivedTypes.h>
- #include <llvm/IR/Function.h>
- #include <llvm/IR/GlobalVariable.h>
- #include <llvm/IR/InlineAsm.h>
- #include <llvm/IR/Instructions.h>
- #include <llvm/IR/LLVMContext.h>
- #include <llvm/IR/Module.h>
- #include <llvm/Support/FormattedStream.h>
- #include <llvm/Support/MathExtras.h>
- #include <algorithm>
- using namespace llvm;
- Module* makeLLVMModule();
- int main(int argc, char**argv) {
- Module* Mod = makeLLVMModule();
- verifyModule(*Mod, PrintMessageAction);
- PassManager PM;
- PM.add(createPrintModulePass(&outs()));
- PM.run(*Mod);
- return 0;
- }
- Module* makeLLVMModule() {
- // Module Construction
- Module* mod = new Module("examplergbatogray.bc", getGlobalContext());
- mod->setDataLayout("e-p:32:32-i64:64-v128:64:128-n32-S64");
- mod->setTargetTriple("armv7-none-linux-gnueabi");
- // Type Definitions
- StructType *StructTy_struct_rs_allocation = mod->getTypeByName("struct.rs_allocation");
- if (!StructTy_struct_rs_allocation) {
- StructTy_struct_rs_allocation = StructType::create(mod->getContext(), "struct.rs_allocation");
- }
- std::vector<Type*>StructTy_struct_rs_allocation_fields;
- PointerType* PointerTy_0 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0);
- StructTy_struct_rs_allocation_fields.push_back(PointerTy_0);
- if (StructTy_struct_rs_allocation->isOpaque()) {
- StructTy_struct_rs_allocation->setBody(StructTy_struct_rs_allocation_fields, /*isPacked=*/false);
- }
- PointerType* PointerTy_1 = PointerType::get(StructTy_struct_rs_allocation, 0);
- VectorType* VectorTy_2 = VectorType::get(IntegerType::get(mod->getContext(), 8), 4);
- std::vector<Type*>FuncTy_3_args;
- FuncTy_3_args.push_back(IntegerType::get(mod->getContext(), 32));
- FuncTy_3_args.push_back(IntegerType::get(mod->getContext(), 32));
- FunctionType* FuncTy_3 = FunctionType::get(
- /*Result=*/VectorTy_2,
- /*Params=*/FuncTy_3_args,
- /*isVarArg=*/false);
- ArrayType* ArrayTy_4 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 1);
- PointerType* PointerTy_5 = PointerType::get(ArrayTy_4, 0);
- std::vector<Type*>FuncTy_7_args;
- FuncTy_7_args.push_back(ArrayTy_4);
- FuncTy_7_args.push_back(IntegerType::get(mod->getContext(), 32));
- FuncTy_7_args.push_back(IntegerType::get(mod->getContext(), 32));
- FunctionType* FuncTy_7 = FunctionType::get(
- /*Result=*/VectorTy_2,
- /*Params=*/FuncTy_7_args,
- /*isVarArg=*/false);
- PointerType* PointerTy_6 = PointerType::get(FuncTy_7, 0);
- VectorType* VectorTy_8 = VectorType::get(IntegerType::get(mod->getContext(), 32), 4);
- std::vector<Type*>FuncTy_9_args;
- FunctionType* FuncTy_9 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
- /*Params=*/FuncTy_9_args,
- /*isVarArg=*/false);
- std::vector<Type*>FuncTy_11_args;
- FuncTy_11_args.push_back(PointerTy_1);
- FunctionType* FuncTy_11 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
- /*Params=*/FuncTy_11_args,
- /*isVarArg=*/false);
- PointerType* PointerTy_10 = PointerType::get(FuncTy_11, 0);
- // Function Declarations
- Function* func_convertRGBAToGray = mod->getFunction("convertRGBAToGray");
- if (!func_convertRGBAToGray) {
- func_convertRGBAToGray = Function::Create(
- /*Type=*/FuncTy_3,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"convertRGBAToGray", mod);
- func_convertRGBAToGray->setCallingConv(CallingConv::C);
- }
- AttributeSet func_convertRGBAToGray_PAL;
- {
- SmallVector<AttributeSet, 4> Attrs;
- AttributeSet PAS;
- {
- AttrBuilder B;
- B.addAttribute(Attribute::NoUnwind);
- PAS = AttributeSet::get(mod->getContext(), ~0U, B);
- }
- Attrs.push_back(PAS);
- func_convertRGBAToGray_PAL = AttributeSet::get(mod->getContext(), Attrs);
- }
- func_convertRGBAToGray->setAttributes(func_convertRGBAToGray_PAL);
- Function* func__Z21rsGetElementAt_uchar413rs_allocationjj = mod->getFunction("_Z21rsGetElementAt_uchar413rs_allocationjj");
- if (!func__Z21rsGetElementAt_uchar413rs_allocationjj) {
- func__Z21rsGetElementAt_uchar413rs_allocationjj = Function::Create(
- /*Type=*/FuncTy_7,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"_Z21rsGetElementAt_uchar413rs_allocationjj", mod); // (external, no body)
- func__Z21rsGetElementAt_uchar413rs_allocationjj->setCallingConv(CallingConv::C);
- }
- AttributeSet func__Z21rsGetElementAt_uchar413rs_allocationjj_PAL;
- func__Z21rsGetElementAt_uchar413rs_allocationjj->setAttributes(func__Z21rsGetElementAt_uchar413rs_allocationjj_PAL);
- Function* func__rs_dtor = mod->getFunction(".rs.dtor");
- if (!func__rs_dtor) {
- func__rs_dtor = Function::Create(
- /*Type=*/FuncTy_9,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/".rs.dtor", mod);
- func__rs_dtor->setCallingConv(CallingConv::C);
- }
- AttributeSet func__rs_dtor_PAL;
- {
- SmallVector<AttributeSet, 4> Attrs;
- AttributeSet PAS;
- {
- AttrBuilder B;
- B.addAttribute(Attribute::NoUnwind);
- PAS = AttributeSet::get(mod->getContext(), ~0U, B);
- }
- Attrs.push_back(PAS);
- func__rs_dtor_PAL = AttributeSet::get(mod->getContext(), Attrs);
- }
- func__rs_dtor->setAttributes(func__rs_dtor_PAL);
- Function* func__Z13rsClearObjectP13rs_allocation = mod->getFunction("_Z13rsClearObjectP13rs_allocation");
- if (!func__Z13rsClearObjectP13rs_allocation) {
- func__Z13rsClearObjectP13rs_allocation = Function::Create(
- /*Type=*/FuncTy_11,
- /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"_Z13rsClearObjectP13rs_allocation", mod); // (external, no body)
- func__Z13rsClearObjectP13rs_allocation->setCallingConv(CallingConv::C);
- }
- AttributeSet func__Z13rsClearObjectP13rs_allocation_PAL;
- func__Z13rsClearObjectP13rs_allocation->setAttributes(func__Z13rsClearObjectP13rs_allocation_PAL);
- // Global Variable Declarations
- GlobalVariable* gvar_struct_inAllocation = new GlobalVariable(/*Module=*/*mod,
- /*Type=*/StructTy_struct_rs_allocation,
- /*isConstant=*/false,
- /*Linkage=*/GlobalValue::CommonLinkage,
- /*Initializer=*/0, // has initializer, specified below
- /*Name=*/"inAllocation");
- gvar_struct_inAllocation->setAlignment(4);
- // Constant Definitions
- ConstantAggregateZero* const_struct_12 = ConstantAggregateZero::get(StructTy_struct_rs_allocation);
- Constant* const_ptr_13 = ConstantExpr::getCast(Instruction::BitCast, gvar_struct_inAllocation, PointerTy_5);
- ConstantInt* const_int32_14 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
- ConstantFP* const_float_15 = ConstantFP::get(mod->getContext(), APFloat(2.990000e-01f));
- ConstantInt* const_int32_16 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
- ConstantFP* const_float_17 = ConstantFP::get(mod->getContext(), APFloat(5.870000e-01f));
- ConstantInt* const_int32_18 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10));
- ConstantFP* const_float_19 = ConstantFP::get(mod->getContext(), APFloat(1.140000e-01f));
- UndefValue* const_packed_20 = UndefValue::get(VectorTy_2);
- std::vector<Constant*> const_packed_21_elems;
- const_packed_21_elems.push_back(const_int32_14);
- const_packed_21_elems.push_back(const_int32_16);
- const_packed_21_elems.push_back(const_int32_18);
- ConstantInt* const_int32_22 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("7"), 10));
- const_packed_21_elems.push_back(const_int32_22);
- Constant* const_packed_21 = ConstantVector::get(VectorTy_8, const_packed_21_elems);
- // Global Variable Definitions
- gvar_struct_inAllocation->setInitializer(const_struct_12);
- // Function Definitions
- // Function: convertRGBAToGray (func_convertRGBAToGray)
- {
- Function::arg_iterator args = func_convertRGBAToGray->arg_begin();
- Value* int32_x = args++;
- int32_x->setName("x");
- Value* int32_y = args++;
- int32_y->setName("y");
- BasicBlock* label_23 = BasicBlock::Create(mod->getContext(), "",func_convertRGBAToGray,0);
- // Block (label_23)
- LoadInst* array_24 = new LoadInst(const_ptr_13, "", false, label_23);
- array_24->setAlignment(4);
- std::vector<Value*> packed_25_params;
- packed_25_params.push_back(array_24);
- packed_25_params.push_back(int32_x);
- packed_25_params.push_back(int32_y);
- CallInst* packed_25 = CallInst::Create(func__Z21rsGetElementAt_uchar413rs_allocationjj, packed_25_params, "", label_23);
- packed_25->setCallingConv(CallingConv::C);
- packed_25->setTailCall(true);
- AttributeSet packed_25_PAL;
- {
- SmallVector<AttributeSet, 4> Attrs;
- AttributeSet PAS;
- {
- AttrBuilder B;
- B.addAttribute(Attribute::NoUnwind);
- PAS = AttributeSet::get(mod->getContext(), ~0U, B);
- }
- Attrs.push_back(PAS);
- packed_25_PAL = AttributeSet::get(mod->getContext(), Attrs);
- }
- packed_25->setAttributes(packed_25_PAL);
- ExtractElementInst* int8_26 = new ExtractElementInst(packed_25, const_int32_14, "", label_23);
- CastInst* float_27 = new UIToFPInst(int8_26, Type::getFloatTy(mod->getContext()), "", label_23);
- BinaryOperator* float_28 = BinaryOperator::Create(Instruction::FMul, float_27, const_float_15, "", label_23);
- ExtractElementInst* int8_29 = new ExtractElementInst(packed_25, const_int32_16, "", label_23);
- CastInst* float_30 = new UIToFPInst(int8_29, Type::getFloatTy(mod->getContext()), "", label_23);
- BinaryOperator* float_31 = BinaryOperator::Create(Instruction::FMul, float_30, const_float_17, "", label_23);
- BinaryOperator* float_32 = BinaryOperator::Create(Instruction::FAdd, float_28, float_31, "", label_23);
- ExtractElementInst* int8_33 = new ExtractElementInst(packed_25, const_int32_18, "", label_23);
- CastInst* float_34 = new UIToFPInst(int8_33, Type::getFloatTy(mod->getContext()), "", label_23);
- BinaryOperator* float_35 = BinaryOperator::Create(Instruction::FMul, float_34, const_float_19, "", label_23);
- BinaryOperator* float_36 = BinaryOperator::Create(Instruction::FAdd, float_35, float_32, "", label_23);
- CastInst* int8_37 = new FPToUIInst(float_36, IntegerType::get(mod->getContext(), 8), "", label_23);
- InsertElementInst* packed_38 = InsertElementInst::Create(const_packed_20, int8_37, const_int32_14, "", label_23);
- InsertElementInst* packed_39 = InsertElementInst::Create(packed_38, int8_37, const_int32_16, "", label_23);
- InsertElementInst* packed_40 = InsertElementInst::Create(packed_39, int8_37, const_int32_18, "", label_23);
- ShuffleVectorInst* packed_41 = new ShuffleVectorInst(packed_40, packed_25, const_packed_21, "", label_23);
- ReturnInst::Create(mod->getContext(), packed_41, label_23);
- }
- // Function: .rs.dtor (func__rs_dtor)
- {
- BasicBlock* label_43 = BasicBlock::Create(mod->getContext(), "",func__rs_dtor,0);
- // Block (label_43)
- CallInst* void_44 = CallInst::Create(func__Z13rsClearObjectP13rs_allocation, gvar_struct_inAllocation, "", label_43);
- void_44->setCallingConv(CallingConv::C);
- void_44->setTailCall(true);
- AttributeSet void_44_PAL;
- {
- SmallVector<AttributeSet, 4> Attrs;
- AttributeSet PAS;
- {
- AttrBuilder B;
- B.addAttribute(Attribute::NoUnwind);
- PAS = AttributeSet::get(mod->getContext(), ~0U, B);
- }
- Attrs.push_back(PAS);
- void_44_PAL = AttributeSet::get(mod->getContext(), Attrs);
- }
- void_44->setAttributes(void_44_PAL);
- ReturnInst::Create(mod->getContext(), label_43);
- }
- return mod;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement