blob: 924a672d2cce6c7104de9ec987bed2c39a12379e [file] [log] [blame]
Chris Lattner0bbea952005-08-26 20:25:03 +00001//===-- PPC32ISelLowering.h - PPC32 DAG Lowering Interface ------*- C++ -*-===//
Chris Lattner7c5a3d32005-08-16 17:14:42 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the interfaces that PPC uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
16#define LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
17
18#include "llvm/Target/TargetLowering.h"
Chris Lattner0bbea952005-08-26 20:25:03 +000019#include "llvm/CodeGen/SelectionDAG.h"
20#include "PowerPC.h"
Chris Lattner7c5a3d32005-08-16 17:14:42 +000021
22namespace llvm {
Chris Lattner0bbea952005-08-26 20:25:03 +000023 namespace PPCISD {
24 enum NodeType {
25 // Start the numbering where the builting ops and target ops leave off.
26 FIRST_NUMBER = ISD::BUILTIN_OP_END+PPC::INSTRUCTION_LIST_END,
27
28 /// FSEL - Traditional three-operand fsel node.
29 ///
30 FSEL,
Chris Lattnerf7605322005-08-31 21:09:52 +000031
32 /// FCTIWZ - The FCTIWZ instruction, taking an f32 or f64 operand,
33 /// producing an f64 value.
34 FCTIWZ,
Chris Lattner0bbea952005-08-26 20:25:03 +000035 };
36 }
37
Chris Lattner7c5a3d32005-08-16 17:14:42 +000038 class PPC32TargetLowering : public TargetLowering {
39 int VarArgsFrameIndex; // FrameIndex for start of varargs area.
40 int ReturnAddrIndex; // FrameIndex for return slot.
41 public:
42 PPC32TargetLowering(TargetMachine &TM);
43
Chris Lattnere4bc9ea2005-08-26 00:52:45 +000044 /// LowerOperation - Provide custom lowering hooks for some operations.
45 ///
46 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
47
Chris Lattner7c5a3d32005-08-16 17:14:42 +000048 /// LowerArguments - This hook must be implemented to indicate how we should
49 /// lower the arguments for the specified function, into the specified DAG.
50 virtual std::vector<SDOperand>
51 LowerArguments(Function &F, SelectionDAG &DAG);
52
53 /// LowerCallTo - This hook lowers an abstract call to a function into an
54 /// actual call.
55 virtual std::pair<SDOperand, SDOperand>
56 LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
57 unsigned CC,
58 bool isTailCall, SDOperand Callee, ArgListTy &Args,
59 SelectionDAG &DAG);
60
61 virtual SDOperand LowerVAStart(SDOperand Chain, SDOperand VAListP,
62 Value *VAListV, SelectionDAG &DAG);
63
64 virtual std::pair<SDOperand,SDOperand>
65 LowerVAArg(SDOperand Chain, SDOperand VAListP, Value *VAListV,
66 const Type *ArgTy, SelectionDAG &DAG);
67
68 virtual std::pair<SDOperand, SDOperand>
69 LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth,
70 SelectionDAG &DAG);
Chris Lattner8a2d3ca2005-08-26 21:23:58 +000071
72 virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI,
73 MachineBasicBlock *MBB);
Chris Lattner7c5a3d32005-08-16 17:14:42 +000074 };
75}
76
77#endif // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H