diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-02-27 22:08:27 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-02-27 22:08:27 +0000 | 
| commit | cbebe4600fff15f5ce56780ee12ff5bbb415d4fe (patch) | |
| tree | d776721db488ee80775cbd840d2e4000f75ebe53 /llvm/utils | |
| parent | bf5f3945fd70ffee4eaa727081a153b4bf888ae7 (diff) | |
| download | bcm5719-llvm-cbebe4600fff15f5ce56780ee12ff5bbb415d4fe.tar.gz bcm5719-llvm-cbebe4600fff15f5ce56780ee12ff5bbb415d4fe.zip  | |
reapply
llvm-svn: 34697
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/CallingConvEmitter.cpp | 3 | ||||
| -rw-r--r-- | llvm/utils/TableGen/CodeGenTarget.cpp | 8 | ||||
| -rw-r--r-- | llvm/utils/TableGen/Record.cpp | 7 | ||||
| -rw-r--r-- | llvm/utils/TableGen/Record.h | 2 | ||||
| -rw-r--r-- | llvm/utils/TableGen/TableGen.cpp | 8 | 
5 files changed, 20 insertions, 8 deletions
diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp index 977191f92d3..1ef30aad07d 100644 --- a/llvm/utils/TableGen/CallingConvEmitter.cpp +++ b/llvm/utils/TableGen/CallingConvEmitter.cpp @@ -125,4 +125,5 @@ void CallingConvEmitter::EmitAction(Record *Action,        throw "Unknown CCAction!";      }    } -}
\ No newline at end of file +} + diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 688ed0f9248..d29ce514bed 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -604,9 +604,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget *CGT) {    // Parse the list of argument types.    ListInit *TypeList = R->getValueAsListInit("Types");    for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) { -    DefInit *DI = dynamic_cast<DefInit*>(TypeList->getElement(i)); -    assert(DI && "Invalid list type!"); -    Record *TyEl = DI->getDef(); +    Record *TyEl = TypeList->getElementAsRecord(i);      assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");      ArgTypes.push_back(TyEl->getValueAsString("TypeVal")); @@ -620,9 +618,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget *CGT) {    // Parse the intrinsic properties.    ListInit *PropList = R->getValueAsListInit("Properties");    for (unsigned i = 0, e = PropList->getSize(); i != e; ++i) { -    DefInit *DI = dynamic_cast<DefInit*>(PropList->getElement(i)); -    assert(DI && "Invalid list type!"); -    Record *Property = DI->getDef(); +    Record *Property = PropList->getElementAsRecord(i);      assert(Property->isSubClassOf("IntrinsicProperty") &&             "Expected a property!"); diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp index 94e0cb472f3..bbcdbe7da30 100644 --- a/llvm/utils/TableGen/Record.cpp +++ b/llvm/utils/TableGen/Record.cpp @@ -337,6 +337,13 @@ Init *ListInit::convertInitListSlice(const std::vector<unsigned> &Elements) {    return new ListInit(Vals);  } +Record *ListInit::getElementAsRecord(unsigned i) const { +  assert(i < Values.size() && "List element index out of range!"); +  DefInit *DI = dynamic_cast<DefInit*>(Values[i]); +  if (DI == 0) throw "Expected record in list!"; +  return DI->getDef(); +} +  Init *ListInit::resolveReferences(Record &R, const RecordVal *RV) {    std::vector<Init*> Resolved;    Resolved.reserve(getSize()); diff --git a/llvm/utils/TableGen/Record.h b/llvm/utils/TableGen/Record.h index 986e9178d90..0971e938baa 100644 --- a/llvm/utils/TableGen/Record.h +++ b/llvm/utils/TableGen/Record.h @@ -626,6 +626,8 @@ public:      return Values[i];    } +  Record *getElementAsRecord(unsigned i) const; +      Init *convertInitListSlice(const std::vector<unsigned> &Elements);    virtual Init *convertInitializerTo(RecTy *Ty) { diff --git a/llvm/utils/TableGen/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp index 4345234c275..d3d241e6c70 100644 --- a/llvm/utils/TableGen/TableGen.cpp +++ b/llvm/utils/TableGen/TableGen.cpp @@ -20,6 +20,7 @@  #include "llvm/Support/Streams.h"  #include "llvm/System/Signals.h"  #include "llvm/Support/FileUtilities.h" +#include "CallingConvEmitter.h"  #include "CodeEmitterGen.h"  #include "RegisterInfoEmitter.h"  #include "InstrInfoEmitter.h" @@ -38,6 +39,7 @@ enum ActionType {    GenEmitter,    GenRegisterEnums, GenRegister, GenRegisterHeader,    GenInstrEnums, GenInstrs, GenAsmWriter,  +  GenCallingConv,    GenDAGISel,    GenSubtarget,    GenIntrinsic, @@ -61,6 +63,8 @@ namespace {                                 "Generate enum values for instructions"),                      clEnumValN(GenInstrs, "gen-instr-desc",                                 "Generate instruction descriptions"), +                    clEnumValN(GenCallingConv, "gen-callingconv", +                               "Generate calling convention descriptions"),                      clEnumValN(GenAsmWriter, "gen-asm-writer",                                 "Generate assembly writer"),                      clEnumValN(GenDAGISel, "gen-dag-isel", @@ -138,7 +142,9 @@ int main(int argc, char **argv) {      case GenInstrs:        InstrInfoEmitter(Records).run(*Out);        break; - +    case GenCallingConv: +      CallingConvEmitter(Records).run(*Out); +      break;      case GenAsmWriter:        AsmWriterEmitter(Records).run(*Out);        break;  | 

