OpenASIP 2.2
Loading...
Searching...
No Matches
InstructionBitVector.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 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 InstructionBitVector.hh
26 *
27 * Declaration of InstructionBitVector class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_INSTRUCTION_BIT_VECTOR_HH
34#define TTA_INSTRUCTION_BIT_VECTOR_HH
35
36#include <set>
37#include <map>
38
39#include "BitVector.hh"
40#include "Exception.hh"
41#include "IndexBound.hh"
42
43namespace TTAProgram {
44 class Instruction;
45}
46
47/**
48 * A bit vector class that provides instruction relocation capabilities.
49 */
51public:
54 virtual ~InstructionBitVector();
55
56 void pushBack(const InstructionBitVector& bits);
57 void pushBack(const BitVector& bits);
59 unsigned int firstIndex, unsigned int lastIndex) const;
60
62 const TTAProgram::Instruction& instruction);
64
66 const TTAProgram::Instruction& instruction, unsigned int address);
67
68 void markInstructionStartingPoint(unsigned int position);
69 unsigned int instructionCount() const;
70 unsigned int instructionStartingPoint(unsigned int index) const;
71
72private:
73 /// A vector type that stores index bounds.
74 typedef std::vector<IndexBound> IndexBoundTable;
75 /// A set type that stores IndexBoundTables.
76 typedef std::set<IndexBoundTable*> IndexBoundSet;
77 /// A map type that maps Instructions to IndexBoundSets.
78 typedef std::map<const TTAProgram::Instruction*, IndexBoundSet*>
80 /// A vector type that stores instruction boundaries.
81 typedef std::vector<unsigned int> BoundaryTable;
82 /// A map type for instruction addresses.
83 typedef std::map<const TTAProgram::Instruction*, unsigned int>
85
87 const TTAProgram::Instruction& instruction);
88 void addIndexBoundTables(const IndexBoundSet& from, IndexBoundSet& to);
89 void fixBits(const IndexBoundTable& indexes, unsigned int value);
90 static unsigned int availableSize(const IndexBoundTable& indexes);
91
92 /// Contains information of the parts of the bit vector that refer to
93 /// an instruction address.
95 /// IndexBoundTable being under construction.
97 /// Stores the instruction boundaries.
99 /// Addresses of the instructions.
101};
102
103#endif
104
105
void markInstructionStartingPoint(unsigned int position)
void addIndexBoundTables(const IndexBoundSet &from, IndexBoundSet &to)
static unsigned int availableSize(const IndexBoundTable &indexes)
InstructionAddressTable instructionAddresses_
Addresses of the instructions.
void startSettingInstructionReference(const TTAProgram::Instruction &instruction)
unsigned int instructionCount() const
void fixBits(const IndexBoundTable &indexes, unsigned int value)
std::vector< unsigned int > BoundaryTable
A vector type that stores instruction boundaries.
IndexBoundSet & indexBounds(const TTAProgram::Instruction &instruction)
unsigned int instructionStartingPoint(unsigned int index) const
IndexBoundTable * currentTable_
IndexBoundTable being under construction.
void pushBack(const InstructionBitVector &bits)
BoundaryTable instructionBoundaries_
Stores the instruction boundaries.
void fixInstructionAddress(const TTAProgram::Instruction &instruction, unsigned int address)
std::map< const TTAProgram::Instruction *, unsigned int > InstructionAddressTable
A map type for instruction addresses.
std::set< IndexBoundTable * > IndexBoundSet
A set type that stores IndexBoundTables.
std::map< const TTAProgram::Instruction *, IndexBoundSet * > ReferenceMap
A map type that maps Instructions to IndexBoundSets.
InstructionBitVector * subVector(unsigned int firstIndex, unsigned int lastIndex) const
void addIndexBoundsForReference(IndexBound bounds)
ReferenceMap references_
Contains information of the parts of the bit vector that refer to an instruction address.
std::vector< IndexBound > IndexBoundTable
A vector type that stores index bounds.