llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
|
9 #include <llvm/ADT/ArrayRef.h>
10 #include <llvm/ADT/iterator_range.h>
11 #include <llvm/MC/MCRegister.h>
13 #include "core/inst.h"
14 #include "core/func.h"
15 #include "emitter/call_lowering.h"
33 , numFixedArgs_(func->GetNumParams())
41 , numFixedArgs_(inst->GetNumFixedArgs().value_or(inst->arg_size()))
70 llvm::ArrayRef<llvm::MCPhysReg>
GetUsedGPRs()
const;
74 llvm::ArrayRef<llvm::MCPhysReg>
GetUsedFPRs()
const;
81 void AssignArgC(
unsigned i,
FlaggedType type)
override;
83 void AssignArgOCaml(
unsigned i,
FlaggedType type)
override;
85 void AssignArgOCamlAlloc(
unsigned i,
FlaggedType type)
override;
87 void AssignArgOCamlGc(
unsigned i,
FlaggedType type)
override;
89 void AssignArgXen(
unsigned i,
FlaggedType type)
override;
91 void AssignArgWin64(
unsigned i,
FlaggedType type)
override;
94 void AssignRetC(
unsigned i,
FlaggedType type)
override;
96 void AssignRetOCaml(
unsigned i,
FlaggedType type)
override;
98 void AssignRetOCamlAlloc(
unsigned i,
FlaggedType type)
override;
100 void AssignRetOCamlGc(
unsigned i,
FlaggedType type)
override;
102 void AssignRetXen(
unsigned i,
FlaggedType type)
override;
104 void AssignRetWin64(
unsigned i,
FlaggedType type)
override;
107 void AssignArgReg(ArgLoc &loc, llvm::MVT vt, llvm::Register reg);
109 void AssignArgStack(ArgLoc &loc, llvm::MVT type,
unsigned size);
111 void AssignRetReg(RetLoc &loc, llvm::MVT vt, llvm::Register reg);
114 llvm::ArrayRef<llvm::MCPhysReg> GetGPRs()
const;
116 llvm::ArrayRef<llvm::MCPhysReg> GetFPRs()
const;
120 unsigned numFixedArgs_ = 0;
Definition: riscvcall.h:28
RISCVCall(const LandingPadInst *inst)
Analyses a return site.
Definition: riscvcall.h:54
void AnalyseFunc(const Func *func)
Analyse a function.
Definition: call_lowering.cpp:64
void AnalyseReturn(const ReturnInst *inst)
Analyse a return instruction.
Definition: call_lowering.cpp:73
llvm::ArrayRef< llvm::MCPhysReg > GetUnusedGPRs() const
Returns unused GPRs.
Definition: riscvcall.cpp:95
Definition: call_lowering.h:21
void AnalyseRaise(const RaiseInst *inst)
Analyse a raise instruction.
Definition: call_lowering.cpp:82
unsigned GetFrameSize() const override
Returns the number of bytes allocated on the stack.
Definition: riscvcall.h:77
llvm::ArrayRef< llvm::MCPhysReg > GetUsedGPRs() const
Returns the used GPRs.
Definition: riscvcall.cpp:102
void AnalyseCall(const CallSite *call)
Analyse a call.
Definition: call_lowering.cpp:48
RISCVCall(const CallSite *inst)
Analyses a call site.
Definition: riscvcall.h:39
RISCVCall(const RaiseInst *inst)
Analyses a raise site.
Definition: riscvcall.h:61
void AnalysePad(const LandingPadInst *inst)
Analyse a landing pad instruction.
Definition: call_lowering.cpp:91
RISCVCall(const ReturnInst *inst)
Analyses a return site.
Definition: riscvcall.h:47
llvm::ArrayRef< llvm::MCPhysReg > GetUnusedFPRs() const
Returns unused FPRs.
Definition: riscvcall.cpp:109
RISCVCall(const Func *func)
Analyses a function for arguments.
Definition: riscvcall.h:31
llvm::ArrayRef< llvm::MCPhysReg > GetUsedFPRs() const
Returns the used FPRs.
Definition: riscvcall.cpp:116