MCPcopy Create free account
hub / github.com/csmith-project/csmith / CreateFunctionInvocationBinary

Method CreateFunctionInvocationBinary

src/FunctionInvocationBinary.cpp:54–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52///////////////////////////////////////////////////////////////////////////////
53
54FunctionInvocationBinary *
55FunctionInvocationBinary::CreateFunctionInvocationBinary(CGContext &cg_context,
56 eBinaryOps op,
57 SafeOpFlags *flags)
58{
59 FunctionInvocationBinary *fi = NULL;
60 assert(flags);
61
62 if (flags && FunctionInvocationBinary::safe_ops(op)) {
63 bool op1 = flags->get_op1_sign();
64 bool op2 = flags->get_op2_sign();
65 enum SafeOpSize size = flags->get_op_size();
66
67 eSimpleType type1 = SafeOpFlags::flags_to_type(op1, size);
68 eSimpleType type2 = SafeOpFlags::flags_to_type(op2, size);
69
70 const Block *blk = cg_context.get_current_block();
71 assert(blk);
72
73 std::string tmp_var1 = blk->create_new_tmp_var(type1);
74 std::string tmp_var2;
75 if (op == eLShift || op == eRShift)
76 tmp_var2 = blk->create_new_tmp_var(type2);
77 else
78 tmp_var2 = blk->create_new_tmp_var(type1);
79
80 fi = new FunctionInvocationBinary(op, flags, tmp_var1, tmp_var2);
81 }
82 else {
83 fi = new FunctionInvocationBinary(op, flags);
84 }
85 return fi;
86}
87
88
89/*

Callers

nothing calls this directly

Calls 5

get_op1_signMethod · 0.80
get_op2_signMethod · 0.80
get_op_sizeMethod · 0.80
get_current_blockMethod · 0.80
create_new_tmp_varMethod · 0.80

Tested by

no test coverage detected