OpenASIP 2.2
Loading...
Searching...
No Matches
TCEFrameInfo.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file TCEFrameInfo.hh
26 *
27 * Declaration of TCEFrameLowering class.
28 *
29 * @author Heikki Kultala 2010 (hkultala-no.spam-cs.tut.fi)
30 */
31
32#ifndef TCE_FRAME_INFO_H
33#define TCE_FRAME_INFO_H
34
35#include "tce_config.h"
36
37#include <llvm/Support/ErrorHandling.h>
38#include <llvm/CodeGen/TargetFrameLowering.h>
39#include "TCERegisterInfo.hh"
40#include "TCEInstrInfo.hh"
41
42namespace llvm {
43
44 /** !! Important !! *************
45 * ON EVERY LLVM UPDATE CHECK THESE INTERFACES VERY CAREFULLY
46 * FROM include/llvm/Target/TargetFrameInfo.h
47 *
48 * Compiler doesn warn or give error if parameter lists are changed.
49 * Many times also base class implementation works, but does not do
50 * very good job.
51 */
52
53// Frame info:
54// -------------
55// Grows down, alignment at least 4 bytes. The alignment is set according to
56// the widest operand in the machine.
57//
58
59
60 class TCEFrameLowering : public TargetFrameLowering {
61 public:
62
63 /** !! Important !! *************
64 * If the last boolean parameter of the constructor is set to false,
65 * stack realignment is not allowed. This means, that every stack object
66 * having a bigger alignment than the stack's own alignment, will be
67 * reduced to have the stack's alignment.
68 *
69 * For example, if stack realignment parameter is set to false, and
70 * stack has alignment of 4, and v4i32 vector has alignment of 16
71 * (bytes) -> vector's alignment in stack will be demoted to 4.
72 */
74 TCERegisterInfo* tri,
75 const TCEInstrInfo* tii,
76 int stackAlignment) :
77 // The -stackAlignment is local area offset.
78 // Storing RA to stack consumes one slot,
79 // so local are offset begins below it.
80 TargetFrameLowering(
81 StackGrowsDown, Align(stackAlignment), -stackAlignment),
83 tri->setTFI(this);
84 }
85
86 MachineBasicBlock::iterator
88 MachineFunction &MF,
89 MachineBasicBlock &MBB,
90 MachineBasicBlock::iterator I) const override;
91
92 void emitPrologue(MachineFunction &mf, MachineBasicBlock &MBB) const override;
93 void emitEpilogue(MachineFunction &mf, MachineBasicBlock &MBB) const override;
94 bool hasFP(const MachineFunction &MF) const override;
95 int stackAlignment() const { return stackAlignment_; }
96 bool containsCall(const MachineFunction& mf) const;
97 private:
101 };
102} // /namespace
103
104#endif
TCEFrameLowering(TCERegisterInfo *tri, const TCEInstrInfo *tii, int stackAlignment)
void emitEpilogue(MachineFunction &mf, MachineBasicBlock &MBB) const override
bool hasFP(const MachineFunction &MF) const override
bool containsCall(const MachineFunction &mf) const
const TCEInstrInfo & tii_
void emitPrologue(MachineFunction &mf, MachineBasicBlock &MBB) const override
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
const TCERegisterInfo * tri_
void setTFI(const TCEFrameLowering *tfi)