OSDN Git Service

Convert Constant->emit() definitions to allow multiple targets to define them.
authorJan Voung <jvoung@chromium.org>
Thu, 14 May 2015 16:26:19 +0000 (09:26 -0700)
committerJan Voung <jvoung@chromium.org>
Thu, 14 May 2015 16:26:19 +0000 (09:26 -0700)
commit76bb0bec94b99765be86525fa1ae2c607e66d9b6
tree49484ecaa9134a9ae88fc1c935debc7a592e88ea
parentb2d5084c573ef5de15eb0e87bdde5dfba59e524a
Convert Constant->emit() definitions to allow multiple targets to define them.

Wasn't sure how to allow TargetX8632 and TargetARM32
to both define "ConstantInteger32::emit(GlobalContext *)",
and define them differently if both targets happen to be
ifdef'ed into the code. Rearranged things so that it's now
"TargetFoo::emit(ConstantInteger32 *)", so that each
TargetFoo can have a separate definition.

Some targets may allow emitting some types of constants
while other targets do not (64-bit int for x86-64?).
Also they emit constants with a different style.
E.g., the prefix for x86 is "$" while the prefix for ARM
is "#" and there isn't a prefix for mips(?).
Renamed emitWithoutDollar to emitWithoutPrefix.

Did this sort of multi-method dispatch via a visitor
pattern, which is a bit verbose though.

We may be able to remove the emitWithoutDollar/Prefix for
ConstantPrimitive by just inlining that into the few places
that need it (only needed for ConstantInteger32). This
undoes the unreachable methods added by: https://codereview.chromium.org/1017373002/diff/60001/src/IceTargetLoweringX8632.cpp
The only place extra was for emitting calls to constants.
There was already an inlined instance for OperandX8632Mem.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1129263005
src/IceInstX8632.cpp
src/IceOperand.cpp
src/IceOperand.h
src/IceTargetLowering.cpp
src/IceTargetLowering.h
src/IceTargetLoweringARM32.cpp
src/IceTargetLoweringARM32.h
src/IceTargetLoweringX8632.cpp
src/IceTargetLoweringX8632.h