diff --git a/src/alloy/backend/assembler.h b/src/alloy/backend/assembler.h index d2e7f6c67..7b686ee5e 100644 --- a/src/alloy/backend/assembler.h +++ b/src/alloy/backend/assembler.h @@ -15,7 +15,7 @@ namespace alloy { namespace hir { -class FunctionBuilder; +class HIRBuilder; } namespace runtime { class DebugInfo; @@ -41,7 +41,7 @@ public: virtual void Reset(); virtual int Assemble( - runtime::FunctionInfo* symbol_info, hir::FunctionBuilder* builder, + runtime::FunctionInfo* symbol_info, hir::HIRBuilder* builder, runtime::DebugInfo* debug_info, runtime::Function** out_function) = 0; protected: diff --git a/src/alloy/backend/ivm/ivm_assembler.cc b/src/alloy/backend/ivm/ivm_assembler.cc index 54ae04393..5eb049d33 100644 --- a/src/alloy/backend/ivm/ivm_assembler.cc +++ b/src/alloy/backend/ivm/ivm_assembler.cc @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -54,7 +54,7 @@ void IVMAssembler::Reset() { } int IVMAssembler::Assemble( - FunctionInfo* symbol_info, FunctionBuilder* builder, + FunctionInfo* symbol_info, HIRBuilder* builder, DebugInfo* debug_info, Function** out_function) { IVMFunction* fn = new IVMFunction(symbol_info); fn->set_debug_info(debug_info); diff --git a/src/alloy/backend/ivm/ivm_assembler.h b/src/alloy/backend/ivm/ivm_assembler.h index 052ab49e2..1a03b0fad 100644 --- a/src/alloy/backend/ivm/ivm_assembler.h +++ b/src/alloy/backend/ivm/ivm_assembler.h @@ -30,7 +30,7 @@ public: virtual void Reset(); virtual int Assemble( - runtime::FunctionInfo* symbol_info, hir::FunctionBuilder* builder, + runtime::FunctionInfo* symbol_info, hir::HIRBuilder* builder, runtime::DebugInfo* debug_info, runtime::Function** out_function); private: diff --git a/src/alloy/backend/ivm/ivm_intcode.cc b/src/alloy/backend/ivm/ivm_intcode.cc index ab90b5acb..615ce1771 100644 --- a/src/alloy/backend/ivm/ivm_intcode.cc +++ b/src/alloy/backend/ivm/ivm_intcode.cc @@ -31,14 +31,15 @@ namespace backend { namespace ivm { -//#define DPRINT printf -//#define DFLUSH() fflush(stdout) -#define DPRINT -#define DFLUSH() -//#define IPRINT printf -//#define IFLUSH() fflush(stdout) #define IPRINT #define IFLUSH() +#define DPRINT +#define DFLUSH() + +//#define IPRINT if (ics.thread_state->thread_id() == 1) printf +//#define IFLUSH() fflush(stdout) +//#define DPRINT if (ics.thread_state->thread_id() == 1) printf +//#define DFLUSH() fflush(stdout) uint32_t IntCode_INT_LOAD_CONSTANT(IntCodeState& ics, const IntCode* i) { diff --git a/src/alloy/backend/x64/lir/lir_builder.cc b/src/alloy/backend/x64/lir/lir_builder.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/lir_builder.h b/src/alloy/backend/x64/lir/lir_builder.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/lir_instr.h b/src/alloy/backend/x64/lir/lir_instr.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/lircodes.cc b/src/alloy/backend/x64/lir/lircodes.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/lircodes.h b/src/alloy/backend/x64/lir/lircodes.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/lircodes.inl b/src/alloy/backend/x64/lir/lircodes.inl new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/lir/sources.gypi b/src/alloy/backend/x64/lir/sources.gypi new file mode 100644 index 000000000..50538ff83 --- /dev/null +++ b/src/alloy/backend/x64/lir/sources.gypi @@ -0,0 +1,12 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'lir_builder.cc', + 'lir_builder.h', + 'lir_instr.h', + 'lircodes.cc', + 'lircodes.h', + 'lircodes.inl', + 'tracing.h', + ], +} diff --git a/src/alloy/backend/x64/lir/tracing.h b/src/alloy/backend/x64/lir/tracing.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/optimizer.cc b/src/alloy/backend/x64/optimizer/optimizer.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/optimizer.h b/src/alloy/backend/x64/optimizer/optimizer.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/optimizer_pass.cc b/src/alloy/backend/x64/optimizer/optimizer_pass.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/optimizer_pass.h b/src/alloy/backend/x64/optimizer/optimizer_pass.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/optimizer_passes.h b/src/alloy/backend/x64/optimizer/optimizer_passes.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/passes/redundant_mov_pass.cc b/src/alloy/backend/x64/optimizer/passes/redundant_mov_pass.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/passes/redundant_mov_pass.h b/src/alloy/backend/x64/optimizer/passes/redundant_mov_pass.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/optimizer/passes/sources.gypi b/src/alloy/backend/x64/optimizer/passes/sources.gypi new file mode 100644 index 000000000..4e1d4d4ef --- /dev/null +++ b/src/alloy/backend/x64/optimizer/passes/sources.gypi @@ -0,0 +1,7 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'redundant_mov_pass.cc', + 'redundant_mov_pass.h', + ], +} diff --git a/src/alloy/backend/x64/optimizer/sources.gypi b/src/alloy/backend/x64/optimizer/sources.gypi new file mode 100644 index 000000000..33aae7f33 --- /dev/null +++ b/src/alloy/backend/x64/optimizer/sources.gypi @@ -0,0 +1,15 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'optimizer.cc', + 'optimizer.h', + 'optimizer_pass.cc', + 'optimizer_pass.h', + 'optimizer_passes.h', + 'tracing.h', + ], + + 'includes': [ + 'passes/sources.gypi', + ], +} diff --git a/src/alloy/backend/x64/optimizer/tracing.h b/src/alloy/backend/x64/optimizer/tracing.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/sources.gypi b/src/alloy/backend/x64/sources.gypi index 230679df4..750becab6 100644 --- a/src/alloy/backend/x64/sources.gypi +++ b/src/alloy/backend/x64/sources.gypi @@ -1,5 +1,21 @@ # Copyright 2013 Ben Vanik. All Rights Reserved. { 'sources': [ + 'tracing.h', + 'x64_assembler.cc', + 'x64_assembler.h', + 'x64_backend.cc', + 'x64_backend.h', + 'x64_codegen.cc', + 'x64_codegen.h', + 'x64_emitter.cc', + 'x64_emitter.h', + 'x64_function.cc', + 'x64_function.h', + ], + + 'includes': [ + 'lir/sources.gypi', + 'optimizer/sources.gypi', ], } diff --git a/src/alloy/backend/x64/tracing.h b/src/alloy/backend/x64/tracing.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_assembler.cc b/src/alloy/backend/x64/x64_assembler.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_assembler.h b/src/alloy/backend/x64/x64_assembler.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_backend.cc b/src/alloy/backend/x64/x64_backend.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_backend.h b/src/alloy/backend/x64/x64_backend.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_codegen.cc b/src/alloy/backend/x64/x64_codegen.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_codegen.h b/src/alloy/backend/x64/x64_codegen.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_emitter.cc b/src/alloy/backend/x64/x64_emitter.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_emitter.h b/src/alloy/backend/x64/x64_emitter.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_function.cc b/src/alloy/backend/x64/x64_function.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/backend/x64/x64_function.h b/src/alloy/backend/x64/x64_function.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/alloy/compiler/compiler.cc b/src/alloy/compiler/compiler.cc index 062f0150e..07e786ade 100644 --- a/src/alloy/compiler/compiler.cc +++ b/src/alloy/compiler/compiler.cc @@ -9,7 +9,7 @@ #include -#include +#include #include using namespace alloy; @@ -26,9 +26,9 @@ Compiler::Compiler(Runtime* runtime) : Compiler::~Compiler() { Reset(); - - for (PassList::iterator it = passes_.begin(); it != passes_.end(); ++it) { - Pass* pass = *it; + + for (auto it = passes_.begin(); it != passes_.end(); ++it) { + CompilerPass* pass = *it; delete pass; } @@ -36,7 +36,7 @@ Compiler::~Compiler() { })); } -void Compiler::AddPass(Pass* pass) { +void Compiler::AddPass(CompilerPass* pass) { pass->Initialize(this); passes_.push_back(pass); } @@ -44,15 +44,15 @@ void Compiler::AddPass(Pass* pass) { void Compiler::Reset() { } -int Compiler::Compile(FunctionBuilder* builder) { +int Compiler::Compile(HIRBuilder* builder) { // TODO(benvanik): sophisticated stuff. Run passes in parallel, run until they // stop changing things, etc. - for (PassList::iterator it = passes_.begin(); it != passes_.end(); ++it) { - Pass* pass = *it; + for (auto it = passes_.begin(); it != passes_.end(); ++it) { + CompilerPass* pass = *it; if (pass->Run(builder)) { return 1; } } return 0; -} \ No newline at end of file +} diff --git a/src/alloy/compiler/compiler.h b/src/alloy/compiler/compiler.h index f1c9733f8..ae6b48455 100644 --- a/src/alloy/compiler/compiler.h +++ b/src/alloy/compiler/compiler.h @@ -11,7 +11,7 @@ #define ALLOY_COMPILER_COMPILER_H_ #include -#include +#include namespace alloy { namespace runtime { class Runtime; } } @@ -19,7 +19,7 @@ namespace alloy { namespace runtime { class Runtime; } } namespace alloy { namespace compiler { -class Pass; +class CompilerPass; class Compiler { @@ -28,17 +28,17 @@ public: ~Compiler(); runtime::Runtime* runtime() const { return runtime_; } - - void AddPass(Pass* pass); + + void AddPass(CompilerPass* pass); void Reset(); - int Compile(hir::FunctionBuilder* builder); + int Compile(hir::HIRBuilder* builder); private: runtime::Runtime* runtime_; - typedef std::vector PassList; + typedef std::vector PassList; PassList passes_; }; diff --git a/src/alloy/compiler/pass.cc b/src/alloy/compiler/compiler_pass.cc similarity index 81% rename from src/alloy/compiler/pass.cc rename to src/alloy/compiler/compiler_pass.cc index 5e671c49d..535bcb490 100644 --- a/src/alloy/compiler/pass.cc +++ b/src/alloy/compiler/compiler_pass.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include +#include #include @@ -15,14 +15,14 @@ using namespace alloy; using namespace alloy::compiler; -Pass::Pass() : +CompilerPass::CompilerPass() : runtime_(0), compiler_(0) { } -Pass::~Pass() { +CompilerPass::~CompilerPass() { } -int Pass::Initialize(Compiler* compiler) { +int CompilerPass::Initialize(Compiler* compiler) { runtime_ = compiler->runtime(); compiler_ = compiler; return 0; diff --git a/src/alloy/compiler/pass.h b/src/alloy/compiler/compiler_pass.h similarity index 74% rename from src/alloy/compiler/pass.h rename to src/alloy/compiler/compiler_pass.h index a326ec79b..1ed1b8144 100644 --- a/src/alloy/compiler/pass.h +++ b/src/alloy/compiler/compiler_pass.h @@ -7,12 +7,12 @@ ****************************************************************************** */ -#ifndef ALLOY_COMPILER_PASS_H_ -#define ALLOY_COMPILER_PASS_H_ +#ifndef ALLOY_COMPILER_COMPILER_PASS_H_ +#define ALLOY_COMPILER_COMPILER_PASS_H_ #include -#include +#include namespace alloy { namespace runtime { class Runtime; } } @@ -23,14 +23,14 @@ namespace compiler { class Compiler; -class Pass { +class CompilerPass { public: - Pass(); - virtual ~Pass(); + CompilerPass(); + virtual ~CompilerPass(); virtual int Initialize(Compiler* compiler); - virtual int Run(hir::FunctionBuilder* builder) = 0; + virtual int Run(hir::HIRBuilder* builder) = 0; protected: runtime::Runtime* runtime_; @@ -42,4 +42,4 @@ protected: } // namespace alloy -#endif // ALLOY_COMPILER_PASS_H_ +#endif // ALLOY_COMPILER_COMPILER_PASS_H_ diff --git a/src/alloy/compiler/passes.h b/src/alloy/compiler/compiler_passes.h similarity index 97% rename from src/alloy/compiler/passes.h rename to src/alloy/compiler/compiler_passes.h index bc7f7d0b9..120dff4e3 100644 --- a/src/alloy/compiler/passes.h +++ b/src/alloy/compiler/compiler_passes.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef ALLOY_COMPILER_PASSES_H_ -#define ALLOY_COMPILER_PASSES_H_ +#ifndef ALLOY_COMPILER_COMPILER_PASSES_H_ +#define ALLOY_COMPILER_COMPILER_PASSES_H_ #include #include @@ -133,4 +133,4 @@ // branch_true v5, ... // -#endif // ALLOY_COMPILER_PASSES_H_ +#endif // ALLOY_COMPILER_COMPILER_PASSES_H_ diff --git a/src/alloy/compiler/passes/constant_propagation_pass.cc b/src/alloy/compiler/passes/constant_propagation_pass.cc index 2f49c41ad..af00e1608 100644 --- a/src/alloy/compiler/passes/constant_propagation_pass.cc +++ b/src/alloy/compiler/passes/constant_propagation_pass.cc @@ -16,13 +16,13 @@ using namespace alloy::hir; ConstantPropagationPass::ConstantPropagationPass() : - Pass() { + CompilerPass() { } ConstantPropagationPass::~ConstantPropagationPass() { } -int ConstantPropagationPass::Run(FunctionBuilder* builder) { +int ConstantPropagationPass::Run(HIRBuilder* builder) { // Once ContextPromotion has run there will likely be a whole slew of // constants that can be pushed through the function. // Example: diff --git a/src/alloy/compiler/passes/constant_propagation_pass.h b/src/alloy/compiler/passes/constant_propagation_pass.h index c64a62038..ce705522b 100644 --- a/src/alloy/compiler/passes/constant_propagation_pass.h +++ b/src/alloy/compiler/passes/constant_propagation_pass.h @@ -10,7 +10,7 @@ #ifndef ALLOY_COMPILER_PASSES_CONSTANT_PROPAGATION_PASS_H_ #define ALLOY_COMPILER_PASSES_CONSTANT_PROPAGATION_PASS_H_ -#include +#include namespace alloy { @@ -18,12 +18,12 @@ namespace compiler { namespace passes { -class ConstantPropagationPass : public Pass { +class ConstantPropagationPass : public CompilerPass { public: ConstantPropagationPass(); virtual ~ConstantPropagationPass(); - virtual int Run(hir::FunctionBuilder* builder); + virtual int Run(hir::HIRBuilder* builder); private: }; diff --git a/src/alloy/compiler/passes/context_promotion_pass.cc b/src/alloy/compiler/passes/context_promotion_pass.cc index d2e29fcec..a5123486b 100644 --- a/src/alloy/compiler/passes/context_promotion_pass.cc +++ b/src/alloy/compiler/passes/context_promotion_pass.cc @@ -22,7 +22,7 @@ using namespace alloy::runtime; ContextPromotionPass::ContextPromotionPass() : context_values_size_(0), context_values_(0), - Pass() { + CompilerPass() { } ContextPromotionPass::~ContextPromotionPass() { @@ -32,7 +32,7 @@ ContextPromotionPass::~ContextPromotionPass() { } int ContextPromotionPass::Initialize(Compiler* compiler) { - if (Pass::Initialize(compiler)) { + if (CompilerPass::Initialize(compiler)) { return 1; } @@ -44,7 +44,7 @@ int ContextPromotionPass::Initialize(Compiler* compiler) { return 0; } -int ContextPromotionPass::Run(FunctionBuilder* builder) { +int ContextPromotionPass::Run(HIRBuilder* builder) { // Like mem2reg, but because context memory is unaliasable it's easier to // check and convert LoadContext/StoreContext into value operations. // Example of load->value promotion: diff --git a/src/alloy/compiler/passes/context_promotion_pass.h b/src/alloy/compiler/passes/context_promotion_pass.h index f4d7226ee..8c4d7b743 100644 --- a/src/alloy/compiler/passes/context_promotion_pass.h +++ b/src/alloy/compiler/passes/context_promotion_pass.h @@ -10,7 +10,7 @@ #ifndef ALLOY_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_ #define ALLOY_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_ -#include +#include namespace alloy { @@ -18,14 +18,14 @@ namespace compiler { namespace passes { -class ContextPromotionPass : public Pass { +class ContextPromotionPass : public CompilerPass { public: ContextPromotionPass(); virtual ~ContextPromotionPass(); virtual int Initialize(Compiler* compiler); - virtual int Run(hir::FunctionBuilder* builder); + virtual int Run(hir::HIRBuilder* builder); private: void PromoteBlock(hir::Block* block); diff --git a/src/alloy/compiler/passes/dead_code_elimination_pass.cc b/src/alloy/compiler/passes/dead_code_elimination_pass.cc index cc76b7f41..9bc564c90 100644 --- a/src/alloy/compiler/passes/dead_code_elimination_pass.cc +++ b/src/alloy/compiler/passes/dead_code_elimination_pass.cc @@ -16,13 +16,13 @@ using namespace alloy::hir; DeadCodeEliminationPass::DeadCodeEliminationPass() : - Pass() { + CompilerPass() { } DeadCodeEliminationPass::~DeadCodeEliminationPass() { } -int DeadCodeEliminationPass::Run(FunctionBuilder* builder) { +int DeadCodeEliminationPass::Run(HIRBuilder* builder) { // ContextPromotion/DSE will likely leave around a lot of dead statements. // Code generated for comparison/testing produces many unused statements and // with proper use analysis it should be possible to remove most of them: diff --git a/src/alloy/compiler/passes/dead_code_elimination_pass.h b/src/alloy/compiler/passes/dead_code_elimination_pass.h index 7b363bf2e..1d414d5c2 100644 --- a/src/alloy/compiler/passes/dead_code_elimination_pass.h +++ b/src/alloy/compiler/passes/dead_code_elimination_pass.h @@ -10,7 +10,7 @@ #ifndef ALLOY_COMPILER_PASSES_DEAD_CODE_ELIMINATION_PASS_H_ #define ALLOY_COMPILER_PASSES_DEAD_CODE_ELIMINATION_PASS_H_ -#include +#include namespace alloy { @@ -18,12 +18,12 @@ namespace compiler { namespace passes { -class DeadCodeEliminationPass : public Pass { +class DeadCodeEliminationPass : public CompilerPass { public: DeadCodeEliminationPass(); virtual ~DeadCodeEliminationPass(); - virtual int Run(hir::FunctionBuilder* builder); + virtual int Run(hir::HIRBuilder* builder); private: void MakeNopRecursive(hir::Instr* i); diff --git a/src/alloy/compiler/passes/simplification_pass.cc b/src/alloy/compiler/passes/simplification_pass.cc index 9cce48476..519eff811 100644 --- a/src/alloy/compiler/passes/simplification_pass.cc +++ b/src/alloy/compiler/passes/simplification_pass.cc @@ -16,13 +16,13 @@ using namespace alloy::hir; SimplificationPass::SimplificationPass() : - Pass() { + CompilerPass() { } SimplificationPass::~SimplificationPass() { } -int SimplificationPass::Run(FunctionBuilder* builder) { +int SimplificationPass::Run(HIRBuilder* builder) { // Run over the instructions and rename assigned variables: // v1 = v0 // v2 = v1 diff --git a/src/alloy/compiler/passes/simplification_pass.h b/src/alloy/compiler/passes/simplification_pass.h index 44d4e87d8..3fc62ce80 100644 --- a/src/alloy/compiler/passes/simplification_pass.h +++ b/src/alloy/compiler/passes/simplification_pass.h @@ -10,7 +10,7 @@ #ifndef ALLOY_COMPILER_PASSES_SIMPLIFICATION_PASS_H_ #define ALLOY_COMPILER_PASSES_SIMPLIFICATION_PASS_H_ -#include +#include namespace alloy { @@ -18,12 +18,12 @@ namespace compiler { namespace passes { -class SimplificationPass : public Pass { +class SimplificationPass : public CompilerPass { public: SimplificationPass(); virtual ~SimplificationPass(); - virtual int Run(hir::FunctionBuilder* builder); + virtual int Run(hir::HIRBuilder* builder); private: hir::Value* CheckValue(hir::Value* value); diff --git a/src/alloy/compiler/sources.gypi b/src/alloy/compiler/sources.gypi index fb372f558..d32e7dac4 100644 --- a/src/alloy/compiler/sources.gypi +++ b/src/alloy/compiler/sources.gypi @@ -3,9 +3,9 @@ 'sources': [ 'compiler.cc', 'compiler.h', - 'pass.cc', - 'pass.h', - 'passes.h', + 'compiler_pass.cc', + 'compiler_pass.h', + 'compiler_passes.h', 'tracing.h', ], diff --git a/src/alloy/frontend/ppc/ppc_disasm-private.h b/src/alloy/frontend/ppc/ppc_disasm-private.h index 974a1dc75..3bb867e70 100644 --- a/src/alloy/frontend/ppc/ppc_disasm-private.h +++ b/src/alloy/frontend/ppc/ppc_disasm-private.h @@ -24,8 +24,8 @@ namespace ppc { #define XEREGISTERINSTR(name, opcode) \ RegisterInstrDisassemble(opcode, (InstrDisassembleFn)InstrDisasm_##name); -//#define XEINSTRNOTIMPLEMENTED() -#define XEINSTRNOTIMPLEMENTED XEASSERTALWAYS +#define XEINSTRNOTIMPLEMENTED() +//#define XEINSTRNOTIMPLEMENTED XEASSERTALWAYS } // namespace ppc diff --git a/src/alloy/frontend/ppc/ppc_emit-private.h b/src/alloy/frontend/ppc/ppc_emit-private.h index e805bca76..2c147f45e 100644 --- a/src/alloy/frontend/ppc/ppc_emit-private.h +++ b/src/alloy/frontend/ppc/ppc_emit-private.h @@ -24,8 +24,9 @@ namespace ppc { #define XEREGISTERINSTR(name, opcode) \ RegisterInstrEmit(opcode, (InstrEmitFn)InstrEmit_##name); -//#define XEINSTRNOTIMPLEMENTED() -#define XEINSTRNOTIMPLEMENTED XEASSERTALWAYS +#define XEINSTRNOTIMPLEMENTED() +//#define XEINSTRNOTIMPLEMENTED XEASSERTALWAYS +//#define XEINSTRNOTIMPLEMENTED() __debugbreak() } // namespace ppc diff --git a/src/alloy/frontend/ppc/ppc_emit_altivec.cc b/src/alloy/frontend/ppc/ppc_emit_altivec.cc index 7d4cccca8..99269caa3 100644 --- a/src/alloy/frontend/ppc/ppc_emit_altivec.cc +++ b/src/alloy/frontend/ppc/ppc_emit_altivec.cc @@ -10,7 +10,7 @@ #include #include -#include +#include using namespace alloy::frontend::ppc; @@ -23,10 +23,10 @@ namespace frontend { namespace ppc { -Value* CalculateEA(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb); -Value* CalculateEA_0(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb); -Value* CalculateEA_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm); -Value* CalculateEA_0_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm); +Value* CalculateEA(PPCHIRBuilder& f, uint32_t ra, uint32_t rb); +Value* CalculateEA_0(PPCHIRBuilder& f, uint32_t ra, uint32_t rb); +Value* CalculateEA_i(PPCHIRBuilder& f, uint32_t ra, uint64_t imm); +Value* CalculateEA_0_i(PPCHIRBuilder& f, uint32_t ra, uint64_t imm); #define SHUFPS_SWAP_DWORDS 0x1B @@ -109,89 +109,89 @@ Value* CalculateEA_0_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm); // } -XEEMITTER(dst, 0x7C0002AC, XDSS)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dst, 0x7C0002AC, XDSS)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(dstst, 0x7C0002EC, XDSS)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dstst, 0x7C0002EC, XDSS)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(dss, 0x7C00066C, XDSS)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dss, 0x7C00066C, XDSS)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lvebx, 0x7C00000E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvebx, 0x7C00000E, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lvehx, 0x7C00004E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvehx, 0x7C00004E, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_lvewx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvewx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lvewx, 0x7C00008E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvewx, 0x7C00008E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvewx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvewx128, VX128_1(4, 131), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvewx128, VX128_1(4, 131), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvewx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -int InstrEmit_lvsl_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvsl_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); Value* sh = f.Truncate(f.And(ea, f.LoadConstant((int64_t)0xF)), INT8_TYPE); Value* v = f.LoadVectorShl(sh); f.StoreVR(vd, v); return 0; } -XEEMITTER(lvsl, 0x7C00000C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvsl, 0x7C00000C, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvsl_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvsl128, VX128_1(4, 3), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvsl128, VX128_1(4, 3), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvsl_(f, i, i.X.RT, i.X.RA, i.X.RB); } -int InstrEmit_lvsr_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvsr_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); Value* sh = f.Truncate(f.And(ea, f.LoadConstant((int64_t)0xF)), INT8_TYPE); Value* v = f.LoadVectorShr(sh); f.StoreVR(vd, v); return 0; } -XEEMITTER(lvsr, 0x7C00004C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvsr, 0x7C00004C, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvsr_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvsr128, VX128_1(4, 67), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvsr128, VX128_1(4, 67), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvsr_(f, i, i.X.RT, i.X.RA, i.X.RB); } -int InstrEmit_lvx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); f.StoreVR(vd, f.ByteSwap(f.Load(ea, VEC128_TYPE))); return 0; } -XEEMITTER(lvx, 0x7C0000CE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvx, 0x7C0000CE, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvx128, VX128_1(4, 195), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvx128, VX128_1(4, 195), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(lvxl, 0x7C0002CE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvxl, 0x7C0002CE, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvx(f, i); } -XEEMITTER(lvxl128, VX128_1(4, 707), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvxl128, VX128_1(4, 707), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvx128(f, i); } -XEEMITTER(stvebx, 0x7C00010E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvebx, 0x7C00010E, X )(PPCHIRBuilder& f, InstrData& i) { Value* ea = CalculateEA_0(f, i.X.RA, i.X.RB); Value* el = f.And(ea, f.LoadConstant(0xFull)); Value* v = f.Extract(f.LoadVR(i.X.RT), el, INT8_TYPE); @@ -199,7 +199,7 @@ XEEMITTER(stvebx, 0x7C00010E, X )(PPCFunctionBuilder& f, InstrData& i) return 0; } -XEEMITTER(stvehx, 0x7C00014E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvehx, 0x7C00014E, X )(PPCHIRBuilder& f, InstrData& i) { Value* ea = CalculateEA_0(f, i.X.RA, i.X.RB); ea = f.And(ea, f.LoadConstant(~0x1ull)); Value* el = f.Shr(f.And(ea, f.LoadConstant(0xFull)), 1); @@ -208,7 +208,7 @@ XEEMITTER(stvehx, 0x7C00014E, X )(PPCFunctionBuilder& f, InstrData& i) return 0; } -int InstrEmit_stvewx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_stvewx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); ea = f.And(ea, f.LoadConstant(~0x3ull)); Value* el = f.Shr(f.And(ea, f.LoadConstant(0xFull)), 2); @@ -216,34 +216,34 @@ int InstrEmit_stvewx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t f.Store(ea, f.ByteSwap(v)); return 0; } -XEEMITTER(stvewx, 0x7C00018E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvewx, 0x7C00018E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvewx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(stvewx128, VX128_1(4, 387), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvewx128, VX128_1(4, 387), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvewx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -int InstrEmit_stvx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_stvx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); f.Store(ea, f.ByteSwap(f.LoadVR(vd))); return 0; } -XEEMITTER(stvx, 0x7C0001CE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvx, 0x7C0001CE, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(stvx128, VX128_1(4, 451), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvx128, VX128_1(4, 451), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(stvxl, 0x7C0003CE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvxl, 0x7C0003CE, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvx(f, i); } -XEEMITTER(stvxl128, VX128_1(4, 963), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvxl128, VX128_1(4, 963), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvx128(f, i); } // The lvlx/lvrx/etc instructions are in Cell docs only: // https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/C40E4C6133B31EE8872570B500791108/$file/vector_simd_pem_v_2.07c_26Oct2006_cell.pdf -int InstrEmit_lvlx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvlx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); Value* eb = f.And(f.Truncate(ea, INT8_TYPE), f.LoadConstant((int8_t)0xF)); // ea &= ~0xF (load takes care of this) @@ -256,20 +256,20 @@ int InstrEmit_lvlx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t r f.StoreVR(vd, v); return 0; } -XEEMITTER(lvlx, 0x7C00040E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvlx, 0x7C00040E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvlx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvlx128, VX128_1(4, 1027), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvlx128, VX128_1(4, 1027), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvlx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(lvlxl, 0x7C00060E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvlxl, 0x7C00060E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvlx(f, i); } -XEEMITTER(lvlxl128, VX128_1(4, 1539), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvlxl128, VX128_1(4, 1539), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvlx128(f, i); } -int InstrEmit_lvrx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_lvrx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { Value* ea = CalculateEA_0(f, ra, rb); Value* eb = f.And(f.Truncate(ea, INT8_TYPE), f.LoadConstant((int8_t)0xF)); // ea &= ~0xF (load takes care of this) @@ -282,20 +282,20 @@ int InstrEmit_lvrx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t r f.StoreVR(vd, v); return 0; } -XEEMITTER(lvrx, 0x7C00044E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvrx, 0x7C00044E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvrx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(lvrx128, VX128_1(4, 1091), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvrx128, VX128_1(4, 1091), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvrx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(lvrxl, 0x7C00064E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvrxl, 0x7C00064E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvrx(f, i); } -XEEMITTER(lvrxl128, VX128_1(4, 1603), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lvrxl128, VX128_1(4, 1603), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_lvrx128(f, i); } -int InstrEmit_stvlx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_stvlx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { // NOTE: if eb == 0 (so 16b aligned) this equals new_value // we could optimize this to prevent the other load/mask, in that case. Value* ea = CalculateEA_0(f, ra, rb); @@ -322,20 +322,20 @@ int InstrEmit_stvlx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t f.Store(ea, f.ByteSwap(v)); return 0; } -XEEMITTER(stvlx, 0x7C00050E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvlx, 0x7C00050E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvlx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(stvlx128, VX128_1(4, 1283), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvlx128, VX128_1(4, 1283), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvlx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(stvlxl, 0x7C00070E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvlxl, 0x7C00070E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvlx(f, i); } -XEEMITTER(stvlxl128, VX128_1(4, 1795), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvlxl128, VX128_1(4, 1795), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvlx128(f, i); } -int InstrEmit_stvrx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { +int InstrEmit_stvrx_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t ra, uint32_t rb) { // NOTE: if eb == 0 (so 16b aligned) this equals new_value // we could optimize this to prevent the other load/mask, in that case. Value* ea = CalculateEA_0(f, ra, rb); @@ -362,154 +362,154 @@ int InstrEmit_stvrx_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t f.Store(ea, f.ByteSwap(v)); return 0; } -XEEMITTER(stvrx, 0x7C00054E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvrx, 0x7C00054E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvrx_(f, i, i.X.RT, i.X.RA, i.X.RB); } -XEEMITTER(stvrx128, VX128_1(4, 1347), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvrx128, VX128_1(4, 1347), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvrx_(f, i, VX128_1_VD128, i.VX128_1.RA, i.VX128_1.RB); } -XEEMITTER(stvrxl, 0x7C00074E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvrxl, 0x7C00074E, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvrx(f, i); } -XEEMITTER(stvrxl128, VX128_1(4, 1859), VX128_1)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stvrxl128, VX128_1(4, 1859), VX128_1)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_stvrx128(f, i); } -XEEMITTER(mfvscr, 0x10000604, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mfvscr, 0x10000604, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtvscr, 0x10000644, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtvscr, 0x10000644, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vaddcuw, 0x10000180, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddcuw, 0x10000180, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vaddfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vaddfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // (VD) <- (VA) + (VB) (4 x fp) Value* v = f.Add(f.LoadVR(va), f.LoadVR(vb)); f.StoreVR(vd, v); return 0; } -XEEMITTER(vaddfp, 0x1000000A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddfp, 0x1000000A, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vaddfp_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vaddfp128, VX128(5, 16), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddfp128, VX128(5, 16), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vaddfp_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vaddsbs, 0x10000300, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddsbs, 0x10000300, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vaddshs, 0x10000340, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddshs, 0x10000340, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vaddsws, 0x10000380, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddsws, 0x10000380, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vaddubm, 0x10000000, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddubm, 0x10000000, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vaddubs, 0x10000200, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vaddubs, 0x10000200, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vadduhm, 0x10000040, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vadduhm, 0x10000040, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vadduhs, 0x10000240, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vadduhs, 0x10000240, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vadduwm, 0x10000080, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vadduwm, 0x10000080, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vadduws, 0x10000280, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vadduws, 0x10000280, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vand_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vand_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // VD <- (VA) & (VB) Value* v = f.And(f.LoadVR(va), f.LoadVR(vb)); f.StoreVR(vd, v); return 0; } -XEEMITTER(vand, 0x10000404, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vand, 0x10000404, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vand_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vand128, VX128(5, 528), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vand128, VX128(5, 528), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vand_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -int InstrEmit_vandc_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vandc_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // VD <- (VA) & ¬(VB) Value* v = f.And(f.LoadVR(va), f.Not(f.LoadVR(vb))); f.StoreVR(vd, v); return 0; } -XEEMITTER(vandc, 0x10000444, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vandc, 0x10000444, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vandc_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vandc128, VX128(5, 592), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vandc128, VX128(5, 592), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vandc_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vavgsb, 0x10000502, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavgsb, 0x10000502, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vavgsh, 0x10000542, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavgsh, 0x10000542, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vavgsw, 0x10000582, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavgsw, 0x10000582, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vavgub, 0x10000402, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavgub, 0x10000402, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vavguh, 0x10000442, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavguh, 0x10000442, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vavguw, 0x10000482, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vavguw, 0x10000482, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcfsx, 0x1000034A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcfsx, 0x1000034A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcsxwfp128, VX128_3(6, 688), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcsxwfp128, VX128_3(6, 688), VX128_3)(PPCHIRBuilder& f, InstrData& i) { // (VD) <- float(VB) / 2^uimm uint32_t uimm = VX128_3_IMM; uimm = uimm ? (2 << (uimm - 1)) : 1; @@ -520,34 +520,34 @@ XEEMITTER(vcsxwfp128, VX128_3(6, 688), VX128_3)(PPCFunctionBuilder& f, Inst return 0; } -XEEMITTER(vcfpsxws128, VX128_3(6, 560), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcfpsxws128, VX128_3(6, 560), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcfux, 0x1000030A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcfux, 0x1000030A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcuxwfp128, VX128_3(6, 752), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcuxwfp128, VX128_3(6, 752), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcfpuxws128, VX128_3(6, 624), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcfpuxws128, VX128_3(6, 624), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vcmpbfp_(PPCFunctionBuilder& f, InstrData& i, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { +int InstrEmit_vcmpbfp_(PPCHIRBuilder& f, InstrData& i, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vcmpbfp, 0x100003C6, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpbfp, 0x100003C6, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpbfp_(f, i, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpbfp128, VX128(6, 384), VX128_R)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpbfp128, VX128(6, 384), VX128_R)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpbfp_(f, i, VX128_R_VD128, VX128_R_VA128, VX128_R_VB128, i.VX128_R.Rc); } @@ -556,7 +556,7 @@ enum vcmpxxfp_op { vcmpxxfp_gt, vcmpxxfp_ge, }; -int InstrEmit_vcmpxxfp_(PPCFunctionBuilder& f, InstrData& i, vcmpxxfp_op cmpop, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { +int InstrEmit_vcmpxxfp_(PPCHIRBuilder& f, InstrData& i, vcmpxxfp_op cmpop, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { // (VD.xyzw) = (VA.xyzw) OP (VB.xyzw) ? 0xFFFFFFFF : 0x00000000 // if (Rc) CR6 = all_equal | 0 | none_equal | 0 // If an element in either VA or VB is NaN the result will be 0x00000000 @@ -582,22 +582,22 @@ int InstrEmit_vcmpxxfp_(PPCFunctionBuilder& f, InstrData& i, vcmpxxfp_op cmpop, return 0; } -XEEMITTER(vcmpeqfp, 0x100000C6, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpeqfp, 0x100000C6, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_eq, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpeqfp128, VX128(6, 0), VX128_R)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpeqfp128, VX128(6, 0), VX128_R)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_eq, VX128_R_VD128, VX128_R_VA128, VX128_R_VB128, i.VX128_R.Rc); } -XEEMITTER(vcmpgefp, 0x100001C6, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgefp, 0x100001C6, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_ge, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgefp128, VX128(6, 128), VX128_R)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgefp128, VX128(6, 128), VX128_R)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_ge, VX128_R_VD128, VX128_R_VA128, VX128_R_VB128, i.VX128_R.Rc); } -XEEMITTER(vcmpgtfp, 0x100002C6, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtfp, 0x100002C6, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_gt, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtfp128, VX128(6, 256), VX128_R)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtfp128, VX128(6, 256), VX128_R)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxfp_(f, i, vcmpxxfp_gt, VX128_R_VD128, VX128_R_VA128, VX128_R_VB128, i.VX128_R.Rc); } @@ -606,7 +606,7 @@ enum vcmpxxi_op { vcmpxxi_gt_signed, vcmpxxi_gt_unsigned, }; -int InstrEmit_vcmpxxi_(PPCFunctionBuilder& f, InstrData& i, vcmpxxi_op cmpop, uint32_t width, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { +int InstrEmit_vcmpxxi_(PPCHIRBuilder& f, InstrData& i, vcmpxxi_op cmpop, uint32_t width, uint32_t vd, uint32_t va, uint32_t vb, uint32_t rc) { // (VD.xyzw) = (VA.xyzw) OP (VB.xyzw) ? 0xFFFFFFFF : 0x00000000 // if (Rc) CR6 = all_equal | 0 | none_equal | 0 // If an element in either VA or VB is NaN the result will be 0x00000000 @@ -662,83 +662,83 @@ int InstrEmit_vcmpxxi_(PPCFunctionBuilder& f, InstrData& i, vcmpxxi_op cmpop, ui f.StoreVR(vd, v); return 0; } -XEEMITTER(vcmpequb, 0x10000006, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpequb, 0x10000006, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_eq, 1, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpequh, 0x10000046, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpequh, 0x10000046, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_eq, 2, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpequw, 0x10000086, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpequw, 0x10000086, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_eq, 4, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpequw128, VX128(6, 512), VX128_R)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpequw128, VX128(6, 512), VX128_R)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_eq, 4, VX128_R_VD128, VX128_R_VA128, VX128_R_VB128, i.VX128_R.Rc); } -XEEMITTER(vcmpgtsb, 0x10000306, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtsb, 0x10000306, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_signed, 1, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtsh, 0x10000346, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtsh, 0x10000346, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_signed, 2, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtsw, 0x10000386, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtsw, 0x10000386, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_signed, 4, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtub, 0x10000206, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtub, 0x10000206, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_unsigned, 1, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtuh, 0x10000246, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtuh, 0x10000246, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_unsigned, 2, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vcmpgtuw, 0x10000286, VXR )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vcmpgtuw, 0x10000286, VXR )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vcmpxxi_(f, i, vcmpxxi_gt_unsigned, 4, i.VXR.VD, i.VXR.VA, i.VXR.VB, i.VXR.Rc); } -XEEMITTER(vctsxs, 0x100003CA, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vctsxs, 0x100003CA, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vctuxs, 0x1000038A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vctuxs, 0x1000038A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vexptefp, 0x1000018A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vexptefp, 0x1000018A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vexptefp128, VX128_3(6, 1712), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vexptefp128, VX128_3(6, 1712), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vlogefp, 0x100001CA, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vlogefp, 0x100001CA, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vlogefp128, VX128_3(6, 1776), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vlogefp128, VX128_3(6, 1776), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vmaddfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { +int InstrEmit_vmaddfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { // (VD) <- ((VA) * (VC)) + (VB) Value* v = f.MulAdd( f.LoadVR(va), f.LoadVR(vc), f.LoadVR(vb)); f.StoreVR(vd, v); return 0; } -XEEMITTER(vmaddfp, 0x1000002E, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaddfp, 0x1000002E, VXA )(PPCHIRBuilder& f, InstrData& i) { // (VD) <- ((VA) * (VC)) + (VB) return InstrEmit_vmaddfp_(f, i.VXA.VD, i.VXA.VA, i.VXA.VB, i.VXA.VC); } -XEEMITTER(vmaddfp128, VX128(5, 208), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaddfp128, VX128(5, 208), VX128 )(PPCHIRBuilder& f, InstrData& i) { // (VD) <- ((VA) * (VB)) + (VD) // NOTE: this resuses VD and swaps the arg order! return InstrEmit_vmaddfp_(f, VX128_VD128, VX128_VA128, VX128_VD128, VX128_VB128); } -XEEMITTER(vmaddcfp128, VX128(5, 272), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaddcfp128, VX128(5, 272), VX128 )(PPCHIRBuilder& f, InstrData& i) { // (VD) <- ((VA) * (VD)) + (VB) Value* v = f.MulAdd( f.LoadVR(VX128_VA128), f.LoadVR(VX128_VD128), f.LoadVR(VX128_VB128)); @@ -746,118 +746,118 @@ XEEMITTER(vmaddcfp128, VX128(5, 272), VX128 )(PPCFunctionBuilder& f, Inst return 0; } -int InstrEmit_vmaxfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vmaxfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // (VD) <- max((VA), (VB)) Value* v = f.Max(f.LoadVR(va), f.LoadVR(vb)); f.StoreVR(vd, v); return 0; } -XEEMITTER(vmaxfp, 0x1000040A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxfp, 0x1000040A, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmaxfp_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vmaxfp128, VX128(6, 640), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxfp128, VX128(6, 640), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmaxfp_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vmaxsb, 0x10000102, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxsb, 0x10000102, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmaxsh, 0x10000142, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxsh, 0x10000142, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmaxsw, 0x10000182, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxsw, 0x10000182, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmaxub, 0x10000002, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxub, 0x10000002, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmaxuh, 0x10000042, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxuh, 0x10000042, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmaxuw, 0x10000082, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmaxuw, 0x10000082, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmhaddshs, 0x10000020, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmhaddshs, 0x10000020, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmhraddshs, 0x10000021, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmhraddshs, 0x10000021, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vminfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vminfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // (VD) <- min((VA), (VB)) Value* v = f.Min(f.LoadVR(va), f.LoadVR(vb)); f.StoreVR(vd, v); return 0; } -XEEMITTER(vminfp, 0x1000044A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminfp, 0x1000044A, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vminfp_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vminfp128, VX128(6, 704), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminfp128, VX128(6, 704), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vminfp_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vminsb, 0x10000302, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminsb, 0x10000302, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vminsh, 0x10000342, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminsh, 0x10000342, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vminsw, 0x10000382, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminsw, 0x10000382, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vminub, 0x10000202, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminub, 0x10000202, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vminuh, 0x10000242, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminuh, 0x10000242, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vminuw, 0x10000282, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vminuw, 0x10000282, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmladduhm, 0x10000022, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmladduhm, 0x10000022, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmrghb, 0x1000000C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrghb, 0x1000000C, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmrghh, 0x1000004C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrghh, 0x1000004C, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vmrghw_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vmrghw_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // (VD.x) = (VA.x) // (VD.y) = (VB.x) // (VD.z) = (VA.y) @@ -870,24 +870,24 @@ int InstrEmit_vmrghw_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t f.StoreVR(vd, v); return 0; } -XEEMITTER(vmrghw, 0x1000008C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrghw, 0x1000008C, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmrghw_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vmrghw128, VX128(6, 768), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrghw128, VX128(6, 768), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmrghw_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vmrglb, 0x1000010C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrglb, 0x1000010C, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmrglh, 0x1000014C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrglh, 0x1000014C, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vmrglw_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vmrglw_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // (VD.x) = (VA.z) // (VD.y) = (VB.z) // (VD.z) = (VA.w) @@ -900,44 +900,44 @@ int InstrEmit_vmrglw_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t f.StoreVR(vd, v); return 0; } -XEEMITTER(vmrglw, 0x1000018C, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrglw, 0x1000018C, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmrglw_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vmrglw128, VX128(6, 832), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmrglw128, VX128(6, 832), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vmrglw_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -XEEMITTER(vmsummbm, 0x10000025, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsummbm, 0x10000025, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsumshm, 0x10000028, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsumshm, 0x10000028, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsumshs, 0x10000029, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsumshs, 0x10000029, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsumubm, 0x10000024, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsumubm, 0x10000024, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsumuhm, 0x10000026, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsumuhm, 0x10000026, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsumuhs, 0x10000027, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsumuhs, 0x10000027, VXA )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmsum3fp128, VX128(5, 400), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsum3fp128, VX128(5, 400), VX128 )(PPCHIRBuilder& f, InstrData& i) { // Dot product XYZ. // (VD.xyzw) = (VA.x * VB.x) + (VA.y * VB.y) + (VA.z * VB.z) Value* v = f.DotProduct3(f.LoadVR(VX128_VA128), f.LoadVR(VX128_VB128)); @@ -946,7 +946,7 @@ XEEMITTER(vmsum3fp128, VX128(5, 400), VX128 )(PPCFunctionBuilder& f, Inst return 0; } -XEEMITTER(vmsum4fp128, VX128(5, 464), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmsum4fp128, VX128(5, 464), VX128 )(PPCHIRBuilder& f, InstrData& i) { // Dot product XYZW. // (VD.xyzw) = (VA.x * VB.x) + (VA.y * VB.y) + (VA.z * VB.z) + (VA.w * VB.w) Value* v = f.DotProduct4(f.LoadVR(VX128_VA128), f.LoadVR(VX128_VB128)); @@ -955,54 +955,54 @@ XEEMITTER(vmsum4fp128, VX128(5, 464), VX128 )(PPCFunctionBuilder& f, Inst return 0; } -XEEMITTER(vmulesb, 0x10000308, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulesb, 0x10000308, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmulesh, 0x10000348, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulesh, 0x10000348, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmuleub, 0x10000208, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmuleub, 0x10000208, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmuleuh, 0x10000248, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmuleuh, 0x10000248, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmulosb, 0x10000108, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulosb, 0x10000108, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmulosh, 0x10000148, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulosh, 0x10000148, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmuloub, 0x10000008, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmuloub, 0x10000008, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmulouh, 0x10000048, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulouh, 0x10000048, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vmulfp128, VX128(5, 144), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vmulfp128, VX128(5, 144), VX128 )(PPCHIRBuilder& f, InstrData& i) { // (VD) <- (VA) * (VB) (4 x fp) Value* v = f.Mul(f.LoadVR(VX128_VA128), f.LoadVR(VX128_VB128)); f.StoreVR(VX128_VD128, v); return 0; } -int InstrEmit_vnmsubfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { +int InstrEmit_vnmsubfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { // (VD) <- -(((VA) * (VC)) - (VB)) // NOTE: only one rounding should take place, but that's hard... // This really needs VFNMSUB132PS/VFNMSUB213PS/VFNMSUB231PS but that's AVX. @@ -1010,27 +1010,27 @@ int InstrEmit_vnmsubfp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_ f.StoreVR(vd, v); return 0; } -XEEMITTER(vnmsubfp, 0x1000002F, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vnmsubfp, 0x1000002F, VXA )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vnmsubfp_(f, i.VXA.VD, i.VXA.VA, i.VXA.VB, i.VXA.VC); } -XEEMITTER(vnmsubfp128, VX128(5, 336), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vnmsubfp128, VX128(5, 336), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vnmsubfp_(f, VX128_VD128, VX128_VA128, VX128_VB128, VX128_VD128); } -int InstrEmit_vnor_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vnor_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // VD <- ¬((VA) | (VB)) Value* v = f.Not(f.Or(f.LoadVR(va), f.LoadVR(vb))); f.StoreVR(vd, v); return 0; } -XEEMITTER(vnor, 0x10000504, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vnor, 0x10000504, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vnor_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vnor128, VX128(5, 656), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vnor128, VX128(5, 656), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vnor_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -int InstrEmit_vor_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vor_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // VD <- (VA) | (VB) if (va == vb) { // Copy VA==VB into VD. @@ -1041,26 +1041,26 @@ int InstrEmit_vor_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) } return 0; } -XEEMITTER(vor, 0x10000484, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vor, 0x10000484, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vor_(f, i.VX.VD, i.VX.VA, i.VX.VB); } -XEEMITTER(vor128, VX128(5, 720), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vor128, VX128(5, 720), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vor_(f, VX128_VD128, VX128_VA128, VX128_VB128); } -int InstrEmit_vperm_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { +int InstrEmit_vperm_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { Value* v = f.Permute(f.LoadVR(vc), f.LoadVR(va), f.LoadVR(vb), INT8_TYPE); f.StoreVR(vd, v); return 0; } -XEEMITTER(vperm, 0x1000002B, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vperm, 0x1000002B, VXA )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vperm_(f, i.VXA.VD, i.VXA.VA, i.VXA.VB, i.VXA.VC); } -XEEMITTER(vperm128, VX128_2(5, 0), VX128_2)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vperm128, VX128_2(5, 0), VX128_2)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vperm_(f, VX128_2_VD128, VX128_2_VA128, VX128_2_VB128, VX128_2_VC); } -XEEMITTER(vpermwi128, VX128_P(6, 528), VX128_P)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpermwi128, VX128_P(6, 528), VX128_P)(PPCHIRBuilder& f, InstrData& i) { // (VD.x) = (VB.uimm[6-7]) // (VD.y) = (VB.uimm[4-5]) // (VD.z) = (VB.uimm[2-3]) @@ -1073,157 +1073,157 @@ XEEMITTER(vpermwi128, VX128_P(6, 528), VX128_P)(PPCFunctionBuilder& f, Inst return 0; } -XEEMITTER(vpkpx, 0x1000030E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkpx, 0x1000030E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkshss, 0x1000018E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkshss, 0x1000018E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkshss128, VX128(5, 512), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkshss128, VX128(5, 512), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkswss, 0x100001CE, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkswss, 0x100001CE, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkswss128, VX128(5, 640), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkswss128, VX128(5, 640), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkswus, 0x1000014E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkswus, 0x1000014E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkswus128, VX128(5, 704), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkswus128, VX128(5, 704), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuhum, 0x1000000E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuhum, 0x1000000E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuhum128, VX128(5, 768), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuhum128, VX128(5, 768), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuhus, 0x1000008E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuhus, 0x1000008E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuhus128, VX128(5, 832), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuhus128, VX128(5, 832), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkshus, 0x1000010E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkshus, 0x1000010E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkshus128, VX128(5, 576), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkshus128, VX128(5, 576), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuwum, 0x1000004E, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuwum, 0x1000004E, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuwum128, VX128(5, 896), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuwum128, VX128(5, 896), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuwus, 0x100000CE, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuwus, 0x100000CE, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkuwus128, VX128(5, 960), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkuwus128, VX128(5, 960), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vpkd3d128, VX128_4(6, 1552), VX128_4)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vpkd3d128, VX128_4(6, 1552), VX128_4)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrefp, 0x1000010A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrefp, 0x1000010A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrefp128, VX128_3(6, 1584), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrefp128, VX128_3(6, 1584), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrfim, 0x100002CA, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfim, 0x100002CA, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrfim128, VX128_3(6, 816), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfim128, VX128_3(6, 816), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -int InstrEmit_vrfin_(PPCFunctionBuilder& f, uint32_t vd, uint32_t vb) { +int InstrEmit_vrfin_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb) { // (VD) <- RoundToNearest(VB) Value* v = f.Round(f.LoadVR(vd), ROUND_TO_NEAREST); f.StoreVR(vd, v); return 0; } -XEEMITTER(vrfin, 0x1000020A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfin, 0x1000020A, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vrfin_(f, i.VX.VD, i.VX.VB); } -XEEMITTER(vrfin128, VX128_3(6, 880), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfin128, VX128_3(6, 880), VX128_3)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vrfin_(f, VX128_3_VD128, VX128_3_VB128); } -XEEMITTER(vrfip, 0x1000028A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfip, 0x1000028A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrfip128, VX128_3(6, 944), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfip128, VX128_3(6, 944), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrfiz, 0x1000024A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfiz, 0x1000024A, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrfiz128, VX128_3(6, 1008), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrfiz128, VX128_3(6, 1008), VX128_3)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrlb, 0x10000004, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrlb, 0x10000004, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrlh, 0x10000044, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrlh, 0x10000044, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrlw, 0x10000084, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrlw, 0x10000084, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrlw128, VX128(6, 80), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrlw128, VX128(6, 80), VX128 )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vrlimi128, VX128_4(6, 1808), VX128_4)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrlimi128, VX128_4(6, 1808), VX128_4)(PPCHIRBuilder& f, InstrData& i) { const uint32_t vd = i.VX128_4.VD128l | (i.VX128_4.VD128h << 5); const uint32_t vb = i.VX128_4.VB128l | (i.VX128_4.VB128h << 5); uint32_t blend_mask_src = i.VX128_4.IMM; @@ -1268,7 +1268,7 @@ XEEMITTER(vrlimi128, VX128_4(6, 1808), VX128_4)(PPCFunctionBuilder& f, Inst return 0; } -int InstrEmit_vrsqrtefp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t vb) { +int InstrEmit_vrsqrtefp_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb) { // (VD) <- 1 / sqrt(VB) // There are a lot of rules in the Altivec_PEM docs for handlings that // result in nan/infinity/etc. They are ignored here. I hope games would @@ -1277,44 +1277,44 @@ int InstrEmit_vrsqrtefp_(PPCFunctionBuilder& f, uint32_t vd, uint32_t vb) { f.StoreVR(vd, v); return 0; } -XEEMITTER(vrsqrtefp, 0x1000014A, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrsqrtefp, 0x1000014A, VX )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vrsqrtefp_(f, i.VX.VD, i.VX.VB); } -XEEMITTER(vrsqrtefp128, VX128_3(6, 1648), VX128_3)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vrsqrtefp128, VX128_3(6, 1648), VX128_3)(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vrsqrtefp_(f, VX128_3_VD128, VX128_3_VB128); } -int InstrEmit_vsel_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { +int InstrEmit_vsel_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb, uint32_t vc) { Value* a = f.LoadVR(va); Value* v = f.Xor(f.And(f.Xor(a, f.LoadVR(vb)), f.LoadVR(vc)), a); f.StoreVR(vd, v); return 0; } -XEEMITTER(vsel, 0x1000002A, VXA )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vsel, 0x1000002A, VXA )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vsel_(f, i.VXA.VD, i.VXA.VA, i.VXA.VB, i.VXA.VC); } -XEEMITTER(vsel128, VX128(5, 848), VX128 )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vsel128, VX128(5, 848), VX128 )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_vsel_(f, VX128_VD128, VX128_VA128, VX128_VB128, VX128_VD128); } -XEEMITTER(vsl, 0x100001C4, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vsl, 0x100001C4, VX )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(vslb, 0x10000104, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vslb, 0x10000104, VX )(PPCHIRBuilder& f, InstrData& i) { Value* v = f.VectorShl(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT8_TYPE); f.StoreVR(i.VX.VD, v); return 0; } -XEEMITTER(vslh, 0x10000144, VX )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(vslh, 0x10000144, VX )(PPCHIRBuilder& f, InstrData& i) { Value* v = f.VectorShl(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT16_TYPE); f.StoreVR(i.VX.VD, v); return 0; } -int InstrEmit_vslw_(PPCFunctionBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { +int InstrEmit_vslw_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { // VA = |xxxxx|yyyyy|zzzzz|wwwww| // VB = |...sh|...sh|...sh|...sh| // VD = |x< #include -#include +#include using namespace alloy::frontend::ppc; @@ -25,7 +25,7 @@ namespace ppc { // Integer arithmetic (A-3) -XEEMITTER(addx, 0x7C000214, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addx, 0x7C000214, XO )(PPCHIRBuilder& f, InstrData& i) { // RD <- (RA) + (RB) Value* v = f.Add( f.LoadGPR(i.XO.RA), @@ -41,7 +41,7 @@ XEEMITTER(addx, 0x7C000214, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addcx, 0x7C000014, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addcx, 0x7C000014, XO )(PPCHIRBuilder& f, InstrData& i) { // RD <- (RA) + (RB) // CA <- carry bit Value* v = f.Add( @@ -60,7 +60,7 @@ XEEMITTER(addcx, 0x7C000014, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addex, 0x7C000114, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addex, 0x7C000114, XO )(PPCHIRBuilder& f, InstrData& i) { // RD <- (RA) + (RB) + XER[CA] Value* v = f.AddWithCarry( f.LoadGPR(i.XO.RA), @@ -79,7 +79,7 @@ XEEMITTER(addex, 0x7C000114, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addi, 0x38000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addi, 0x38000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // RT <- EXTS(SI) // else @@ -93,7 +93,7 @@ XEEMITTER(addi, 0x38000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addic, 0x30000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addic, 0x30000000, D )(PPCHIRBuilder& f, InstrData& i) { // RT <- (RA) + EXTS(SI) Value* v = f.Add( f.LoadGPR(i.D.RA), @@ -104,7 +104,7 @@ XEEMITTER(addic, 0x30000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addicx, 0x34000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addicx, 0x34000000, D )(PPCHIRBuilder& f, InstrData& i) { // RT <- (RA) + EXTS(SI) Value* v = f.Add( f.LoadGPR(i.D.RA), @@ -116,7 +116,7 @@ XEEMITTER(addicx, 0x34000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addis, 0x3C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addis, 0x3C000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // RT <- EXTS(SI) || i16.0 // else @@ -130,7 +130,7 @@ XEEMITTER(addis, 0x3C000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addmex, 0x7C0001D4, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addmex, 0x7C0001D4, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- (RA) + CA - 1 Value* v = f.AddWithCarry( f.LoadGPR(i.XO.RA), @@ -152,7 +152,7 @@ XEEMITTER(addmex, 0x7C0001D4, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(addzex, 0x7C000194, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(addzex, 0x7C000194, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- (RA) + CA Value* v = f.AddWithCarry( f.LoadGPR(i.XO.RA), @@ -174,7 +174,7 @@ XEEMITTER(addzex, 0x7C000194, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(divdx, 0x7C0003D2, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(divdx, 0x7C0003D2, XO )(PPCHIRBuilder& f, InstrData& i) { // dividend <- (RA) // divisor <- (RB) // if divisor = 0 then @@ -200,7 +200,7 @@ XEEMITTER(divdx, 0x7C0003D2, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(divdux, 0x7C000392, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(divdux, 0x7C000392, XO )(PPCHIRBuilder& f, InstrData& i) { // dividend <- (RA) // divisor <- (RB) // if divisor = 0 then @@ -226,7 +226,7 @@ f.StoreGPR(i.XO.RT, v); return 0; } -XEEMITTER(divwx, 0x7C0003D6, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(divwx, 0x7C0003D6, XO )(PPCHIRBuilder& f, InstrData& i) { // dividend[0:31] <- (RA)[32:63] // divisor[0:31] <- (RB)[32:63] // if divisor = 0 then @@ -254,7 +254,7 @@ XEEMITTER(divwx, 0x7C0003D6, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(divwux, 0x7C000396, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(divwux, 0x7C000396, XO )(PPCHIRBuilder& f, InstrData& i) { // dividend[0:31] <- (RA)[32:63] // divisor[0:31] <- (RB)[32:63] // if divisor = 0 then @@ -282,17 +282,17 @@ XEEMITTER(divwux, 0x7C000396, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mulhdx, 0x7C000092, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulhdx, 0x7C000092, XO )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mulhdux, 0x7C000012, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulhdux, 0x7C000012, XO )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mulhwx, 0x7C000096, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulhwx, 0x7C000096, XO )(PPCHIRBuilder& f, InstrData& i) { // RT[32:64] <- ((RA)[32:63] × (RB)[32:63])[0:31] if (i.XO.OE) { // With XER update. @@ -310,7 +310,7 @@ XEEMITTER(mulhwx, 0x7C000096, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mulhwux, 0x7C000016, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulhwux, 0x7C000016, XO )(PPCHIRBuilder& f, InstrData& i) { // RT[32:64] <- ((RA)[32:63] × (RB)[32:63])[0:31] if (i.XO.OE) { // With XER update. @@ -328,7 +328,7 @@ XEEMITTER(mulhwux, 0x7C000016, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mulldx, 0x7C0001D2, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulldx, 0x7C0001D2, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ((RA) × (RB))[64:127] if (i.XO.OE) { // With XER update. @@ -343,7 +343,7 @@ XEEMITTER(mulldx, 0x7C0001D2, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mulli, 0x1C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mulli, 0x1C000000, D )(PPCHIRBuilder& f, InstrData& i) { // prod[0:127] <- (RA) × EXTS(SI) // RT <- prod[64:127] Value* v = f.Mul(f.LoadGPR(i.D.RA), f.LoadConstant(XEEXTS16(i.D.DS))); @@ -351,7 +351,7 @@ XEEMITTER(mulli, 0x1C000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mullwx, 0x7C0001D6, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mullwx, 0x7C0001D6, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- (RA)[32:63] × (RB)[32:63] if (i.XO.OE) { // With XER update. @@ -368,7 +368,7 @@ XEEMITTER(mullwx, 0x7C0001D6, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(negx, 0x7C0000D0, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(negx, 0x7C0000D0, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + 1 if (i.XO.OE) { // With XER update. @@ -401,7 +401,7 @@ XEEMITTER(negx, 0x7C0000D0, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subfx, 0x7C000050, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subfx, 0x7C000050, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + (RB) + 1 Value* v = f.Sub(f.LoadGPR(i.XO.RB), f.LoadGPR(i.XO.RA)); f.StoreGPR(i.XO.RT, v); @@ -415,7 +415,7 @@ XEEMITTER(subfx, 0x7C000050, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subfcx, 0x7C000010, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subfcx, 0x7C000010, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + (RB) + 1 Value* v = f.Sub( f.LoadGPR(i.XO.RB), @@ -433,7 +433,7 @@ XEEMITTER(subfcx, 0x7C000010, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subficx, 0x20000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subficx, 0x20000000, D )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + EXTS(SI) + 1 Value* v = f.Sub( f.LoadConstant(XEEXTS16(i.D.DS)), @@ -444,7 +444,7 @@ XEEMITTER(subficx, 0x20000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subfex, 0x7C000110, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subfex, 0x7C000110, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + (RB) + CA Value* v = f.AddWithCarry( f.Not(f.LoadGPR(i.XO.RA)), @@ -463,7 +463,7 @@ XEEMITTER(subfex, 0x7C000110, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subfmex, 0x7C0001D0, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subfmex, 0x7C0001D0, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + CA - 1 Value* v = f.AddWithCarry( f.Not(f.LoadGPR(i.XO.RA)), @@ -482,7 +482,7 @@ XEEMITTER(subfmex, 0x7C0001D0, XO )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(subfzex, 0x7C000190, XO )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(subfzex, 0x7C000190, XO )(PPCHIRBuilder& f, InstrData& i) { // RT <- ¬(RA) + CA Value* v = f.AddWithCarry( f.Not(f.LoadGPR(i.XO.RA)), @@ -504,7 +504,7 @@ XEEMITTER(subfzex, 0x7C000190, XO )(PPCFunctionBuilder& f, InstrData& i) { // Integer compare (A-4) -XEEMITTER(cmp, 0x7C000000, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cmp, 0x7C000000, X )(PPCHIRBuilder& f, InstrData& i) { // if L = 0 then // a <- EXTS((RA)[32:63]) // b <- EXTS((RB)[32:63]) @@ -533,7 +533,7 @@ XEEMITTER(cmp, 0x7C000000, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(cmpi, 0x2C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cmpi, 0x2C000000, D )(PPCHIRBuilder& f, InstrData& i) { // if L = 0 then // a <- EXTS((RA)[32:63]) // else @@ -560,7 +560,7 @@ XEEMITTER(cmpi, 0x2C000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(cmpl, 0x7C000040, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cmpl, 0x7C000040, X )(PPCHIRBuilder& f, InstrData& i) { // if L = 0 then // a <- i32.0 || (RA)[32:63] // b <- i32.0 || (RB)[32:63] @@ -589,7 +589,7 @@ XEEMITTER(cmpl, 0x7C000040, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(cmpli, 0x28000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cmpli, 0x28000000, D )(PPCHIRBuilder& f, InstrData& i) { // if L = 0 then // a <- i32.0 || (RA)[32:63] // else @@ -619,7 +619,7 @@ XEEMITTER(cmpli, 0x28000000, D )(PPCFunctionBuilder& f, InstrData& i) { // Integer logical (A-5) -XEEMITTER(andx, 0x7C000038, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(andx, 0x7C000038, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) & (RB) Value* ra = f.And(f.LoadGPR(i.X.RT), f.LoadGPR(i.X.RB)); if (i.X.Rc) { @@ -629,7 +629,7 @@ XEEMITTER(andx, 0x7C000038, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(andcx, 0x7C000078, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(andcx, 0x7C000078, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) & ¬(RB) Value* ra = f.And(f.LoadGPR(i.X.RT), f.Not(f.LoadGPR(i.X.RB))); if (i.X.Rc) { @@ -639,7 +639,7 @@ XEEMITTER(andcx, 0x7C000078, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(andix, 0x70000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(andix, 0x70000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) & (i48.0 || UI) Value* ra = f.And( f.LoadGPR(i.D.RT), @@ -649,7 +649,7 @@ XEEMITTER(andix, 0x70000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(andisx, 0x74000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(andisx, 0x74000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) & (i32.0 || UI || i16.0) Value* ra = f.And( f.LoadGPR(i.D.RT), @@ -659,7 +659,7 @@ XEEMITTER(andisx, 0x74000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(cntlzdx, 0x7C000074, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cntlzdx, 0x7C000074, X )(PPCHIRBuilder& f, InstrData& i) { // n <- 0 // do while n < 64 // if (RS)[n] = 1 then leave n @@ -674,7 +674,7 @@ XEEMITTER(cntlzdx, 0x7C000074, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(cntlzwx, 0x7C000034, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cntlzwx, 0x7C000034, X )(PPCHIRBuilder& f, InstrData& i) { // n <- 32 // do while n < 64 // if (RS)[n] = 1 then leave n @@ -690,7 +690,7 @@ XEEMITTER(cntlzwx, 0x7C000034, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(eqvx, 0x7C000238, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(eqvx, 0x7C000238, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) == (RB) Value* ra = f.Xor(f.LoadGPR(i.X.RT), f.LoadGPR(i.X.RB)); ra = f.Not(ra); @@ -701,7 +701,7 @@ XEEMITTER(eqvx, 0x7C000238, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(extsbx, 0x7C000774, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(extsbx, 0x7C000774, X )(PPCHIRBuilder& f, InstrData& i) { // s <- (RS)[56] // RA[56:63] <- (RS)[56:63] // RA[0:55] <- i56.s @@ -714,7 +714,7 @@ XEEMITTER(extsbx, 0x7C000774, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(extshx, 0x7C000734, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(extshx, 0x7C000734, X )(PPCHIRBuilder& f, InstrData& i) { // s <- (RS)[48] // RA[48:63] <- (RS)[48:63] // RA[0:47] <- 48.s @@ -727,7 +727,7 @@ XEEMITTER(extshx, 0x7C000734, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(extswx, 0x7C0007B4, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(extswx, 0x7C0007B4, X )(PPCHIRBuilder& f, InstrData& i) { // s <- (RS)[32] // RA[32:63] <- (RS)[32:63] // RA[0:31] <- i32.s @@ -740,12 +740,12 @@ XEEMITTER(extswx, 0x7C0007B4, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(nandx, 0x7C0003B8, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(nandx, 0x7C0003B8, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(norx, 0x7C0000F8, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(norx, 0x7C0000F8, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- ¬((RS) | (RB)) Value* ra = f.Or( f.LoadGPR(i.X.RT), @@ -758,7 +758,7 @@ XEEMITTER(norx, 0x7C0000F8, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(orx, 0x7C000378, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(orx, 0x7C000378, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) | (RB) if (i.X.RT == i.X.RB && i.X.RT == i.X.RA && !i.X.Rc) { @@ -781,7 +781,7 @@ XEEMITTER(orx, 0x7C000378, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(orcx, 0x7C000338, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(orcx, 0x7C000338, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) | ¬(RB) Value* ra = f.Or( f.LoadGPR(i.X.RT), @@ -793,7 +793,7 @@ XEEMITTER(orcx, 0x7C000338, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(ori, 0x60000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ori, 0x60000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) | (i48.0 || UI) if (!i.D.RA && !i.D.RT && !i.D.DS) { f.Nop(); @@ -806,7 +806,7 @@ XEEMITTER(ori, 0x60000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(oris, 0x64000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(oris, 0x64000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) | (i32.0 || UI || i16.0) Value* ra = f.Or( f.LoadGPR(i.D.RT), @@ -815,7 +815,7 @@ XEEMITTER(oris, 0x64000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(xorx, 0x7C000278, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(xorx, 0x7C000278, X )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) XOR (RB) Value* ra = f.Xor( f.LoadGPR(i.X.RT), @@ -827,7 +827,7 @@ XEEMITTER(xorx, 0x7C000278, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(xori, 0x68000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(xori, 0x68000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) XOR (i48.0 || UI) Value* ra = f.Xor( f.LoadGPR(i.D.RT), @@ -836,7 +836,7 @@ XEEMITTER(xori, 0x68000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(xoris, 0x6C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(xoris, 0x6C000000, D )(PPCHIRBuilder& f, InstrData& i) { // RA <- (RS) XOR (i32.0 || UI || i16.0) Value* ra = f.Xor( f.LoadGPR(i.D.RT), @@ -848,7 +848,7 @@ XEEMITTER(xoris, 0x6C000000, D )(PPCFunctionBuilder& f, InstrData& i) { // Integer rotate (A-6) -XEEMITTER(rld, 0x78000000, MDS)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(rld, 0x78000000, MDS)(PPCHIRBuilder& f, InstrData& i) { if (i.MD.idx == 0) { // XEEMITTER(rldiclx, 0x78000000, MD ) // n <- sh[5] || sh[0:4] @@ -941,7 +941,7 @@ XEEMITTER(rld, 0x78000000, MDS)(PPCFunctionBuilder& f, InstrData& i) { } } -XEEMITTER(rlwimix, 0x50000000, M )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(rlwimix, 0x50000000, M )(PPCHIRBuilder& f, InstrData& i) { // n <- SH // r <- ROTL32((RS)[32:63], n) // m <- MASK(MB+32, ME+32) @@ -965,7 +965,7 @@ XEEMITTER(rlwimix, 0x50000000, M )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(rlwinmx, 0x54000000, M )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(rlwinmx, 0x54000000, M )(PPCHIRBuilder& f, InstrData& i) { // n <- SH // r <- ROTL32((RS)[32:63], n) // m <- MASK(MB+32, ME+32) @@ -992,7 +992,7 @@ XEEMITTER(rlwinmx, 0x54000000, M )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(rlwnmx, 0x5C000000, M )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(rlwnmx, 0x5C000000, M )(PPCHIRBuilder& f, InstrData& i) { // n <- (RB)[59:63] // r <- ROTL32((RS)[32:63], n) // m <- MASK(MB+32, ME+32) @@ -1016,7 +1016,7 @@ XEEMITTER(rlwnmx, 0x5C000000, M )(PPCFunctionBuilder& f, InstrData& i) { // Integer shift (A-7) -XEEMITTER(sldx, 0x7C000036, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sldx, 0x7C000036, X )(PPCHIRBuilder& f, InstrData& i) { // n <- (RB)[59:63] // r <- ROTL64((RS), n) // if (RB)[58] = 0 then @@ -1032,7 +1032,7 @@ XEEMITTER(sldx, 0x7C000036, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(slwx, 0x7C000030, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(slwx, 0x7C000030, X )(PPCHIRBuilder& f, InstrData& i) { // n <- (RB)[59:63] // r <- ROTL32((RS)[32:63], n) // if (RB)[58] = 0 then @@ -1050,7 +1050,7 @@ XEEMITTER(slwx, 0x7C000030, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(srdx, 0x7C000436, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(srdx, 0x7C000436, X )(PPCHIRBuilder& f, InstrData& i) { // n <- (RB)[58:63] // r <- ROTL64((RS), 64-n) // if (RB)[57] = 0 then @@ -1067,7 +1067,7 @@ XEEMITTER(srdx, 0x7C000436, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(srwx, 0x7C000430, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(srwx, 0x7C000430, X )(PPCHIRBuilder& f, InstrData& i) { // n <- (RB)[59:63] // r <- ROTL32((RS)[32:63], 64-n) // if (RB)[58] = 0 then @@ -1086,7 +1086,7 @@ XEEMITTER(srwx, 0x7C000430, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -// XEEMITTER(sradx, 0x7C000634, X )(PPCFunctionBuilder& f, InstrData& i) { +// XEEMITTER(sradx, 0x7C000634, X )(PPCHIRBuilder& f, InstrData& i) { // // n <- rB[58-63] // // r <- ROTL[64](rS, 64 - n) // // if rB[57] = 0 then m ← MASK(n, 63) @@ -1138,7 +1138,7 @@ XEEMITTER(srwx, 0x7C000430, X )(PPCFunctionBuilder& f, InstrData& i) { // return 0; // } -XEEMITTER(sradix, 0x7C000674, XS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sradix, 0x7C000674, XS )(PPCHIRBuilder& f, InstrData& i) { // n <- sh[5] || sh[0-4] // r <- ROTL[64](rS, 64 - n) // m ← MASK(n, 63) @@ -1167,7 +1167,7 @@ XEEMITTER(sradix, 0x7C000674, XS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(srawx, 0x7C000630, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(srawx, 0x7C000630, X )(PPCHIRBuilder& f, InstrData& i) { // n <- rB[59-63] // r <- ROTL32((RS)[32:63], 64-n) // m <- MASK(n+32, 63) @@ -1196,7 +1196,7 @@ XEEMITTER(srawx, 0x7C000630, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(srawix, 0x7C000670, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(srawix, 0x7C000670, X )(PPCHIRBuilder& f, InstrData& i) { // n <- SH // r <- ROTL32((RS)[32:63], 64-n) // m <- MASK(n+32, 63) diff --git a/src/alloy/frontend/ppc/ppc_emit_control.cc b/src/alloy/frontend/ppc/ppc_emit_control.cc index 186a32cd7..f4dfcca82 100644 --- a/src/alloy/frontend/ppc/ppc_emit_control.cc +++ b/src/alloy/frontend/ppc/ppc_emit_control.cc @@ -10,7 +10,7 @@ #include #include -#include +#include using namespace alloy::frontend::ppc; @@ -24,7 +24,7 @@ namespace ppc { int InstrEmit_branch( - PPCFunctionBuilder& f, const char* src, uint64_t cia, + PPCHIRBuilder& f, const char* src, uint64_t cia, Value* nia, bool lk, Value* cond = NULL, bool expect_true = true) { uint32_t call_flags = 0; @@ -93,7 +93,7 @@ int InstrEmit_branch( } -XEEMITTER(bx, 0x48000000, I )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(bx, 0x48000000, I )(PPCHIRBuilder& f, InstrData& i) { // if AA then // NIA <- EXTS(LI || 0b00) // else @@ -112,7 +112,7 @@ XEEMITTER(bx, 0x48000000, I )(PPCFunctionBuilder& f, InstrData& i) { f, "bx", i.address, f.LoadConstant(nia), i.I.LK); } -XEEMITTER(bcx, 0x40000000, B )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(bcx, 0x40000000, B )(PPCHIRBuilder& f, InstrData& i) { // if ¬BO[2] then // CTR <- CTR - 1 // ctr_ok <- BO[2] | ((CTR[0:63] != 0) XOR BO[3]) @@ -188,7 +188,7 @@ XEEMITTER(bcx, 0x40000000, B )(PPCFunctionBuilder& f, InstrData& i) { f, "bcx", i.address, f.LoadConstant(nia), i.B.LK, ok, expect_true); } -XEEMITTER(bcctrx, 0x4C000420, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(bcctrx, 0x4C000420, XL )(PPCHIRBuilder& f, InstrData& i) { // cond_ok <- BO[0] | (CR[BI+32] ≡ BO[1]) // if cond_ok then // NIA <- CTR[0:61] || 0b00 @@ -220,7 +220,7 @@ XEEMITTER(bcctrx, 0x4C000420, XL )(PPCFunctionBuilder& f, InstrData& i) { f, "bcctrx", i.address, f.LoadCTR(), i.XL.LK, cond_ok, expect_true); } -XEEMITTER(bclrx, 0x4C000020, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(bclrx, 0x4C000020, XL )(PPCHIRBuilder& f, InstrData& i) { // if ¬BO[2] then // CTR <- CTR - 1 // ctr_ok <- BO[2] | ((CTR[0:63] != 0) XOR BO[3] @@ -314,47 +314,47 @@ XEEMITTER(bclrx, 0x4C000020, XL )(PPCFunctionBuilder& f, InstrData& i) { // Condition register logical (A-23) -XEEMITTER(crand, 0x4C000202, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crand, 0x4C000202, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(crandc, 0x4C000102, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crandc, 0x4C000102, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(creqv, 0x4C000242, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(creqv, 0x4C000242, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(crnand, 0x4C0001C2, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crnand, 0x4C0001C2, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(crnor, 0x4C000042, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crnor, 0x4C000042, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(cror, 0x4C000382, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(cror, 0x4C000382, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(crorc, 0x4C000342, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crorc, 0x4C000342, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(crxor, 0x4C000182, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(crxor, 0x4C000182, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mcrf, 0x4C000000, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mcrf, 0x4C000000, XL )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } @@ -362,7 +362,7 @@ XEEMITTER(mcrf, 0x4C000000, XL )(PPCFunctionBuilder& f, InstrData& i) { // System linkage (A-24) -XEEMITTER(sc, 0x44000002, SC )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sc, 0x44000002, SC )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } @@ -370,7 +370,7 @@ XEEMITTER(sc, 0x44000002, SC )(PPCFunctionBuilder& f, InstrData& i) { // Trap (A-25) -int InstrEmit_trap(PPCFunctionBuilder& f, InstrData& i, +int InstrEmit_trap(PPCHIRBuilder& f, InstrData& i, Value* va, Value* vb, uint32_t TO) { // if (a < b) & TO[0] then TRAP // if (a > b) & TO[1] then TRAP @@ -406,7 +406,7 @@ int InstrEmit_trap(PPCFunctionBuilder& f, InstrData& i, return 0; } -XEEMITTER(td, 0x7C000088, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(td, 0x7C000088, X )(PPCHIRBuilder& f, InstrData& i) { // a <- (RA) // b <- (RB) // if (a < b) & TO[0] then TRAP @@ -419,7 +419,7 @@ XEEMITTER(td, 0x7C000088, X )(PPCFunctionBuilder& f, InstrData& i) { return InstrEmit_trap(f, i, ra, rb, i.X.RT); } -XEEMITTER(tdi, 0x08000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(tdi, 0x08000000, D )(PPCHIRBuilder& f, InstrData& i) { // a <- (RA) // if (a < EXTS(SI)) & TO[0] then TRAP // if (a > EXTS(SI)) & TO[1] then TRAP @@ -431,7 +431,7 @@ XEEMITTER(tdi, 0x08000000, D )(PPCFunctionBuilder& f, InstrData& i) { return InstrEmit_trap(f, i, ra, rb, i.D.RT); } -XEEMITTER(tw, 0x7C000008, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(tw, 0x7C000008, X )(PPCHIRBuilder& f, InstrData& i) { // a <- EXTS((RA)[32:63]) // b <- EXTS((RB)[32:63]) // if (a < b) & TO[0] then TRAP @@ -446,7 +446,7 @@ XEEMITTER(tw, 0x7C000008, X )(PPCFunctionBuilder& f, InstrData& i) { return InstrEmit_trap(f, i, ra, rb, i.X.RT); } -XEEMITTER(twi, 0x0C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(twi, 0x0C000000, D )(PPCHIRBuilder& f, InstrData& i) { // a <- EXTS((RA)[32:63]) // if (a < EXTS(SI)) & TO[0] then TRAP // if (a > EXTS(SI)) & TO[1] then TRAP @@ -462,12 +462,12 @@ XEEMITTER(twi, 0x0C000000, D )(PPCFunctionBuilder& f, InstrData& i) { // Processor control (A-26) -XEEMITTER(mfcr, 0x7C000026, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mfcr, 0x7C000026, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mfspr, 0x7C0002A6, XFX)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mfspr, 0x7C0002A6, XFX)(PPCHIRBuilder& f, InstrData& i) { // n <- spr[5:9] || spr[0:4] // if length(SPR(n)) = 64 then // RT <- SPR(n) @@ -497,7 +497,7 @@ XEEMITTER(mfspr, 0x7C0002A6, XFX)(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mftb, 0x7C0002E6, XFX)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mftb, 0x7C0002E6, XFX)(PPCHIRBuilder& f, InstrData& i) { Value* time; LARGE_INTEGER counter; if (QueryPerformanceCounter(&counter)) { @@ -510,12 +510,12 @@ XEEMITTER(mftb, 0x7C0002E6, XFX)(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(mtcrf, 0x7C000120, XFX)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtcrf, 0x7C000120, XFX)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtspr, 0x7C0003A6, XFX)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtspr, 0x7C0003A6, XFX)(PPCHIRBuilder& f, InstrData& i) { // n <- spr[5:9] || spr[0:4] // if length(SPR(n)) = 64 then // SPR(n) <- (RS) @@ -549,17 +549,17 @@ XEEMITTER(mtspr, 0x7C0003A6, XFX)(PPCFunctionBuilder& f, InstrData& i) { // TODO(benvanik): MSR is used for toggling interrupts, and it'd be nice to // obey that setting. It's usually guarding atomic stores. -XEEMITTER(mfmsr, 0x7C0000A6, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mfmsr, 0x7C0000A6, X )(PPCHIRBuilder& f, InstrData& i) { f.Nop(); return 0; } -XEEMITTER(mtmsr, 0x7C000124, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtmsr, 0x7C000124, X )(PPCHIRBuilder& f, InstrData& i) { f.Nop(); return 0; } -XEEMITTER(mtmsrd, 0x7C000164, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtmsrd, 0x7C000164, X )(PPCHIRBuilder& f, InstrData& i) { f.Nop(); return 0; } diff --git a/src/alloy/frontend/ppc/ppc_emit_fpu.cc b/src/alloy/frontend/ppc/ppc_emit_fpu.cc index f79a220a2..683a2d3de 100644 --- a/src/alloy/frontend/ppc/ppc_emit_fpu.cc +++ b/src/alloy/frontend/ppc/ppc_emit_fpu.cc @@ -10,7 +10,7 @@ #include #include -#include +#include using namespace alloy::frontend::ppc; @@ -35,7 +35,7 @@ namespace ppc { // Floating-point arithmetic (A-8) -XEEMITTER(faddx, 0xFC00002A, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(faddx, 0xFC00002A, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) + (frB) Value* v = f.Add(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); f.StoreFPR(i.A.FRT, v); @@ -48,7 +48,7 @@ XEEMITTER(faddx, 0xFC00002A, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(faddsx, 0xEC00002A, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(faddsx, 0xEC00002A, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) + (frB) Value* v = f.Add(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); v = f.Convert(f.Convert(v, FLOAT32_TYPE), FLOAT64_TYPE); @@ -62,7 +62,7 @@ XEEMITTER(faddsx, 0xEC00002A, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fdivx, 0xFC000024, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fdivx, 0xFC000024, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- frA / frB Value* v = f.Div(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); f.StoreFPR(i.A.FRT, v); @@ -75,7 +75,7 @@ XEEMITTER(fdivx, 0xFC000024, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fdivsx, 0xEC000024, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fdivsx, 0xEC000024, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- frA / frB Value* v = f.Div(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); v = f.Convert(f.Convert(v, FLOAT32_TYPE), FLOAT64_TYPE); @@ -89,7 +89,7 @@ XEEMITTER(fdivsx, 0xEC000024, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmulx, 0xFC000032, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmulx, 0xFC000032, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) x (frC) Value* v = f.Mul(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRC)); f.StoreFPR(i.A.FRT, v); @@ -102,7 +102,7 @@ XEEMITTER(fmulx, 0xFC000032, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmulsx, 0xEC000032, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmulsx, 0xEC000032, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) x (frC) Value* v = f.Mul(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRC)); v = f.Convert(f.Convert(v, FLOAT32_TYPE), FLOAT64_TYPE); @@ -116,17 +116,17 @@ XEEMITTER(fmulsx, 0xEC000032, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fresx, 0xEC000030, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fresx, 0xEC000030, A )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(frsqrtex, 0xFC000034, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(frsqrtex, 0xFC000034, A )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(fsubx, 0xFC000028, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fsubx, 0xFC000028, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) - (frB) Value* v = f.Sub(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); f.StoreFPR(i.A.FRT, v); @@ -139,7 +139,7 @@ XEEMITTER(fsubx, 0xFC000028, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fsubsx, 0xEC000028, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fsubsx, 0xEC000028, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA) - (frB) Value* v = f.Sub(f.LoadFPR(i.A.FRA), f.LoadFPR(i.A.FRB)); v = f.Convert(f.Convert(v, FLOAT32_TYPE), FLOAT64_TYPE); @@ -153,7 +153,7 @@ XEEMITTER(fsubsx, 0xEC000028, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fselx, 0xFC00002E, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fselx, 0xFC00002E, A )(PPCHIRBuilder& f, InstrData& i) { // if (frA) >= 0.0 // then frD <- (frC) // else frD <- (frB) @@ -168,7 +168,7 @@ XEEMITTER(fselx, 0xFC00002E, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fsqrtx, 0xFC00002C, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fsqrtx, 0xFC00002C, A )(PPCHIRBuilder& f, InstrData& i) { // Double precision: // frD <- sqrt(frB) Value* v = f.Sqrt(f.LoadFPR(i.A.FRA)); @@ -182,7 +182,7 @@ XEEMITTER(fsqrtx, 0xFC00002C, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fsqrtsx, 0xEC00002C, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fsqrtsx, 0xEC00002C, A )(PPCHIRBuilder& f, InstrData& i) { // Single precision: // frD <- sqrt(frB) Value* v = f.Sqrt(f.LoadFPR(i.A.FRA)); @@ -200,7 +200,7 @@ XEEMITTER(fsqrtsx, 0xEC00002C, A )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point multiply-add (A-9) -XEEMITTER(fmaddx, 0xFC00003A, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmaddx, 0xFC00003A, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA x frC) + frB Value* v = f.MulAdd( f.LoadFPR(i.A.FRA), @@ -216,7 +216,7 @@ XEEMITTER(fmaddx, 0xFC00003A, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmaddsx, 0xEC00003A, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmaddsx, 0xEC00003A, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA x frC) + frB Value* v = f.MulAdd( f.LoadFPR(i.A.FRA), @@ -233,7 +233,7 @@ XEEMITTER(fmaddsx, 0xEC00003A, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmsubx, 0xFC000038, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmsubx, 0xFC000038, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA x frC) - frB Value* v = f.MulSub( f.LoadFPR(i.A.FRA), @@ -249,7 +249,7 @@ XEEMITTER(fmsubx, 0xFC000038, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmsubsx, 0xEC000038, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmsubsx, 0xEC000038, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frA x frC) - frB Value* v = f.MulSub( f.LoadFPR(i.A.FRA), @@ -266,17 +266,17 @@ XEEMITTER(fmsubsx, 0xEC000038, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fnmaddx, 0xFC00003E, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnmaddx, 0xFC00003E, A )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(fnmaddsx, 0xEC00003E, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnmaddsx, 0xEC00003E, A )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(fnmsubx, 0xFC00003C, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnmsubx, 0xFC00003C, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- -([frA x frC] - frB) Value* v = f.Neg(f.MulSub( f.LoadFPR(i.A.FRA), @@ -292,7 +292,7 @@ XEEMITTER(fnmsubx, 0xFC00003C, A )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fnmsubsx, 0xEC00003C, A )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnmsubsx, 0xEC00003C, A )(PPCHIRBuilder& f, InstrData& i) { // frD <- -([frA x frC] - frB) Value* v = f.Neg(f.MulSub( f.LoadFPR(i.A.FRA), @@ -312,7 +312,7 @@ XEEMITTER(fnmsubsx, 0xEC00003C, A )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point rounding and conversion (A-10) -XEEMITTER(fcfidx, 0xFC00069C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fcfidx, 0xFC00069C, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- signed_int64_to_double( frB ) Value* v = f.Convert( f.Cast(f.LoadFPR(i.A.FRB), INT64_TYPE), @@ -327,7 +327,7 @@ XEEMITTER(fcfidx, 0xFC00069C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fctidx, 0xFC00065C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fctidx, 0xFC00065C, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- double_to_signed_int64( frB ) // TODO(benvanik): pull from FPSCR[RN] RoundMode round_mode = ROUND_TO_ZERO; @@ -343,12 +343,12 @@ XEEMITTER(fctidx, 0xFC00065C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fctidzx, 0xFC00065E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fctidzx, 0xFC00065E, X )(PPCHIRBuilder& f, InstrData& i) { // TODO(benvanik): assuming round to zero is always set, is that ok? return InstrEmit_fctidx(f, i); } -XEEMITTER(fctiwx, 0xFC00001C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fctiwx, 0xFC00001C, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- double_to_signed_int32( frB ) // TODO(benvanik): pull from FPSCR[RN] RoundMode round_mode = ROUND_TO_ZERO; @@ -364,12 +364,12 @@ XEEMITTER(fctiwx, 0xFC00001C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fctiwzx, 0xFC00001E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fctiwzx, 0xFC00001E, X )(PPCHIRBuilder& f, InstrData& i) { // TODO(benvanik): assuming round to zero is always set, is that ok? return InstrEmit_fctiwx(f, i); } -XEEMITTER(frspx, 0xFC000018, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(frspx, 0xFC000018, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- Round_single(frB) // TODO(benvanik): pull from FPSCR[RN] RoundMode round_mode = ROUND_TO_ZERO; @@ -388,7 +388,7 @@ XEEMITTER(frspx, 0xFC000018, X )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point compare (A-11) -int InstrEmit_fcmpx_(PPCFunctionBuilder& f, InstrData& i, bool ordered) { +int InstrEmit_fcmpx_(PPCHIRBuilder& f, InstrData& i, bool ordered) { // if (FRA) is a NaN or (FRB) is a NaN then // c <- 0b0001 // else if (FRA) < (FRB) then @@ -410,42 +410,42 @@ int InstrEmit_fcmpx_(PPCFunctionBuilder& f, InstrData& i, bool ordered) { f.UpdateCR(crf, f.LoadFPR(i.X.RA), f.LoadFPR(i.X.RB), false); return 0; } -XEEMITTER(fcmpo, 0xFC000040, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fcmpo, 0xFC000040, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_fcmpx_(f, i, true); } -XEEMITTER(fcmpu, 0xFC000000, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fcmpu, 0xFC000000, X )(PPCHIRBuilder& f, InstrData& i) { return InstrEmit_fcmpx_(f, i, false); } // Floating-point status and control register (A -XEEMITTER(mcrfs, 0xFC000080, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mcrfs, 0xFC000080, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mffsx, 0xFC00048E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mffsx, 0xFC00048E, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtfsb0x, 0xFC00008C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtfsb0x, 0xFC00008C, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtfsb1x, 0xFC00004C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtfsb1x, 0xFC00004C, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtfsfx, 0xFC00058E, XFL)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtfsfx, 0xFC00058E, XFL)(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(mtfsfix, 0xFC00010C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(mtfsfix, 0xFC00010C, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } @@ -453,7 +453,7 @@ XEEMITTER(mtfsfix, 0xFC00010C, X )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point move (A-21) -XEEMITTER(fabsx, 0xFC000210, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fabsx, 0xFC000210, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- abs(frB) Value* v = f.Abs(f.LoadFPR(i.X.RB)); f.StoreFPR(i.X.RT, v); @@ -465,7 +465,7 @@ XEEMITTER(fabsx, 0xFC000210, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fmrx, 0xFC000090, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fmrx, 0xFC000090, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- (frB) Value* v = f.LoadFPR(i.X.RB); f.StoreFPR(i.X.RT, v); @@ -477,12 +477,12 @@ XEEMITTER(fmrx, 0xFC000090, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(fnabsx, 0xFC000110, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnabsx, 0xFC000110, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(fnegx, 0xFC000050, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(fnegx, 0xFC000050, X )(PPCHIRBuilder& f, InstrData& i) { // frD <- ¬ frB[0] || frB[1-63] Value* v = f.Neg(f.LoadFPR(i.X.RB)); f.StoreFPR(i.X.RT, v); diff --git a/src/alloy/frontend/ppc/ppc_emit_memory.cc b/src/alloy/frontend/ppc/ppc_emit_memory.cc index 3b4c72a48..ab810f6b2 100644 --- a/src/alloy/frontend/ppc/ppc_emit_memory.cc +++ b/src/alloy/frontend/ppc/ppc_emit_memory.cc @@ -10,7 +10,7 @@ #include #include -#include +#include using namespace alloy::frontend::ppc; @@ -24,7 +24,7 @@ namespace ppc { #define TRUNCATE_ADDRESSES 0 -Value* CalculateEA(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb) { +Value* CalculateEA(PPCHIRBuilder& f, uint32_t ra, uint32_t rb) { #if TRUNCATE_ADDRESSES return f.ZeroExtend(f.Add( f.Truncate(f.LoadGPR(ra), INT32_TYPE), @@ -34,7 +34,7 @@ Value* CalculateEA(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb) { #endif // TRUNCATE_ADDRESSES } -Value* CalculateEA_0(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb) { +Value* CalculateEA_0(PPCHIRBuilder& f, uint32_t ra, uint32_t rb) { #if TRUNCATE_ADDRESSES if (ra) { return f.ZeroExtend(f.Add( @@ -52,7 +52,7 @@ Value* CalculateEA_0(PPCFunctionBuilder& f, uint32_t ra, uint32_t rb) { #endif // TRUNCATE_ADDRESSES } -Value* CalculateEA_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm) { +Value* CalculateEA_i(PPCHIRBuilder& f, uint32_t ra, uint64_t imm) { #if TRUNCATE_ADDRESSES return f.ZeroExtend(f.Add( f.Truncate(f.LoadGPR(ra), INT32_TYPE), @@ -62,7 +62,7 @@ Value* CalculateEA_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm) { #endif // TRUNCATE_ADDRESSES } -Value* CalculateEA_0_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm) { +Value* CalculateEA_0_i(PPCHIRBuilder& f, uint32_t ra, uint64_t imm) { #if TRUNCATE_ADDRESSES if (ra) { return f.ZeroExtend(f.Add( @@ -83,7 +83,7 @@ Value* CalculateEA_0_i(PPCFunctionBuilder& f, uint32_t ra, uint64_t imm) { // Integer load (A-13) -XEEMITTER(lbz, 0x88000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lbz, 0x88000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -96,7 +96,7 @@ XEEMITTER(lbz, 0x88000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lbzu, 0x8C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lbzu, 0x8C000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // RT <- i56.0 || MEM(EA, 1) // RA <- EA @@ -107,7 +107,7 @@ XEEMITTER(lbzu, 0x8C000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lbzux, 0x7C0000EE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lbzux, 0x7C0000EE, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // RT <- i56.0 || MEM(EA, 1) // RA <- EA @@ -118,7 +118,7 @@ XEEMITTER(lbzux, 0x7C0000EE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lbzx, 0x7C0000AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lbzx, 0x7C0000AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -131,7 +131,7 @@ XEEMITTER(lbzx, 0x7C0000AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lha, 0xA8000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lha, 0xA8000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -144,17 +144,17 @@ XEEMITTER(lha, 0xA8000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lhau, 0xAC000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhau, 0xAC000000, D )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lhaux, 0x7C0002EE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhaux, 0x7C0002EE, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lhax, 0x7C0002AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhax, 0x7C0002AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -167,7 +167,7 @@ XEEMITTER(lhax, 0x7C0002AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lhz, 0xA0000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhz, 0xA0000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -180,7 +180,7 @@ XEEMITTER(lhz, 0xA0000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lhzu, 0xA4000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhzu, 0xA4000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // RT <- i48.0 || MEM(EA, 2) // RA <- EA @@ -191,7 +191,7 @@ XEEMITTER(lhzu, 0xA4000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lhzux, 0x7C00026E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhzux, 0x7C00026E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // RT <- i48.0 || MEM(EA, 2) // RA <- EA @@ -202,7 +202,7 @@ XEEMITTER(lhzux, 0x7C00026E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lhzx, 0x7C00022E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhzx, 0x7C00022E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -215,7 +215,7 @@ XEEMITTER(lhzx, 0x7C00022E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwa, 0xE8000002, DS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwa, 0xE8000002, DS )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -228,7 +228,7 @@ XEEMITTER(lwa, 0xE8000002, DS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwaux, 0x7C0002EA, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwaux, 0x7C0002EA, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // RT <- EXTS(MEM(EA, 4)) // RA <- EA @@ -239,7 +239,7 @@ XEEMITTER(lwaux, 0x7C0002EA, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwax, 0x7C0002AA, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwax, 0x7C0002AA, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -252,7 +252,7 @@ XEEMITTER(lwax, 0x7C0002AA, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwz, 0x80000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwz, 0x80000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -265,7 +265,7 @@ XEEMITTER(lwz, 0x80000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwzu, 0x84000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwzu, 0x84000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // RT <- i32.0 || MEM(EA, 4) // RA <- EA @@ -276,7 +276,7 @@ XEEMITTER(lwzu, 0x84000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwzux, 0x7C00006E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwzux, 0x7C00006E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // RT <- i32.0 || MEM(EA, 4) // RA <- EA @@ -287,7 +287,7 @@ XEEMITTER(lwzux, 0x7C00006E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwzx, 0x7C00002E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwzx, 0x7C00002E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -301,7 +301,7 @@ XEEMITTER(lwzx, 0x7C00002E, X )(PPCFunctionBuilder& f, InstrData& i) { } -XEEMITTER(ld, 0xE8000000, DS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ld, 0xE8000000, DS )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -314,7 +314,7 @@ XEEMITTER(ld, 0xE8000000, DS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(ldu, 0xE8000001, DS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ldu, 0xE8000001, DS )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(DS || 0b00) // RT <- MEM(EA, 8) // RA <- EA @@ -325,7 +325,7 @@ XEEMITTER(ldu, 0xE8000001, DS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(ldux, 0x7C00006A, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ldux, 0x7C00006A, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // RT <- MEM(EA, 8) // RA <- EA @@ -336,7 +336,7 @@ XEEMITTER(ldux, 0x7C00006A, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(ldx, 0x7C00002A, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ldx, 0x7C00002A, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -352,7 +352,7 @@ XEEMITTER(ldx, 0x7C00002A, X )(PPCFunctionBuilder& f, InstrData& i) { // Integer store (A-14) -XEEMITTER(stb, 0x98000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stb, 0x98000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -364,7 +364,7 @@ XEEMITTER(stb, 0x98000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stbu, 0x9C000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stbu, 0x9C000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // MEM(EA, 1) <- (RS)[56:63] // RA <- EA @@ -374,7 +374,7 @@ XEEMITTER(stbu, 0x9C000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stbux, 0x7C0001EE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stbux, 0x7C0001EE, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 1) <- (RS)[56:63] // RA <- EA @@ -384,7 +384,7 @@ XEEMITTER(stbux, 0x7C0001EE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stbx, 0x7C0001AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stbx, 0x7C0001AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -396,7 +396,7 @@ XEEMITTER(stbx, 0x7C0001AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(sth, 0xB0000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sth, 0xB0000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -408,7 +408,7 @@ XEEMITTER(sth, 0xB0000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(sthu, 0xB4000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sthu, 0xB4000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // MEM(EA, 2) <- (RS)[48:63] // RA <- EA @@ -418,7 +418,7 @@ XEEMITTER(sthu, 0xB4000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(sthux, 0x7C00036E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sthux, 0x7C00036E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 2) <- (RS)[48:63] // RA <- EA @@ -428,7 +428,7 @@ XEEMITTER(sthux, 0x7C00036E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(sthx, 0x7C00032E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sthx, 0x7C00032E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -440,7 +440,7 @@ XEEMITTER(sthx, 0x7C00032E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stw, 0x90000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stw, 0x90000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -452,7 +452,7 @@ XEEMITTER(stw, 0x90000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stwu, 0x94000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stwu, 0x94000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // MEM(EA, 4) <- (RS)[32:63] // RA <- EA @@ -462,7 +462,7 @@ XEEMITTER(stwu, 0x94000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stwux, 0x7C00016E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stwux, 0x7C00016E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 4) <- (RS)[32:63] // RA <- EA @@ -472,7 +472,7 @@ XEEMITTER(stwux, 0x7C00016E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stwx, 0x7C00012E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stwx, 0x7C00012E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -484,7 +484,7 @@ XEEMITTER(stwx, 0x7C00012E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(std, 0xF8000000, DS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(std, 0xF8000000, DS )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -496,7 +496,7 @@ XEEMITTER(std, 0xF8000000, DS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stdu, 0xF8000001, DS )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stdu, 0xF8000001, DS )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(DS || 0b00) // MEM(EA, 8) <- (RS) // RA <- EA @@ -506,7 +506,7 @@ XEEMITTER(stdu, 0xF8000001, DS )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stdux, 0x7C00016A, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stdux, 0x7C00016A, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 8) <- (RS) // RA <- EA @@ -516,7 +516,7 @@ XEEMITTER(stdux, 0x7C00016A, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stdx, 0x7C00012A, X)(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stdx, 0x7C00012A, X)(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -531,7 +531,7 @@ XEEMITTER(stdx, 0x7C00012A, X)(PPCFunctionBuilder& f, InstrData& i) { // Integer load and store with byte reverse (A-1 -XEEMITTER(lhbrx, 0x7C00062C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lhbrx, 0x7C00062C, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -544,7 +544,7 @@ XEEMITTER(lhbrx, 0x7C00062C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwbrx, 0x7C00042C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwbrx, 0x7C00042C, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -557,7 +557,7 @@ XEEMITTER(lwbrx, 0x7C00042C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(ldbrx, 0x7C000428, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ldbrx, 0x7C000428, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -570,7 +570,7 @@ XEEMITTER(ldbrx, 0x7C000428, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(sthbrx, 0x7C00072C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sthbrx, 0x7C00072C, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -582,7 +582,7 @@ XEEMITTER(sthbrx, 0x7C00072C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stwbrx, 0x7C00052C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stwbrx, 0x7C00052C, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -594,7 +594,7 @@ XEEMITTER(stwbrx, 0x7C00052C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stdbrx, 0x7C000528, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stdbrx, 0x7C000528, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -609,12 +609,12 @@ XEEMITTER(stdbrx, 0x7C000528, X )(PPCFunctionBuilder& f, InstrData& i) { // Integer load and store multiple (A-16) -XEEMITTER(lmw, 0xB8000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lmw, 0xB8000000, D )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(stmw, 0xBC000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stmw, 0xBC000000, D )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } @@ -622,22 +622,22 @@ XEEMITTER(stmw, 0xBC000000, D )(PPCFunctionBuilder& f, InstrData& i) { // Integer load and store string (A-17) -XEEMITTER(lswi, 0x7C0004AA, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lswi, 0x7C0004AA, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(lswx, 0x7C00042A, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lswx, 0x7C00042A, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(stswi, 0x7C0005AA, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stswi, 0x7C0005AA, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } -XEEMITTER(stswx, 0x7C00052A, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stswx, 0x7C00052A, X )(PPCHIRBuilder& f, InstrData& i) { XEINSTRNOTIMPLEMENTED(); return 1; } @@ -645,25 +645,25 @@ XEEMITTER(stswx, 0x7C00052A, X )(PPCFunctionBuilder& f, InstrData& i) { // Memory synchronization (A-18) -XEEMITTER(eieio, 0x7C0006AC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(eieio, 0x7C0006AC, X )(PPCHIRBuilder& f, InstrData& i) { // XEINSTRNOTIMPLEMENTED(); f.Nop(); return 0; } -XEEMITTER(sync, 0x7C0004AC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(sync, 0x7C0004AC, X )(PPCHIRBuilder& f, InstrData& i) { // XEINSTRNOTIMPLEMENTED(); f.Nop(); return 0; } -XEEMITTER(isync, 0x4C00012C, XL )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(isync, 0x4C00012C, XL )(PPCHIRBuilder& f, InstrData& i) { // XEINSTRNOTIMPLEMENTED(); f.Nop(); return 0; } -XEEMITTER(ldarx, 0x7C0000A8, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(ldarx, 0x7C0000A8, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -679,7 +679,7 @@ XEEMITTER(ldarx, 0x7C0000A8, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lwarx, 0x7C000028, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lwarx, 0x7C000028, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -695,7 +695,7 @@ XEEMITTER(lwarx, 0x7C000028, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stdcx, 0x7C0001AD, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stdcx, 0x7C0001AD, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -712,7 +712,7 @@ XEEMITTER(stdcx, 0x7C0001AD, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stwcx, 0x7C00012D, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stwcx, 0x7C00012D, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -732,7 +732,7 @@ XEEMITTER(stwcx, 0x7C00012D, X )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point load (A-19) -XEEMITTER(lfd, 0xC8000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfd, 0xC8000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -745,7 +745,7 @@ XEEMITTER(lfd, 0xC8000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfdu, 0xCC000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfdu, 0xCC000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // FRT <- MEM(EA, 8) // RA <- EA @@ -756,7 +756,7 @@ XEEMITTER(lfdu, 0xCC000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfdux, 0x7C0004EE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfdux, 0x7C0004EE, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // FRT <- MEM(EA, 8) // RA <- EA @@ -767,7 +767,7 @@ XEEMITTER(lfdux, 0x7C0004EE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfdx, 0x7C0004AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfdx, 0x7C0004AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -780,7 +780,7 @@ XEEMITTER(lfdx, 0x7C0004AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfs, 0xC0000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfs, 0xC0000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -795,7 +795,7 @@ XEEMITTER(lfs, 0xC0000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfsu, 0xC4000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfsu, 0xC4000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // FRT <- DOUBLE(MEM(EA, 4)) // RA <- EA @@ -808,7 +808,7 @@ XEEMITTER(lfsu, 0xC4000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfsux, 0x7C00046E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfsux, 0x7C00046E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // FRT <- DOUBLE(MEM(EA, 4)) // RA <- EA @@ -821,7 +821,7 @@ XEEMITTER(lfsux, 0x7C00046E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(lfsx, 0x7C00042E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(lfsx, 0x7C00042E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -839,7 +839,7 @@ XEEMITTER(lfsx, 0x7C00042E, X )(PPCFunctionBuilder& f, InstrData& i) { // Floating-point store (A-20) -XEEMITTER(stfd, 0xD8000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfd, 0xD8000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -851,7 +851,7 @@ XEEMITTER(stfd, 0xD8000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfdu, 0xDC000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfdu, 0xDC000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // MEM(EA, 8) <- (FRS) // RA <- EA @@ -861,7 +861,7 @@ XEEMITTER(stfdu, 0xDC000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfdux, 0x7C0005EE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfdux, 0x7C0005EE, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 8) <- (FRS) // RA <- EA @@ -871,7 +871,7 @@ XEEMITTER(stfdux, 0x7C0005EE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfdx, 0x7C0005AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfdx, 0x7C0005AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -883,7 +883,7 @@ XEEMITTER(stfdx, 0x7C0005AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfiwx, 0x7C0007AE, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfiwx, 0x7C0007AE, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -895,7 +895,7 @@ XEEMITTER(stfiwx, 0x7C0007AE, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfs, 0xD0000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfs, 0xD0000000, D )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -908,7 +908,7 @@ XEEMITTER(stfs, 0xD0000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfsu, 0xD4000000, D )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfsu, 0xD4000000, D )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + EXTS(D) // MEM(EA, 4) <- SINGLE(FRS) // RA <- EA @@ -919,7 +919,7 @@ XEEMITTER(stfsu, 0xD4000000, D )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfsux, 0x7C00056E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfsux, 0x7C00056E, X )(PPCHIRBuilder& f, InstrData& i) { // EA <- (RA) + (RB) // MEM(EA, 4) <- SINGLE(FRS) // RA <- EA @@ -930,7 +930,7 @@ XEEMITTER(stfsux, 0x7C00056E, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(stfsx, 0x7C00052E, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(stfsx, 0x7C00052E, X )(PPCHIRBuilder& f, InstrData& i) { // if RA = 0 then // b <- 0 // else @@ -946,7 +946,7 @@ XEEMITTER(stfsx, 0x7C00052E, X )(PPCFunctionBuilder& f, InstrData& i) { // Cache management (A-27) -XEEMITTER(dcbf, 0x7C0000AC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dcbf, 0x7C0000AC, X )(PPCHIRBuilder& f, InstrData& i) { // No-op for now. // TODO(benvanik): use prefetch // XEINSTRNOTIMPLEMENTED(); @@ -954,7 +954,7 @@ XEEMITTER(dcbf, 0x7C0000AC, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(dcbst, 0x7C00006C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dcbst, 0x7C00006C, X )(PPCHIRBuilder& f, InstrData& i) { // No-op for now. // TODO(benvanik): use prefetch // XEINSTRNOTIMPLEMENTED(); @@ -962,7 +962,7 @@ XEEMITTER(dcbst, 0x7C00006C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(dcbt, 0x7C00022C, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dcbt, 0x7C00022C, X )(PPCHIRBuilder& f, InstrData& i) { // No-op for now. // TODO(benvanik): use prefetch // XEINSTRNOTIMPLEMENTED(); @@ -970,7 +970,7 @@ XEEMITTER(dcbt, 0x7C00022C, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(dcbtst, 0x7C0001EC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dcbtst, 0x7C0001EC, X )(PPCHIRBuilder& f, InstrData& i) { // No-op for now. // TODO(benvanik): use prefetch // XEINSTRNOTIMPLEMENTED(); @@ -978,7 +978,7 @@ XEEMITTER(dcbtst, 0x7C0001EC, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(dcbz, 0x7C0007EC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(dcbz, 0x7C0007EC, X )(PPCHIRBuilder& f, InstrData& i) { // No-op for now. // TODO(benvanik): use prefetch // or dcbz128 0x7C2007EC @@ -987,7 +987,7 @@ XEEMITTER(dcbz, 0x7C0007EC, X )(PPCFunctionBuilder& f, InstrData& i) { return 0; } -XEEMITTER(icbi, 0x7C0007AC, X )(PPCFunctionBuilder& f, InstrData& i) { +XEEMITTER(icbi, 0x7C0007AC, X )(PPCHIRBuilder& f, InstrData& i) { // XEINSTRNOTIMPLEMENTED(); f.Nop(); return 0; diff --git a/src/alloy/frontend/ppc/ppc_function_builder.cc b/src/alloy/frontend/ppc/ppc_hir_builder.cc similarity index 83% rename from src/alloy/frontend/ppc/ppc_function_builder.cc rename to src/alloy/frontend/ppc/ppc_hir_builder.cc index b5e428251..dd7c0d32d 100644 --- a/src/alloy/frontend/ppc/ppc_function_builder.cc +++ b/src/alloy/frontend/ppc/ppc_hir_builder.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include +#include #include #include @@ -23,24 +23,24 @@ using namespace alloy::hir; using namespace alloy::runtime; -PPCFunctionBuilder::PPCFunctionBuilder(PPCFrontend* frontend) : +PPCHIRBuilder::PPCHIRBuilder(PPCFrontend* frontend) : frontend_(frontend), - FunctionBuilder() { + HIRBuilder() { } -PPCFunctionBuilder::~PPCFunctionBuilder() { +PPCHIRBuilder::~PPCHIRBuilder() { } -void PPCFunctionBuilder::Reset() { +void PPCHIRBuilder::Reset() { start_address_ = 0; instr_offset_list_ = NULL; label_list_ = NULL; - FunctionBuilder::Reset(); + HIRBuilder::Reset(); } const bool FLAGS_annotate_disassembly = true; -int PPCFunctionBuilder::Emit(FunctionInfo* symbol_info) { +int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) { Memory* memory = frontend_->memory(); const uint8_t* p = memory->membase(); @@ -118,7 +118,7 @@ int PPCFunctionBuilder::Emit(FunctionInfo* symbol_info) { continue; } - typedef int (*InstrEmitter)(PPCFunctionBuilder& f, InstrData& i); + typedef int (*InstrEmitter)(PPCHIRBuilder& f, InstrData& i); InstrEmitter emit = (InstrEmitter)i.type->emit; /*if (i.address == FLAGS_break_on_instruction) { @@ -130,7 +130,7 @@ int PPCFunctionBuilder::Emit(FunctionInfo* symbol_info) { XELOGCPU("Unimplemented instr %.8X %.8X %s", i.address, i.code, i.type->name); Comment("UNIMPLEMENTED!"); - DebugBreak(); + //DebugBreak(); //TraceInvalidInstruction(i); // This printf is handy for sort/uniquify to find instructions. @@ -155,14 +155,14 @@ int PPCFunctionBuilder::Emit(FunctionInfo* symbol_info) { return Finalize(); } -void PPCFunctionBuilder::AnnotateLabel(uint64_t address, Label* label) { +void PPCHIRBuilder::AnnotateLabel(uint64_t address, Label* label) { char name_buffer[13]; xesnprintfa(name_buffer, XECOUNT(name_buffer), "loc_%.8X", address); label->name = (char*)arena_->Alloc(sizeof(name_buffer)); xe_copy_struct(label->name, name_buffer, sizeof(name_buffer)); } -FunctionInfo* PPCFunctionBuilder::LookupFunction(uint64_t address) { +FunctionInfo* PPCHIRBuilder::LookupFunction(uint64_t address) { Runtime* runtime = frontend_->runtime(); FunctionInfo* symbol_info; if (runtime->LookupFunctionInfo(address, &symbol_info)) { @@ -171,7 +171,7 @@ FunctionInfo* PPCFunctionBuilder::LookupFunction(uint64_t address) { return symbol_info; } -Label* PPCFunctionBuilder::LookupLabel(uint64_t address) { +Label* PPCHIRBuilder::LookupLabel(uint64_t address) { if (address < start_address_) { return NULL; } @@ -206,50 +206,50 @@ Label* PPCFunctionBuilder::LookupLabel(uint64_t address) { return label; } -//Value* PPCFunctionBuilder::LoadXER() { +//Value* PPCHIRBuilder::LoadXER() { //} // -//void PPCFunctionBuilder::StoreXER(Value* value) { +//void PPCHIRBuilder::StoreXER(Value* value) { //} -Value* PPCFunctionBuilder::LoadLR() { +Value* PPCHIRBuilder::LoadLR() { return LoadContext(offsetof(PPCContext, lr), INT64_TYPE); } -void PPCFunctionBuilder::StoreLR(Value* value) { +void PPCHIRBuilder::StoreLR(Value* value) { XEASSERT(value->type == INT64_TYPE); StoreContext(offsetof(PPCContext, lr), value); } -Value* PPCFunctionBuilder::LoadCTR() { +Value* PPCHIRBuilder::LoadCTR() { return LoadContext(offsetof(PPCContext, ctr), INT64_TYPE); } -void PPCFunctionBuilder::StoreCTR(Value* value) { +void PPCHIRBuilder::StoreCTR(Value* value) { XEASSERT(value->type == INT64_TYPE); StoreContext(offsetof(PPCContext, ctr), value); } -Value* PPCFunctionBuilder::LoadCR(uint32_t n) { +Value* PPCHIRBuilder::LoadCR(uint32_t n) { XEASSERTALWAYS(); return 0; } -Value* PPCFunctionBuilder::LoadCRField(uint32_t n, uint32_t bit) { +Value* PPCHIRBuilder::LoadCRField(uint32_t n, uint32_t bit) { return LoadContext(offsetof(PPCContext, cr0) + (4 * n) + bit, INT8_TYPE); } -void PPCFunctionBuilder::StoreCR(uint32_t n, Value* value) { +void PPCHIRBuilder::StoreCR(uint32_t n, Value* value) { // TODO(benvanik): split bits out and store in values. XEASSERTALWAYS(); } -void PPCFunctionBuilder::UpdateCR( +void PPCHIRBuilder::UpdateCR( uint32_t n, Value* lhs, bool is_signed) { UpdateCR(n, lhs, LoadZero(lhs->type), is_signed); } -void PPCFunctionBuilder::UpdateCR( +void PPCHIRBuilder::UpdateCR( uint32_t n, Value* lhs, Value* rhs, bool is_signed) { Value* lt; Value* gt; @@ -269,7 +269,7 @@ void PPCFunctionBuilder::UpdateCR( // StoreContext(offsetof(PPCContext, cr) + (4 * n) + 3, so); } -void PPCFunctionBuilder::UpdateCR6(Value* src_value) { +void PPCHIRBuilder::UpdateCR6(Value* src_value) { // Testing for all 1's and all 0's. // if (Rc) CR6 = all_equal | 0 | none_equal | 0 // TODO(benvanik): efficient instruction? @@ -277,51 +277,51 @@ void PPCFunctionBuilder::UpdateCR6(Value* src_value) { StoreContext(offsetof(PPCContext, cr6.cr6_none_equal), IsFalse(src_value)); } -Value* PPCFunctionBuilder::LoadXER() { +Value* PPCHIRBuilder::LoadXER() { XEASSERTALWAYS(); return NULL; } -void PPCFunctionBuilder::StoreXER(Value* value) { +void PPCHIRBuilder::StoreXER(Value* value) { XEASSERTALWAYS(); } -Value* PPCFunctionBuilder::LoadCA() { +Value* PPCHIRBuilder::LoadCA() { return LoadContext(offsetof(PPCContext, xer_ca), INT8_TYPE); } -void PPCFunctionBuilder::StoreCA(Value* value) { +void PPCHIRBuilder::StoreCA(Value* value) { StoreContext(offsetof(PPCContext, xer_ca), value); } -Value* PPCFunctionBuilder::LoadGPR(uint32_t reg) { +Value* PPCHIRBuilder::LoadGPR(uint32_t reg) { return LoadContext( offsetof(PPCContext, r) + reg * 8, INT64_TYPE); } -void PPCFunctionBuilder::StoreGPR(uint32_t reg, Value* value) { +void PPCHIRBuilder::StoreGPR(uint32_t reg, Value* value) { XEASSERT(value->type == INT64_TYPE); StoreContext( offsetof(PPCContext, r) + reg * 8, value); } -Value* PPCFunctionBuilder::LoadFPR(uint32_t reg) { +Value* PPCHIRBuilder::LoadFPR(uint32_t reg) { return LoadContext( offsetof(PPCContext, f) + reg * 8, FLOAT64_TYPE); } -void PPCFunctionBuilder::StoreFPR(uint32_t reg, Value* value) { +void PPCHIRBuilder::StoreFPR(uint32_t reg, Value* value) { XEASSERT(value->type == FLOAT64_TYPE); StoreContext( offsetof(PPCContext, f) + reg * 8, value); } -Value* PPCFunctionBuilder::LoadVR(uint32_t reg) { +Value* PPCHIRBuilder::LoadVR(uint32_t reg) { return LoadContext( offsetof(PPCContext, v) + reg * 16, VEC128_TYPE); } -void PPCFunctionBuilder::StoreVR(uint32_t reg, Value* value) { +void PPCHIRBuilder::StoreVR(uint32_t reg, Value* value) { XEASSERT(value->type == VEC128_TYPE); StoreContext( offsetof(PPCContext, v) + reg * 16, value); diff --git a/src/alloy/frontend/ppc/ppc_function_builder.h b/src/alloy/frontend/ppc/ppc_hir_builder.h similarity index 86% rename from src/alloy/frontend/ppc/ppc_function_builder.h rename to src/alloy/frontend/ppc/ppc_hir_builder.h index 026fdc079..a4dee98cc 100644 --- a/src/alloy/frontend/ppc/ppc_function_builder.h +++ b/src/alloy/frontend/ppc/ppc_hir_builder.h @@ -7,11 +7,11 @@ ****************************************************************************** */ -#ifndef ALLOY_FRONTEND_PPC_PPC_FUNCTION_BUILDER_H_ -#define ALLOY_FRONTEND_PPC_PPC_FUNCTION_BUILDER_H_ +#ifndef ALLOY_FRONTEND_PPC_PPC_HIR_BUILDER_H_ +#define ALLOY_FRONTEND_PPC_PPC_HIR_BUILDER_H_ #include -#include +#include #include #include @@ -23,13 +23,13 @@ namespace ppc { class PPCFrontend; -class PPCFunctionBuilder : public hir::FunctionBuilder { +class PPCHIRBuilder : public hir::HIRBuilder { using Instr = alloy::hir::Instr; using Label = alloy::hir::Label; using Value = alloy::hir::Value; public: - PPCFunctionBuilder(PPCFrontend* frontend); - virtual ~PPCFunctionBuilder(); + PPCHIRBuilder(PPCFrontend* frontend); + virtual ~PPCHIRBuilder(); virtual void Reset(); @@ -83,4 +83,4 @@ private: } // namespace alloy -#endif // ALLOY_FRONTEND_PPC_PPC_FUNCTION_BUILDER_H_ +#endif // ALLOY_FRONTEND_PPC_PPC_HIR_BUILDER_H_ diff --git a/src/alloy/frontend/ppc/ppc_translator.cc b/src/alloy/frontend/ppc/ppc_translator.cc index 675afc9de..2a635290b 100644 --- a/src/alloy/frontend/ppc/ppc_translator.cc +++ b/src/alloy/frontend/ppc/ppc_translator.cc @@ -10,10 +10,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ using namespace alloy::runtime; PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) { scanner_ = new PPCScanner(frontend); - builder_ = new PPCFunctionBuilder(frontend); + builder_ = new PPCHIRBuilder(frontend); compiler_ = new Compiler(frontend->runtime()); diff --git a/src/alloy/frontend/ppc/ppc_translator.h b/src/alloy/frontend/ppc/ppc_translator.h index 93adb3d36..107245f5e 100644 --- a/src/alloy/frontend/ppc/ppc_translator.h +++ b/src/alloy/frontend/ppc/ppc_translator.h @@ -21,7 +21,7 @@ namespace frontend { namespace ppc { class PPCFrontend; -class PPCFunctionBuilder; +class PPCHIRBuilder; class PPCScanner; @@ -43,7 +43,7 @@ private: private: PPCFrontend* frontend_; PPCScanner* scanner_; - PPCFunctionBuilder* builder_; + PPCHIRBuilder* builder_; compiler::Compiler* compiler_; backend::Assembler* assembler_; diff --git a/src/alloy/frontend/ppc/sources.gypi b/src/alloy/frontend/ppc/sources.gypi index ff97163b6..25f71eeab 100644 --- a/src/alloy/frontend/ppc/sources.gypi +++ b/src/alloy/frontend/ppc/sources.gypi @@ -19,8 +19,8 @@ 'ppc_emit_memory.cc', 'ppc_frontend.cc', 'ppc_frontend.h', - 'ppc_function_builder.cc', - 'ppc_function_builder.h', + 'ppc_hir_builder.cc', + 'ppc_hir_builder.h', 'ppc_instr.cc', 'ppc_instr.h', 'ppc_instr_tables.h', diff --git a/src/alloy/hir/block.h b/src/alloy/hir/block.h index d32caa262..4de652ffa 100644 --- a/src/alloy/hir/block.h +++ b/src/alloy/hir/block.h @@ -16,7 +16,7 @@ namespace alloy { namespace hir { -class FunctionBuilder; +class HIRBuilder; class Instr; class Label; diff --git a/src/alloy/hir/function_builder.cc b/src/alloy/hir/hir_builder.cc similarity index 84% rename from src/alloy/hir/function_builder.cc rename to src/alloy/hir/hir_builder.cc index 637712fa9..ff058ae45 100644 --- a/src/alloy/hir/function_builder.cc +++ b/src/alloy/hir/hir_builder.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include +#include #include #include @@ -26,17 +26,17 @@ using namespace alloy::runtime; #define ASSERT_TYPES_EQUAL(value1, value2) -FunctionBuilder::FunctionBuilder() { +HIRBuilder::HIRBuilder() { arena_ = new Arena(); Reset(); } -FunctionBuilder::~FunctionBuilder() { +HIRBuilder::~HIRBuilder() { Reset(); delete arena_; } -void FunctionBuilder::Reset() { +void HIRBuilder::Reset() { attributes_ = 0; next_label_id_ = 0; next_value_ordinal_ = 0; @@ -44,7 +44,7 @@ void FunctionBuilder::Reset() { current_block_ = NULL; } -int FunctionBuilder::Finalize() { +int HIRBuilder::Finalize() { // Scan blocks in order and add fallthrough branches. These are needed for // analysis passes to work. We may have also added blocks out of order and // need to ensure they fall through in the right order. @@ -79,7 +79,7 @@ int FunctionBuilder::Finalize() { return 0; } -void FunctionBuilder::DumpValue(StringBuffer* str, Value* value) { +void HIRBuilder::DumpValue(StringBuffer* str, Value* value) { if (value->IsConstant()) { switch (value->type) { case INT8_TYPE: str->Append("%X", value->constant.i8); break; @@ -103,7 +103,7 @@ void FunctionBuilder::DumpValue(StringBuffer* str, Value* value) { } } -void FunctionBuilder::DumpOp( +void HIRBuilder::DumpOp( StringBuffer* str, OpcodeSignatureType sig_type, Instr::Op* op) { switch (sig_type) { case OPCODE_SIG_TYPE_X: @@ -127,7 +127,7 @@ void FunctionBuilder::DumpOp( } } -void FunctionBuilder::Dump(StringBuffer* str) { +void HIRBuilder::Dump(StringBuffer* str) { if (attributes_) { str->Append("; attributes = %.8X\n", attributes_); } @@ -199,11 +199,11 @@ void FunctionBuilder::Dump(StringBuffer* str) { } } -Block* FunctionBuilder::current_block() const { +Block* HIRBuilder::current_block() const { return current_block_; } -Instr* FunctionBuilder::last_instr() const { +Instr* HIRBuilder::last_instr() const { if (current_block_ && current_block_->instr_tail) { return current_block_->instr_tail; } else if (block_tail_) { @@ -212,7 +212,7 @@ Instr* FunctionBuilder::last_instr() const { return NULL; } -Label* FunctionBuilder::NewLabel() { +Label* HIRBuilder::NewLabel() { Label* label = arena_->Alloc