1 //===- llvm/lib/Target/ARM/ARMCallLowering.h - Call lowering ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file describes how to lower LLVM calls to machine code calls.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
16 #define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
20 #include "llvm/IR/CallingConv.h"
26 class ARMTargetLowering;
27 class MachineFunction;
28 class MachineInstrBuilder;
29 class MachineIRBuilder;
32 class ARMCallLowering : public CallLowering {
34 ARMCallLowering(const ARMTargetLowering &TLI);
36 bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
37 unsigned VReg) const override;
39 bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
40 ArrayRef<unsigned> VRegs) const override;
42 bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv,
43 const MachineOperand &Callee, const ArgInfo &OrigRet,
44 ArrayRef<ArgInfo> OrigArgs) const override;
47 bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val,
48 unsigned VReg, MachineInstrBuilder &Ret) const;
50 using SplitArgTy = std::function<void(unsigned Reg, uint64_t Offset)>;
52 /// Split an argument into one or more arguments that the CC lowering can cope
53 /// with (e.g. replace pointers with integers).
54 void splitToValueTypes(const ArgInfo &OrigArg,
55 SmallVectorImpl<ArgInfo> &SplitArgs,
57 const SplitArgTy &PerformArgSplit) const;
60 } // end namespace llvm
62 #endif // LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H