summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGSystemRuntime.h
blob: c3a53f496928aa3081d05c177b832594d1e6cfee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===----- CGSystemRuntime.h - Interface to System specific Runtimes ------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This provides an abstract class for system specific runtime calls.
//
//===----------------------------------------------------------------------===//

#ifndef FLANG_CODEGEN_SYSTEMRUNTIME_H
#define FLANG_CODEGEN_SYSTEMRUNTIME_H

#include "flang/AST/Stmt.h"

namespace llvm {
class Value;
class Type;
}

namespace flang {
namespace CodeGen {

class CodeGenFunction;
class CodeGenModule;

class CGSystemRuntime {
protected:
  CodeGenModule &CGM;

public:
  CGSystemRuntime(CodeGenModule &cgm) : CGM(cgm) {}
  virtual ~CGSystemRuntime();

  virtual void EmitInit(CodeGenFunction &CGF) = 0;

  virtual llvm::Value *EmitMalloc(CodeGenFunction &CGF, llvm::Value *Size) = 0;
  llvm::Value *EmitMalloc(CodeGenFunction &CGF, llvm::Type *T, llvm::Value *Size);
  virtual void EmitFree(CodeGenFunction &CGF, llvm::Value *Ptr) = 0;

  virtual llvm::Value *EmitETIME(CodeGenFunction &CGF, ArrayRef<Expr*> Arguments) = 0;
};

/// Creates an instance of a Libflang System runtime class.
CGSystemRuntime *CreateLibflangSystemRuntime(CodeGenModule &CGM);

}
}  // end namespace flang

#endif