Beispiel #1
0
void code_pool::load_constant(reg_t target_reg, uint32_t constant, AG_COND cond)
{
   // TODO: Needs to be properly implemented

   literals[literal_count][0] = next_instruction;
   literals[literal_count][1] = constant;
   literal_count++;
   insert_raw_instruction(0xe5900000 | (( 15 << 16 )|( target_reg << 12 )) ); // ldr target_reg, [pc, #TBD]
}
Beispiel #2
0
void code_pool::insert_constants(){

   for(int i = 0; i < literal_count; i++){

      uint32_t ins = literals[i][0];
      RW_INIT();
      instructions[ins] |= (next_instruction - ins - 2) * 4; // The PC points to an instruction 8 bytes ahead
      RW_END();
      insert_raw_instruction( literals[i][1] );
   }

   literal_count = 0;

}
Beispiel #3
0
// Code Gen: Generic
void code_pool::insert_instruction(uint32_t op, AG_COND cond)
{
   assert(cond < CONDINVALID);
   insert_raw_instruction((op & 0x0FFFFFFF) | (cond << 28));
}
Beispiel #4
0
void code_pool::jmp(uint32_t offset){

      insert_raw_instruction( 0xea000000 | offset );

}