diff options
author | Chris Lattner <sabre@nondot.org> | 2002-12-04 06:45:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-12-04 06:45:19 +0000 |
commit | dbf30f7b02e23a19eaa4f7b437a1f5682e4ee74c (patch) | |
tree | a85a3d57b6f32515849ad982eace3e044e619881 /lib/Target/X86/InstSelectSimple.cpp | |
parent | b72d221d619211335780b90f43bb129cf15fe0e7 (diff) |
Add support for referencing global variables/functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r-- | lib/Target/X86/InstSelectSimple.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 04827f03fc..56ce189fca 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -133,8 +133,14 @@ namespace { // If this operand is a constant, emit the code to copy the constant into // the register here... // - if (Constant *C = dyn_cast<Constant>(V)) + if (Constant *C = dyn_cast<Constant>(V)) { copyConstantToRegister(C, Reg); + } else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) { + // Move the address of the global into the register + BuildMI(BB, X86::MOVir32, 1, Reg).addReg(GV); + } else { + assert(0 && "Don't know how to handle a value of this type!"); + } return Reg; } |