mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
begin merging target assembler multimethod code
This commit is contained in:
parent
82eec28856
commit
4d38873096
@ -21,6 +21,7 @@
|
||||
#include "encode.h"
|
||||
#include "operations.h"
|
||||
#include "registers.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
#include "alloc-vector.h"
|
||||
#include <avian/util/abort.h>
|
||||
@ -769,7 +770,7 @@ class MyAssembler: public Assembler {
|
||||
|
||||
virtual void apply(lir::UnaryOperation op, OperandInfo a)
|
||||
{
|
||||
arch_->con.unaryOperations[index(&(arch_->con), op, a.type)]
|
||||
arch_->con.unaryOperations[Multimethod::index(op, a.type)]
|
||||
(&con, a.size, a.operand);
|
||||
}
|
||||
|
||||
|
@ -9,20 +9,17 @@
|
||||
details. */
|
||||
|
||||
#include "context.h"
|
||||
#include "multimethod.h"
|
||||
#include "operations.h"
|
||||
|
||||
#include "multimethod.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
namespace arm {
|
||||
|
||||
using namespace util;
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand)
|
||||
{
|
||||
return operation + (lir::UnaryOperationCount * operand);
|
||||
}
|
||||
|
||||
unsigned index(ArchitectureContext*,
|
||||
lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
@ -66,25 +63,25 @@ void populateTables(ArchitectureContext* con) {
|
||||
zo[lir::StoreLoadBarrier] = memoryBarrier;
|
||||
zo[lir::Trap] = trap;
|
||||
|
||||
uo[index(con, lir::LongCall, C)] = CAST1(longCallC);
|
||||
uo[Multimethod::index(lir::LongCall, C)] = CAST1(longCallC);
|
||||
|
||||
uo[index(con, lir::AlignedLongCall, C)] = CAST1(longCallC);
|
||||
uo[Multimethod::index(lir::AlignedLongCall, C)] = CAST1(longCallC);
|
||||
|
||||
uo[index(con, lir::LongJump, C)] = CAST1(longJumpC);
|
||||
uo[Multimethod::index(lir::LongJump, C)] = CAST1(longJumpC);
|
||||
|
||||
uo[index(con, lir::AlignedLongJump, C)] = CAST1(longJumpC);
|
||||
uo[Multimethod::index(lir::AlignedLongJump, C)] = CAST1(longJumpC);
|
||||
|
||||
uo[index(con, lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[index(con, lir::Jump, C)] = CAST1(jumpC);
|
||||
uo[Multimethod::index(lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[Multimethod::index(lir::Jump, C)] = CAST1(jumpC);
|
||||
|
||||
uo[index(con, lir::AlignedJump, R)] = CAST1(jumpR);
|
||||
uo[index(con, lir::AlignedJump, C)] = CAST1(jumpC);
|
||||
uo[Multimethod::index(lir::AlignedJump, R)] = CAST1(jumpR);
|
||||
uo[Multimethod::index(lir::AlignedJump, C)] = CAST1(jumpC);
|
||||
|
||||
uo[index(con, lir::Call, C)] = CAST1(callC);
|
||||
uo[index(con, lir::Call, R)] = CAST1(callR);
|
||||
uo[Multimethod::index(lir::Call, C)] = CAST1(callC);
|
||||
uo[Multimethod::index(lir::Call, R)] = CAST1(callR);
|
||||
|
||||
uo[index(con, lir::AlignedCall, C)] = CAST1(callC);
|
||||
uo[index(con, lir::AlignedCall, R)] = CAST1(callR);
|
||||
uo[Multimethod::index(lir::AlignedCall, C)] = CAST1(callC);
|
||||
uo[Multimethod::index(lir::AlignedCall, R)] = CAST1(callR);
|
||||
|
||||
bo[index(con, lir::Move, R, R)] = CAST2(moveRR);
|
||||
bo[index(con, lir::Move, C, R)] = CAST2(moveCR);
|
||||
|
@ -23,8 +23,6 @@ namespace avian {
|
||||
namespace codegen {
|
||||
namespace arm {
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand);
|
||||
|
||||
unsigned index(ArchitectureContext*,
|
||||
lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
|
29
src/codegen/target/multimethod.h
Normal file
29
src/codegen/target/multimethod.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* Copyright (c) 2008-2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#ifndef AVIAN_CODEGEN_TARGET_MULTIMETHOD_H
|
||||
#define AVIAN_CODEGEN_TARGET_MULTIMETHOD_H
|
||||
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
class Multimethod {
|
||||
public:
|
||||
inline static unsigned index(lir::UnaryOperation operation, lir::OperandType operand) {
|
||||
return operation + (lir::UnaryOperationCount * operand);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
||||
|
||||
#endif // AVIAN_CODEGEN_TARGET_MULTIMETHOD_H
|
||||
|
@ -19,8 +19,9 @@
|
||||
#include "context.h"
|
||||
#include "fixup.h"
|
||||
#include "block.h"
|
||||
#include "multimethod.h"
|
||||
#include "operations.h"
|
||||
#include "multimethod.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::util;
|
||||
@ -824,7 +825,7 @@ class MyAssembler: public Assembler {
|
||||
|
||||
virtual void apply(lir::UnaryOperation op, OperandInfo a)
|
||||
{
|
||||
arch_->c.unaryOperations[index(&(arch_->c), op, a.type)]
|
||||
arch_->c.unaryOperations[Multimethod::index(op, a.type)]
|
||||
(&c, a.size, a.operand);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,10 @@
|
||||
#include "context.h"
|
||||
#include "block.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "operations.h"
|
||||
|
||||
#include "multimethod.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
@ -21,11 +22,6 @@ namespace powerpc {
|
||||
|
||||
using namespace util;
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand)
|
||||
{
|
||||
return operation + (lir::UnaryOperationCount * operand);
|
||||
}
|
||||
|
||||
unsigned index(ArchitectureContext*,
|
||||
lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
@ -69,25 +65,25 @@ void populateTables(ArchitectureContext* c) {
|
||||
zo[lir::StoreLoadBarrier] = memoryBarrier;
|
||||
zo[lir::Trap] = trap;
|
||||
|
||||
uo[index(c, lir::LongCall, C)] = CAST1(longCallC);
|
||||
uo[Multimethod::index(lir::LongCall, C)] = CAST1(longCallC);
|
||||
|
||||
uo[index(c, lir::AlignedLongCall, C)] = CAST1(alignedLongCallC);
|
||||
uo[Multimethod::index(lir::AlignedLongCall, C)] = CAST1(alignedLongCallC);
|
||||
|
||||
uo[index(c, lir::LongJump, C)] = CAST1(longJumpC);
|
||||
uo[Multimethod::index(lir::LongJump, C)] = CAST1(longJumpC);
|
||||
|
||||
uo[index(c, lir::AlignedLongJump, C)] = CAST1(alignedLongJumpC);
|
||||
uo[Multimethod::index(lir::AlignedLongJump, C)] = CAST1(alignedLongJumpC);
|
||||
|
||||
uo[index(c, lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[index(c, lir::Jump, C)] = CAST1(jumpC);
|
||||
uo[Multimethod::index(lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[Multimethod::index(lir::Jump, C)] = CAST1(jumpC);
|
||||
|
||||
uo[index(c, lir::AlignedJump, R)] = CAST1(jumpR);
|
||||
uo[index(c, lir::AlignedJump, C)] = CAST1(jumpC);
|
||||
uo[Multimethod::index(lir::AlignedJump, R)] = CAST1(jumpR);
|
||||
uo[Multimethod::index(lir::AlignedJump, C)] = CAST1(jumpC);
|
||||
|
||||
uo[index(c, lir::Call, C)] = CAST1(callC);
|
||||
uo[index(c, lir::Call, R)] = CAST1(callR);
|
||||
uo[Multimethod::index(lir::Call, C)] = CAST1(callC);
|
||||
uo[Multimethod::index(lir::Call, R)] = CAST1(callR);
|
||||
|
||||
uo[index(c, lir::AlignedCall, C)] = CAST1(callC);
|
||||
uo[index(c, lir::AlignedCall, R)] = CAST1(callR);
|
||||
uo[Multimethod::index(lir::AlignedCall, C)] = CAST1(callC);
|
||||
uo[Multimethod::index(lir::AlignedCall, R)] = CAST1(callR);
|
||||
|
||||
bo[index(c, lir::Move, R, R)] = CAST2(moveRR);
|
||||
bo[index(c, lir::Move, C, R)] = CAST2(moveCR);
|
||||
|
@ -20,9 +20,6 @@ namespace avian {
|
||||
namespace codegen {
|
||||
namespace powerpc {
|
||||
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand);
|
||||
|
||||
unsigned index(ArchitectureContext*,
|
||||
lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "operations.h"
|
||||
#include "detect.h"
|
||||
#include "multimethod.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
@ -1043,7 +1044,7 @@ class MyAssembler: public Assembler {
|
||||
|
||||
virtual void apply(lir::UnaryOperation op, OperandInfo a)
|
||||
{
|
||||
arch_->c.unaryOperations[index(&(arch_->c), op, a.type)]
|
||||
arch_->c.unaryOperations[Multimethod::index(op, a.type)]
|
||||
(&c, a.size, a.operand);
|
||||
}
|
||||
|
||||
|
@ -15,20 +15,17 @@
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
|
||||
#include "context.h"
|
||||
#include "multimethod.h"
|
||||
#include "operations.h"
|
||||
|
||||
#include "multimethod.h"
|
||||
#include "../multimethod.h"
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
namespace x86 {
|
||||
|
||||
using namespace util;
|
||||
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand) {
|
||||
return operation + (lir::UnaryOperationCount * operand);
|
||||
}
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
lir::OperandType operand2)
|
||||
@ -74,25 +71,25 @@ void populateTables(ArchitectureContext* c) {
|
||||
zo[lir::StoreLoadBarrier] = storeLoadBarrier;
|
||||
zo[lir::Trap] = trap;
|
||||
|
||||
uo[index(c, lir::Call, C)] = CAST1(callC);
|
||||
uo[index(c, lir::Call, R)] = CAST1(callR);
|
||||
uo[index(c, lir::Call, M)] = CAST1(callM);
|
||||
uo[Multimethod::index(lir::Call, C)] = CAST1(callC);
|
||||
uo[Multimethod::index(lir::Call, R)] = CAST1(callR);
|
||||
uo[Multimethod::index(lir::Call, M)] = CAST1(callM);
|
||||
|
||||
uo[index(c, lir::AlignedCall, C)] = CAST1(alignedCallC);
|
||||
uo[Multimethod::index(lir::AlignedCall, C)] = CAST1(alignedCallC);
|
||||
|
||||
uo[index(c, lir::LongCall, C)] = CAST1(longCallC);
|
||||
uo[Multimethod::index(lir::LongCall, C)] = CAST1(longCallC);
|
||||
|
||||
uo[index(c, lir::AlignedLongCall, C)] = CAST1(alignedLongCallC);
|
||||
uo[Multimethod::index(lir::AlignedLongCall, C)] = CAST1(alignedLongCallC);
|
||||
|
||||
uo[index(c, lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[index(c, lir::Jump, C)] = CAST1(jumpC);
|
||||
uo[index(c, lir::Jump, M)] = CAST1(jumpM);
|
||||
uo[Multimethod::index(lir::Jump, R)] = CAST1(jumpR);
|
||||
uo[Multimethod::index(lir::Jump, C)] = CAST1(jumpC);
|
||||
uo[Multimethod::index(lir::Jump, M)] = CAST1(jumpM);
|
||||
|
||||
uo[index(c, lir::AlignedJump, C)] = CAST1(alignedJumpC);
|
||||
uo[Multimethod::index(lir::AlignedJump, C)] = CAST1(alignedJumpC);
|
||||
|
||||
uo[index(c, lir::LongJump, C)] = CAST1(longJumpC);
|
||||
uo[Multimethod::index(lir::LongJump, C)] = CAST1(longJumpC);
|
||||
|
||||
uo[index(c, lir::AlignedLongJump, C)] = CAST1(alignedLongJumpC);
|
||||
uo[Multimethod::index(lir::AlignedLongJump, C)] = CAST1(alignedLongJumpC);
|
||||
|
||||
bo[index(c, lir::Negate, R, R)] = CAST2(negateRR);
|
||||
|
||||
|
@ -21,8 +21,6 @@ namespace x86 {
|
||||
|
||||
class ArchitectureContext;
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::UnaryOperation operation, lir::OperandType operand);
|
||||
|
||||
unsigned index(ArchitectureContext*, lir::BinaryOperation operation,
|
||||
lir::OperandType operand1,
|
||||
lir::OperandType operand2);
|
||||
|
Loading…
Reference in New Issue
Block a user