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>
12 #include "core/inst.h"
13 #include "emitter/call_lowering.h"
55 void AssignArgReg(ArgLoc &loc, llvm::MVT t, llvm::Register reg);
59 void AssignArgByVal(ArgLoc &loc, llvm::MVT t,
unsigned size, llvm::Align a);
61 void AssignRetReg(RetLoc &loc, llvm::MVT t, llvm::Register reg);
65 virtual llvm::ArrayRef<unsigned>
GetGPRs()
const = 0;
67 virtual llvm::ArrayRef<unsigned>
GetXMMs()
const = 0;
104 llvm::ArrayRef<unsigned>
GetGPRs()
const override;
106 llvm::ArrayRef<unsigned>
GetXMMs()
const override;
110 void AssignArgC(
unsigned i,
FlaggedType type)
override;
112 void AssignArgOCaml(
unsigned i,
FlaggedType type)
override;
114 void AssignArgOCamlAlloc(
unsigned i,
FlaggedType type)
override;
116 void AssignArgOCamlGc(
unsigned i,
FlaggedType type)
override;
118 void AssignArgXen(
unsigned i,
FlaggedType type)
override;
120 void AssignArgMultiboot(
unsigned i,
FlaggedType type)
override;
122 void AssignArgWin64(
unsigned i,
FlaggedType type)
override;
125 void AssignRetC(
unsigned i,
FlaggedType type)
override;
127 void AssignRetOCaml(
unsigned i,
FlaggedType type)
override;
129 void AssignRetOCamlAlloc(
unsigned i,
FlaggedType type)
override;
131 void AssignRetOCamlGc(
unsigned i,
FlaggedType type)
override;
133 void AssignRetXen(
unsigned i,
FlaggedType type)
override;
135 void AssignRetWin64(
unsigned i,
FlaggedType type)
override;
156 llvm::ArrayRef<unsigned>
GetGPRs()
const override;
158 llvm::ArrayRef<unsigned>
GetXMMs()
const override;
162 void AssignArgC(
unsigned i,
FlaggedType type)
override;
164 void AssignArgOCaml(
unsigned i,
FlaggedType type)
override;
166 void AssignArgOCamlAlloc(
unsigned i,
FlaggedType type)
override;
168 void AssignArgOCamlGc(
unsigned i,
FlaggedType type)
override;
170 void AssignArgXen(
unsigned i,
FlaggedType type)
override;
172 void AssignArgMultiboot(
unsigned i,
FlaggedType type)
override;
174 void AssignArgWin64(
unsigned i,
FlaggedType type)
override;
177 void AssignRetC(
unsigned i,
FlaggedType type)
override;
179 void AssignRetOCaml(
unsigned i,
FlaggedType type)
override;
181 void AssignRetOCamlAlloc(
unsigned i,
FlaggedType type)
override;
183 void AssignRetOCamlGc(
unsigned i,
FlaggedType type)
override;
185 void AssignRetXen(
unsigned i,
FlaggedType type)
override;
187 void AssignRetWin64(
unsigned i,
FlaggedType type)
override;
X86Call(const CallSite *inst)
Analyses a call site.
Definition: x86call.h:30
X86Call(const ReturnInst *inst)
Analyses a return site.
Definition: x86call.h:32
unsigned argXMMs_
Number of arguments in vector registers.
Definition: x86call.h:73
void AnalyseFunc(const Func *func)
Analyse a function.
Definition: call_lowering.cpp:64
X86_64Call(const LandingPadInst *inst)
Analyses a landing pad.
Definition: x86call.h:152
X86_32Call(const LandingPadInst *inst)
Analyses a landing pad.
Definition: x86call.h:100
X86_64Call(const ReturnInst *inst)
Analyses a return site.
Definition: x86call.h:148
void AnalyseReturn(const ReturnInst *inst)
Analyse a return instruction.
Definition: call_lowering.cpp:73
X86_64Call(const CallSite *inst)
Analyses a call site.
Definition: x86call.h:146
unsigned stack_
Number of bytes allocated on the stack.
Definition: x86call.h:81
Definition: call_lowering.h:21
void AssignArgReg(ArgLoc &loc, llvm::MVT t, llvm::Register reg)
Assigns a location to a register.
Definition: x86call.cpp:187
X86_32Call(const ReturnInst *inst)
Analyses a return site.
Definition: x86call.h:96
void AnalyseRaise(const RaiseInst *inst)
Analyse a raise instruction.
Definition: call_lowering.cpp:82
X86_32Call(const Func *func)
Analyses a function for arguments.
Definition: x86call.h:92
virtual llvm::ArrayRef< unsigned > GetXMMs() const =0
Returns the list of XMM registers.
X86Call(const Func *func)
Analyses a function for arguments.
Definition: x86call.h:28
llvm::ArrayRef< unsigned > GetUnusedXMMs() const
Returns unused XMMs.
Definition: x86call.cpp:175
llvm::ArrayRef< unsigned > GetUsedXMMs() const
Returns the used XMMs.
Definition: x86call.cpp:181
void AnalyseCall(const CallSite *call)
Analyse a call.
Definition: call_lowering.cpp:48
unsigned retRegs_
Number of returns in regular registers.
Definition: x86call.h:75
X86_32Call(const CallSite *inst)
Analyses a call site.
Definition: x86call.h:94
X86_64Call(const Func *func)
Analyses a function for arguments.
Definition: x86call.h:144
llvm::ArrayRef< unsigned > GetXMMs() const override
Returns the list of XMM registers.
Definition: x86call.cpp:357
void AssignArgStack(ArgLoc &loc, llvm::MVT t, unsigned size)
Assigns a location to the stack.
Definition: x86call.cpp:193
Definition: x86call.h:141
unsigned GetFrameSize() const override
Returns the number of bytes allocated on the stack.
Definition: x86call.h:39
virtual llvm::ArrayRef< unsigned > GetGPRs() const =0
Returns the list of GPR registers.
X86_32Call(const RaiseInst *inst)
Analyses a raise site.
Definition: x86call.h:98
void AssignArgByVal(ArgLoc &loc, llvm::MVT t, unsigned size, llvm::Align a)
Assigns a location to the stack.
Definition: x86call.cpp:201
llvm::ArrayRef< unsigned > GetGPRs() const override
Returns the list of GPR registers.
Definition: x86call.cpp:351
void AnalysePad(const LandingPadInst *inst)
Analyse a landing pad instruction.
Definition: call_lowering.cpp:91
llvm::ArrayRef< unsigned > GetXMMs() const override
Returns the list of XMM registers.
Definition: x86call.cpp:852
X86Call(const RaiseInst *inst)
Analyses a raise site.
Definition: x86call.h:34
X86_64Call(const RaiseInst *inst)
Analyses a raise site.
Definition: x86call.h:150
void AssignRetReg(RetLoc &loc, llvm::MVT t, llvm::Register reg)
Assigns a location to a register.
Definition: x86call.cpp:214
unsigned retXMMs_
Number of returns in vector registers.
Definition: x86call.h:77
unsigned argRegs_
Number of arguments in regular registers.
Definition: x86call.h:71
llvm::ArrayRef< unsigned > GetUnusedGPRs() const
Returns unused GPRs.
Definition: x86call.cpp:163
llvm::ArrayRef< unsigned > GetGPRs() const override
Returns the list of GPR registers.
Definition: x86call.cpp:823
X86Call(const LandingPadInst *inst)
Analyses a landing pad.
Definition: x86call.h:36
llvm::Align maxAlign_
Maximum alignment on the stack.
Definition: x86call.h:83
llvm::ArrayRef< unsigned > GetUsedGPRs() const
Returns the used GPRs.
Definition: x86call.cpp:169
unsigned retFPs_
Number of returns in floating point registers.
Definition: x86call.h:79