blob: 2bcd526d8fde0edb12241a378bd48776af99752f [file] [log] [blame]
Andrew Lenharthaa38ce42005-09-02 18:46:02 +00001//===-- AlphaISelLowering.h - Alpha DAG Lowering Interface ------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Andrew Lenharth 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 Alpha uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H
16#define LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H
17
18#include "llvm/Target/TargetLowering.h"
19#include "llvm/CodeGen/SelectionDAG.h"
20#include "Alpha.h"
21
22namespace llvm {
23
Andrew Lenharth4907d222005-10-20 00:28:31 +000024 namespace AlphaISD {
25 enum NodeType {
26 // Start the numbering where the builting ops and target ops leave off.
27 FIRST_NUMBER = ISD::BUILTIN_OP_END+Alpha::INSTRUCTION_LIST_END,
28 };
29 }
30
Andrew Lenharthaa38ce42005-09-02 18:46:02 +000031 class AlphaTargetLowering : public TargetLowering {
32 int VarArgsOffset; // What is the offset to the first vaarg
33 int VarArgsBase; // What is the base FrameIndex
34 unsigned GP; //GOT vreg
35 unsigned RA; //Return Address
36 public:
37 AlphaTargetLowering(TargetMachine &TM);
38
39 /// LowerArguments - This hook must be implemented to indicate how we should
40 /// lower the arguments for the specified function, into the specified DAG.
41 virtual std::vector<SDOperand>
42 LowerArguments(Function &F, SelectionDAG &DAG);
43
44 /// LowerCallTo - This hook lowers an abstract call to a function into an
45 /// actual call.
46 virtual std::pair<SDOperand, SDOperand>
47 LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg, unsigned CC,
48 bool isTailCall, SDOperand Callee, ArgListTy &Args,
49 SelectionDAG &DAG);
50
51 virtual SDOperand LowerVAStart(SDOperand Chain, SDOperand VAListP,
52 Value *VAListV, SelectionDAG &DAG);
53 virtual SDOperand LowerVACopy(SDOperand Chain, SDOperand SrcP, Value *SrcV,
54 SDOperand DestP, Value *DestV,
55 SelectionDAG &DAG);
56 virtual std::pair<SDOperand,SDOperand>
57 LowerVAArg(SDOperand Chain, SDOperand VAListP, Value *VAListV,
58 const Type *ArgTy, SelectionDAG &DAG);
59
60 void restoreGP(MachineBasicBlock* BB);
61 void restoreRA(MachineBasicBlock* BB);
Andrew Lenharth756fbeb2005-10-22 22:06:58 +000062 unsigned getVRegGP() { return GP; }
63 unsigned getVRegRA() { return RA; }
Andrew Lenharthaa38ce42005-09-02 18:46:02 +000064 };
65}
66
67#endif // LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H