summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-16 18:13:05 +0000
committerChris Lattner <sabre@nondot.org>2004-10-16 18:13:05 +0000
commite4bea062c72bd6222b2e0de47df35d28b9f15b99 (patch)
tree118cbd321a5241223da7d2c04a0339686883a627 /llvm/lib
parent583dfdcf869b63379a7052e4d0f24fe3e4587679 (diff)
downloadbcm5719-llvm-e4bea062c72bd6222b2e0de47df35d28b9f15b99.tar.gz
bcm5719-llvm-e4bea062c72bd6222b2e0de47df35d28b9f15b99.zip
Teach the X86 backend about unreachable and undef. Among other things, we
now compile: 'foo() {}' into "ret" instead of "mov EAX, 0; ret" llvm-svn: 17049
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelSimple.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelSimple.cpp b/llvm/lib/Target/X86/X86ISelSimple.cpp
index a938bae3fc7..926492e31f5 100644
--- a/llvm/lib/Target/X86/X86ISelSimple.cpp
+++ b/llvm/lib/Target/X86/X86ISelSimple.cpp
@@ -175,6 +175,7 @@ namespace {
// Control flow operators
void visitReturnInst(ReturnInst &RI);
void visitBranchInst(BranchInst &BI);
+ void visitUnreachableInst(UnreachableInst &UI) {}
struct ValueRecord {
Value *Val;
@@ -447,7 +448,20 @@ unsigned X86ISel::getFixedSizedAllocaFI(AllocaInst *AI) {
void X86ISel::copyConstantToRegister(MachineBasicBlock *MBB,
MachineBasicBlock::iterator IP,
Constant *C, unsigned R) {
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
+ if (isa<UndefValue>(C)) {
+ switch (getClassB(C->getType())) {
+ case cFP:
+ // FIXME: SHOULD TEACH STACKIFIER ABOUT UNDEF VALUES!
+ BuildMI(*MBB, IP, X86::FLD0, 0, R);
+ return;
+ case cLong:
+ BuildMI(*MBB, IP, X86::IMPLICIT_DEF, 0, R+1);
+ // FALL THROUGH
+ default:
+ BuildMI(*MBB, IP, X86::IMPLICIT_DEF, 0, R);
+ return;
+ }
+ } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
unsigned Class = 0;
switch (CE->getOpcode()) {
case Instruction::GetElementPtr:
OpenPOWER on IntegriCloud