aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2002-11-26 10:43:30 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2002-11-26 10:43:30 +0000
commitc11232a8c4477fc683a9947c6098e4845556fdd4 (patch)
tree30bdee3bb79f60a36f097353c4168a64c9ccc461 /lib
parente31267dd9a2619c223da0578e1765fcd88ec440a (diff)
downloadexternal_llvm-c11232a8c4477fc683a9947c6098e4845556fdd4.zip
external_llvm-c11232a8c4477fc683a9947c6098e4845556fdd4.tar.gz
external_llvm-c11232a8c4477fc683a9947c6098e4845556fdd4.tar.bz2
brg
InstSelectSimple.cpp: Add some comments that say what I'm going to do for calls and casts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/InstSelectSimple.cpp36
-rw-r--r--lib/Target/X86/X86ISelSimple.cpp36
2 files changed, 66 insertions, 6 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp
index e5c5535..20fc69a 100644
--- a/lib/Target/X86/InstSelectSimple.cpp
+++ b/lib/Target/X86/InstSelectSimple.cpp
@@ -363,9 +363,9 @@ ISel::visitBranchInst (BranchInst & BI)
}
}
-void
-ISel::visitCallInst (CallInst &CI)
-{
+/// visitCallInst - Have to push args and do a procedure call
+/// instruction, if the target address is known.
+void ISel::visitCallInst (CallInst &CI) {
visitInstruction (CI);
}
@@ -581,9 +581,39 @@ void ISel::visitPHINode(PHINode &PN) {
}
}
+/// visitCastInst - Here we have various kinds of copying with or without
+/// sign extension going on.
void
ISel::visitCastInst (CastInst &CI)
{
+//> cast larger int to smaller int --> copy least significant byte/word w/ mov?
+//
+//I'm not really sure what to do with this. We could insert a pseudo-op
+//that says take the low X bits of a Y bit register, but for now we can just
+//force the value into, say, EAX, then rip out AL or AX. The advantage of
+//the former is that the register allocator could use any register it wants,
+//but for now this obviously doesn't matter. :)
+
+// if target type is bool
+// Emit Compare
+// Emit Set-if-not-zero
+
+// if size of target type == size of source type
+// Emit Mov reg(target) <- reg(source)
+
+// if size of target type > size of source type
+// if both types are integer types
+// if source type is signed
+// sbyte to short, ushort: Emit movsx 8->16
+// sbyte to int, uint: Emit movsx 8->32
+// short to int, uint: Emit movsx 16->32
+// else if source type is unsigned
+// ubyte to short, ushort: Emit movzx 8->16
+// ubyte to int, uint: Emit movzx 8->32
+// ushort to int, uint: Emit movzx 16->32
+// if both types are fp types
+// float to double: Emit fstp, fld (???)
+
visitInstruction (CI);
}
diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp
index e5c5535..20fc69a 100644
--- a/lib/Target/X86/X86ISelSimple.cpp
+++ b/lib/Target/X86/X86ISelSimple.cpp
@@ -363,9 +363,9 @@ ISel::visitBranchInst (BranchInst & BI)
}
}
-void
-ISel::visitCallInst (CallInst &CI)
-{
+/// visitCallInst - Have to push args and do a procedure call
+/// instruction, if the target address is known.
+void ISel::visitCallInst (CallInst &CI) {
visitInstruction (CI);
}
@@ -581,9 +581,39 @@ void ISel::visitPHINode(PHINode &PN) {
}
}
+/// visitCastInst - Here we have various kinds of copying with or without
+/// sign extension going on.
void
ISel::visitCastInst (CastInst &CI)
{
+//> cast larger int to smaller int --> copy least significant byte/word w/ mov?
+//
+//I'm not really sure what to do with this. We could insert a pseudo-op
+//that says take the low X bits of a Y bit register, but for now we can just
+//force the value into, say, EAX, then rip out AL or AX. The advantage of
+//the former is that the register allocator could use any register it wants,
+//but for now this obviously doesn't matter. :)
+
+// if target type is bool
+// Emit Compare
+// Emit Set-if-not-zero
+
+// if size of target type == size of source type
+// Emit Mov reg(target) <- reg(source)
+
+// if size of target type > size of source type
+// if both types are integer types
+// if source type is signed
+// sbyte to short, ushort: Emit movsx 8->16
+// sbyte to int, uint: Emit movsx 8->32
+// short to int, uint: Emit movsx 16->32
+// else if source type is unsigned
+// ubyte to short, ushort: Emit movzx 8->16
+// ubyte to int, uint: Emit movzx 8->32
+// ushort to int, uint: Emit movzx 16->32
+// if both types are fp types
+// float to double: Emit fstp, fld (???)
+
visitInstruction (CI);
}