llvm.org GIT mirror llvm / b586aae
MCJIT unit test: add calls to ensure that instruction caches are properly invalidated before code execution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167146 91177308-0d34-0410-b5e6-96231b3b80d8 Amara Emerson 7 years ago
1 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4646 GlobalValue *Global = insertGlobalInt32(M.get(), "test_global", initialValue);
4747 createJIT(M.take());
4848 void *globalPtr = TheJIT->getPointerToGlobal(Global);
49 static_cast(MM)->invalidateInstructionCache();
4950 EXPECT_TRUE(0 != globalPtr)
5051 << "Unable to get pointer to global value from JIT";
5152
5960 Function *F = insertAddFunction(M.get());
6061 createJIT(M.take());
6162 void *addPtr = TheJIT->getPointerToFunction(F);
63 static_cast(MM)->invalidateInstructionCache();
6264 EXPECT_TRUE(0 != addPtr)
6365 << "Unable to get pointer to function from JIT";
6466
7577 Function *Main = insertMainFunction(M.get(), 6);
7678 createJIT(M.take());
7779 void *vPtr = TheJIT->getPointerToFunction(Main);
80 static_cast(MM)->invalidateInstructionCache();
7881 EXPECT_TRUE(0 != vPtr)
7982 << "Unable to get pointer to main() from JIT";
8083
9699
97100 createJIT(M.take());
98101 void *rgvPtr = TheJIT->getPointerToFunction(ReturnGlobal);
102 static_cast(MM)->invalidateInstructionCache();
99103 EXPECT_TRUE(0 != rgvPtr);
100104
101105 int32_t(*FuncPtr)(void) = (int32_t(*)(void))(intptr_t)rgvPtr;
164168
165169 createJIT(M.take());
166170 void *vPtr = TheJIT->getPointerToFunction(Outer);
171 static_cast(MM)->invalidateInstructionCache();
167172 EXPECT_TRUE(0 != vPtr)
168173 << "Unable to get pointer to outer function from JIT";
169174