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
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index dd75168..5f83bae 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -4650,58 +4650,33 @@
   }
 }
 
-template <>
-void ConstantInteger32::emitWithoutDollar(GlobalContext *Ctx) const {
+void TargetX8632::emit(const ConstantInteger32 *C) const {
   if (!ALLOW_DUMP)
     return;
   Ostream &Str = Ctx->getStrEmit();
-  Str << (int32_t)getValue();
+  Str << getConstantPrefix() << C->getValue();
 }
 
-template <> void ConstantInteger32::emit(GlobalContext *Ctx) const {
+void TargetX8632::emit(const ConstantInteger64 *) const {
+  llvm::report_fatal_error("Not expecting to emit 64-bit integers");
+}
+
+void TargetX8632::emit(const ConstantFloat *C) const {
   if (!ALLOW_DUMP)
     return;
   Ostream &Str = Ctx->getStrEmit();
-  Str << "$";
-  emitWithoutDollar(Ctx);
+  C->emitPoolLabel(Str);
 }
 
-template <> void ConstantInteger64::emitWithoutDollar(GlobalContext *) const {
-  llvm_unreachable("Not expecting to emitWithoutDollar 64-bit integers");
-}
-
-template <> void ConstantInteger64::emit(GlobalContext *) const {
-  llvm_unreachable("Not expecting to emit 64-bit integers");
-}
-
-template <> void ConstantFloat::emitWithoutDollar(GlobalContext *) const {
-  llvm_unreachable("Not expecting to emitWithoutDollar floats");
-}
-
-template <> void ConstantFloat::emit(GlobalContext *Ctx) const {
+void TargetX8632::emit(const ConstantDouble *C) const {
   if (!ALLOW_DUMP)
     return;
   Ostream &Str = Ctx->getStrEmit();
-  emitPoolLabel(Str);
+  C->emitPoolLabel(Str);
 }
 
-template <> void ConstantDouble::emitWithoutDollar(GlobalContext *) const {
-  llvm_unreachable("Not expecting to emitWithoutDollar doubles");
-}
-
-template <> void ConstantDouble::emit(GlobalContext *Ctx) const {
-  if (!ALLOW_DUMP)
-    return;
-  Ostream &Str = Ctx->getStrEmit();
-  emitPoolLabel(Str);
-}
-
-void ConstantUndef::emitWithoutDollar(GlobalContext *) const {
-  llvm_unreachable("Not expecting to emitWithoutDollar undef");
-}
-
-void ConstantUndef::emit(GlobalContext *) const {
-  llvm_unreachable("undef value encountered by emitter.");
+void TargetX8632::emit(const ConstantUndef *) const {
+  llvm::report_fatal_error("undef value encountered by emitter.");
 }
 
 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx)