• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef LIBLLVMBACKEND_TRANSFORMS_RUNTIME_CALLS_H
17 #define LIBLLVMBACKEND_TRANSFORMS_RUNTIME_CALLS_H
18 
19 #include <llvm/IR/Function.h>
20 #include <llvm/IR/Instructions.h>
21 #include <llvm/IR/IRBuilder.h>
22 
23 namespace panda::llvmbackend {
24 
25 class LLVMArkInterface;
26 
27 }  // namespace panda::llvmbackend
28 
29 namespace panda::llvmbackend::runtime_calls {
30 
31 llvm::Value *GetAddressToTLS(llvm::IRBuilder<> *builder, LLVMArkInterface *arkInterface, uintptr_t tlsOffset);
32 llvm::Value *LoadTLSValue(llvm::IRBuilder<> *builder, LLVMArkInterface *arkInterface, uintptr_t tlsOffset,
33                           llvm::Type *type);
34 
35 using EntrypointId = int;
36 llvm::CallInst *CreateEntrypointCallCommon(llvm::IRBuilder<> *builder, llvm::Value *threadRegValue,
37                                            LLVMArkInterface *arkInterface, EntrypointId eid,
38                                            llvm::ArrayRef<llvm::Value *> arguments = llvm::None);
39 
40 llvm::Value *GetThreadRegValue(llvm::IRBuilder<> *builder, LLVMArkInterface *arkInterface);
41 llvm::Value *GetRealFrameRegValue(llvm::IRBuilder<> *builder, LLVMArkInterface *arkInterface);
42 
43 }  // namespace panda::llvmbackend::runtime_calls
44 
45 #endif  // LIBLLVMBACKEND_TRANSFORMS_RUNTIME_CALLS_H
46