46 #define DEBUG_NAME "compiler2/CodeGen"
56 Option<bool> CodeGenPass::print_code(
"PrintCodeSegment",
"compiler2: print code segment",
false,::
cacao::option::xx_root());
57 Option<bool> CodeGenPass::print_data(
"PrintDataSegment",
"compiler2: print data segment",
false,::
cacao::option::xx_root());
68 std::size_t bb_start = 0;
76 std::size_t start = CS.
size();
77 LOG2(
"MInst: " << MI <<
" emitted instruction:" <<
nl);
79 std::size_t end = CS.
size();
80 #if defined(ENABLE_STATISTICS)
81 if (MI->
is_move() && start != end) {
90 while(start != end--) {
91 tmp.push_back(CS.
at(end));
93 #if defined(ENABLE_DISASSEMBLER)
94 disassemble(&tmp.front(), &tmp.front() + tmp.size());
101 std::size_t bb_end = CS.
size();
102 bbmap[MBB] = bb_end - bb_start;
108 bbmap[MBB] = CS.
size() - bb_start;
117 BasicBlockMap::const_iterator
i = bbmap.find(MBB);
118 if (i == bbmap.end())
125 #ifdef ENABLE_LOGGING
126 void print_hex(
OStream &
OS,
u1 *start,
u1 *end, uint32_t num_bytes_per_line = 8) {
128 for(
u1 *ptr = start, *
e = end; ptr <
e; ++ptr) {
129 if ( (ptr - start) % num_bytes_per_line == 0) {
130 OS <<
nl <<
"0x" <<
setz(16) << (
u8) ptr <<
": ";
132 OS <<
setz(2) << *ptr <<
' ';
171 s4 alignedlen = alignedmcodelen + aligneddseglen;
196 for (CodeMemory::const_data_iterator
i = JD.
get_CodeMemory()->data_begin(),
198 u1* ptr = epoint - offset++;
201 <<
": " << hex << *
i <<
" " << *ptr <<
dec <<
nl);
202 assert(ptr >= code->
mcode);
210 for(
u8 *ptr = reinterpret_cast<u8*>(code->
mcode),
211 *e = reinterpret_cast<u8*>(code->
entrypoint); ptr < e; ++ptr) {
247 #if defined(HAS_ADDRESS_REGISTER_FILE)
248 code->savedadrcount = ADR_SAV_CNT - rd->savadrreguse;
276 #if defined(ENABLE_REPLACEMENT)
282 rp = code->rplpoints;
283 for (i=0; i<code->rplpointcount; ++
i, ++rp) {
294 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
298 dseg_resolve_datareferences(jd);
306 #ifdef ENABLE_LOGGING
326 char CodeGenPass::ID = 0;
#define STATISTICS(x)
Wrapper for statistics only code.
reverse_iterator rbegin()
returns an reverse_iterator to the beginning
std::reverse_iterator< const_iterator > const_reverse_iterator
reverse_iterator rend()
returns an reverse_iterator to the end
Linenumber table of a Java method.
virtual void emit(CodeMemory *CM) const
emit machine code
A basic block of (scheduled) machine instructions.
u1 at(std::size_t i) const
get content
MachineInstructionSchedulingPass TODO: more info.
StackSlotManager * get_StackSlotManager()
void patcher_resolve(codeinfo *code)
Resolve all patchers in the current JIT run.
std::size_t size() const
get size
#define DEBUG_COND_N(VERBOSE)
jitdata * get_jitdata() const
void md_cacheflush(u1 *addr, s4 nbytes)
const CodeSegment & get_CodeSegment() const
get CodeSegment
void(* functionptr)(void)
void reverse()
reverse content
Instruction::InstID tmp[]
void patcher_list_show(codeinfo *code)
Show the content of the whole patcher reference list for debugging purposes.
CodeMemory * get_CodeMemory()
std::vector< T, Allocator< T > > type
Stores the interdependencies of a pass.
Simple stream class for formatted output.
Container::const_reverse_iterator const_reverse_iterator
void dseg_finish(jitdata *jd)
virtual void create_frame(CodeMemory *CM, StackSlotManager *SSM) const =0
virtual bool is_move() const
Proxy to encode explicit and implicit successors.
void exceptiontable_create(jitdata *jd)
int32_t synchronizedoffset
LinenumberTable * linenumbertable
reverse_iterator rbegin()
returns an reverse_iterator to the beginning
#define MEMORY_ALIGN(pos, size)
void methodtree_insert(void *startpc, void *endpc)
void disassemble(u1 *start, u1 *end)
reverse_iterator rend()
returns an reverse_iterator to the end
u1 * get_start()
get start address
#define MCOPY(dest, src, type, num)
static PassRegistry< BasicBlockSchedulingPass > X("BasicBlockSchedulingPass")
static SetZero setz(size_t w)
#define STAT_DECLARE_VAR(type, var, init)
Declare an external statistics variable.
OStream & dbg()
The default destination for logging messages.
void add_requires()
PassName is required.
const DataSegment & get_DataSegment() const
get DataSegment