MCPcopy Create free account
hub / github.com/GANGE666/xVMP / getDecodedBinaryOpcode

Function getDecodedBinaryOpcode

src/lib/Bitcode/Reader/BitcodeReader.cpp:986–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

984}
985
986static int getDecodedBinaryOpcode(unsigned Val, Type *Ty) {
987 bool IsFP = Ty->isFPOrFPVectorTy();
988 // BinOps are only valid for int/fp or vector of int/fp types
989 if (!IsFP && !Ty->isIntOrIntVectorTy())
990 return -1;
991
992 switch (Val) {
993 default:
994 return -1;
995 case bitc::BINOP_ADD:
996 return IsFP ? Instruction::FAdd : Instruction::Add;
997 case bitc::BINOP_SUB:
998 return IsFP ? Instruction::FSub : Instruction::Sub;
999 case bitc::BINOP_MUL:
1000 return IsFP ? Instruction::FMul : Instruction::Mul;
1001 case bitc::BINOP_UDIV:
1002 return IsFP ? -1 : Instruction::UDiv;
1003 case bitc::BINOP_SDIV:
1004 return IsFP ? Instruction::FDiv : Instruction::SDiv;
1005 case bitc::BINOP_UREM:
1006 return IsFP ? -1 : Instruction::URem;
1007 case bitc::BINOP_SREM:
1008 return IsFP ? Instruction::FRem : Instruction::SRem;
1009 case bitc::BINOP_SHL:
1010 return IsFP ? -1 : Instruction::Shl;
1011 case bitc::BINOP_LSHR:
1012 return IsFP ? -1 : Instruction::LShr;
1013 case bitc::BINOP_ASHR:
1014 return IsFP ? -1 : Instruction::AShr;
1015 case bitc::BINOP_AND:
1016 return IsFP ? -1 : Instruction::And;
1017 case bitc::BINOP_OR:
1018 return IsFP ? -1 : Instruction::Or;
1019 case bitc::BINOP_XOR:
1020 return IsFP ? -1 : Instruction::Xor;
1021 }
1022}
1023
1024static AtomicRMWInst::BinOp getDecodedRMWOperation(unsigned Val) {
1025 switch (Val) {

Callers 2

parseConstantsMethod · 0.85
parseFunctionBodyMethod · 0.85

Calls 2

isFPOrFPVectorTyMethod · 0.80
isIntOrIntVectorTyMethod · 0.80

Tested by

no test coverage detected