@@ -39,19 +39,16 @@ bool linkModules(llvm::Module *composite,
3939 std::vector<std::unique_ptr<llvm::Module>> &modules,
4040 const unsigned Flags, std::string &errorMsg);
4141
42- #if defined(__x86_64__) || defined(__i386__)
43- #define addFunctionReplacement (from, to ) \
44- {#from " f" , #to " f" }, {#from " " , #to " " }, { " " #from " l" , #to " l" }
42+ void replaceOrRenameFunction (llvm::Module *module , const char *old_name,
43+ const char *new_name);
4544
45+ #if defined(__x86_64__) || defined(__i386__)
4646#define addIntrinsicReplacement (from, to ) \
4747 {" llvm." #from " .f32" , #to " f" }, {" llvm." #from " .f64" , #to}, { \
4848 " llvm." #from " .f80" , #to " l" \
4949 }
5050
5151#else
52- #define addFunctionReplacement (from, to ) \
53- {#from " f" , #to " f" }, { " " #from, " " #to }
54-
5552#define addIntrinsicReplacement (from, to ) \
5653 {" llvm." #from " .f32" , #to " f" }, { " llvm." #from " .f64" , #to }
5754
@@ -62,33 +59,15 @@ bool linkModules(llvm::Module *composite,
6259// / implementations in runtime/klee-fp, but not explicitly replaced here. Should
6360// / we rename them and complete the list?
6461const std::vector<std::pair<std::string, std::string>> floatReplacements = {
65- addFunctionReplacement (__isnan, klee_internal_isnan),
66- addFunctionReplacement (isnan, klee_internal_isnan),
67- addFunctionReplacement (__isinf, klee_internal_isinf),
68- addFunctionReplacement (isinf, klee_internal_isinf),
69- addFunctionReplacement (__fpclassify, klee_internal_fpclassify),
70- addFunctionReplacement (fpclassify, klee_internal_fpclassify),
71- addFunctionReplacement (__finite, klee_internal_finite),
72- addFunctionReplacement (finite, klee_internal_finite),
73- addFunctionReplacement (sqrt, klee_internal_sqrt),
74- addFunctionReplacement (fabs, klee_internal_fabs),
75- addFunctionReplacement (rint, klee_internal_rint),
76- addFunctionReplacement (round, klee_internal_rint),
77- addFunctionReplacement (__signbit, klee_internal_signbit),
78- addIntrinsicReplacement (sqrt, klee_internal_sqrt),
79- addIntrinsicReplacement (rint, klee_internal_rint),
80- addIntrinsicReplacement (round, klee_internal_rint),
62+ addIntrinsicReplacement (sqrt, sqrt),
63+ addIntrinsicReplacement (rint, rint),
64+ addIntrinsicReplacement (round, rint),
8165 addIntrinsicReplacement (nearbyint, nearbyint),
8266 addIntrinsicReplacement (copysign, copysign),
83- addIntrinsicReplacement (floor, klee_floor ),
67+ addIntrinsicReplacement (floor, floor ),
8468 addIntrinsicReplacement (ceil, ceil)};
85- #undef addFunctionReplacement
8669#undef addIntrinsicReplacement
8770
88- const std::vector<std::pair<std::string, std::string>> feRoundReplacements{
89- {" fegetround" , " klee_internal_fegetround" },
90- {" fesetround" , " klee_internal_fesetround" }};
91-
9271// / Return the Function* target of a Call or Invoke instruction, or
9372// / null if it cannot be determined (should be only for indirect
9473// / calls, although complicated constant expressions might be
0 commit comments